From c9e01ed9d2e6a038ad7ce87d89027670538cf8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Wed, 8 Sep 2010 11:38:16 +0200 Subject: [PATCH] Added license to source code --- trunk/src/com/jpexs/asdec/Main.java | 828 ++-- trunk/src/com/jpexs/asdec/SWF.java | 398 +- trunk/src/com/jpexs/asdec/SWFInputStream.java | 18 + .../src/com/jpexs/asdec/SWFOutputStream.java | 18 + trunk/src/com/jpexs/asdec/abc/ABC.java | 1465 +++---- .../com/jpexs/asdec/abc/ABCInputStream.java | 622 +-- .../com/jpexs/asdec/abc/ABCOutputStream.java | 520 +-- .../com/jpexs/asdec/abc/CopyOutputStream.java | 122 +- .../com/jpexs/asdec/abc/NotSameException.java | 38 +- trunk/src/com/jpexs/asdec/abc/Usage.java | 27 + .../com/jpexs/asdec/abc/avm2/AVM2Code.java | 3376 +++++++++-------- .../jpexs/asdec/abc/avm2/ConstantPool.java | 258 +- .../asdec/abc/avm2/ConvertException.java | 42 +- .../abc/avm2/InvalidInstructionArguments.java | 42 +- .../jpexs/asdec/abc/avm2/LocalDataArea.java | 48 +- .../abc/avm2/UnknownInstructionCode.java | 44 +- .../asdec/abc/avm2/UnknownJumpException.java | 74 +- .../avm2/instructions/AVM2Instruction.java | 358 +- .../abc/avm2/instructions/IfTypeIns.java | 42 +- .../instructions/InstructionDefinition.java | 232 +- .../abc/avm2/instructions/SetTypeIns.java | 48 +- .../avm2/instructions/arithmetic/AddIIns.java | 74 +- .../avm2/instructions/arithmetic/AddIns.java | 120 +- .../arithmetic/DecrementIIns.java | 108 +- .../instructions/arithmetic/DecrementIns.java | 108 +- .../instructions/arithmetic/DivideIns.java | 118 +- .../arithmetic/IncrementIIns.java | 70 +- .../instructions/arithmetic/IncrementIns.java | 70 +- .../instructions/arithmetic/ModuloIns.java | 74 +- .../instructions/arithmetic/MultiplyIIns.java | 74 +- .../instructions/arithmetic/MultiplyIns.java | 74 +- .../instructions/arithmetic/NegateIIns.java | 72 +- .../instructions/arithmetic/NegateIns.java | 72 +- .../avm2/instructions/arithmetic/NotIns.java | 72 +- .../instructions/arithmetic/SubtractIIns.java | 74 +- .../instructions/arithmetic/SubtractIns.java | 74 +- .../avm2/instructions/bitwise/BitAndIns.java | 92 +- .../avm2/instructions/bitwise/BitNotIns.java | 88 +- .../avm2/instructions/bitwise/BitOrIns.java | 92 +- .../avm2/instructions/bitwise/BitXorIns.java | 92 +- .../avm2/instructions/bitwise/LShiftIns.java | 74 +- .../avm2/instructions/bitwise/RShiftIns.java | 74 +- .../avm2/instructions/bitwise/URShiftIns.java | 74 +- .../instructions/comparsion/EqualsIns.java | 92 +- .../comparsion/GreaterEqualsIns.java | 74 +- .../comparsion/GreaterThanIns.java | 74 +- .../comparsion/LessEqualsIns.java | 74 +- .../instructions/comparsion/LessThanIns.java | 74 +- .../comparsion/StrictEqualsIns.java | 74 +- .../construction/ConstructIns.java | 114 +- .../construction/ConstructPropIns.java | 128 +- .../construction/ConstructSuperIns.java | 114 +- .../construction/NewActivationIns.java | 70 +- .../construction/NewArrayIns.java | 84 +- .../construction/NewCatchIns.java | 74 +- .../construction/NewClassIns.java | 76 +- .../construction/NewFunctionIns.java | 86 +- .../construction/NewObjectIns.java | 90 +- .../avm2/instructions/debug/DebugFileIns.java | 48 +- .../abc/avm2/instructions/debug/DebugIns.java | 48 +- .../avm2/instructions/debug/DebugLineIns.java | 48 +- .../avm2/instructions/executing/CallIns.java | 116 +- .../instructions/executing/CallMethodIns.java | 118 +- .../executing/CallPropLexIns.java | 92 +- .../executing/CallPropVoidIns.java | 132 +- .../executing/CallPropertyIns.java | 128 +- .../instructions/executing/CallStaticIns.java | 118 +- .../instructions/executing/CallSuperIns.java | 126 +- .../executing/CallSuperVoidIns.java | 128 +- .../abc/avm2/instructions/jumps/IfEqIns.java | 92 +- .../avm2/instructions/jumps/IfFalseIns.java | 86 +- .../abc/avm2/instructions/jumps/IfGeIns.java | 92 +- .../abc/avm2/instructions/jumps/IfGtIns.java | 92 +- .../abc/avm2/instructions/jumps/IfLeIns.java | 92 +- .../abc/avm2/instructions/jumps/IfLtIns.java | 92 +- .../abc/avm2/instructions/jumps/IfNGeIns.java | 92 +- .../abc/avm2/instructions/jumps/IfNGtIns.java | 92 +- .../abc/avm2/instructions/jumps/IfNLeIns.java | 92 +- .../abc/avm2/instructions/jumps/IfNLtIns.java | 92 +- .../abc/avm2/instructions/jumps/IfNeIns.java | 92 +- .../instructions/jumps/IfStrictEqIns.java | 92 +- .../instructions/jumps/IfStrictNeIns.java | 92 +- .../avm2/instructions/jumps/IfTrueIns.java | 86 +- .../abc/avm2/instructions/jumps/JumpIns.java | 82 +- .../instructions/jumps/LookupSwitchIns.java | 74 +- .../instructions/localregs/DecLocalIIns.java | 114 +- .../instructions/localregs/DecLocalIns.java | 116 +- .../instructions/localregs/GetLocal0Ins.java | 88 +- .../instructions/localregs/GetLocal1Ins.java | 78 +- .../instructions/localregs/GetLocal2Ins.java | 78 +- .../instructions/localregs/GetLocal3Ins.java | 78 +- .../instructions/localregs/GetLocalIns.java | 82 +- .../localregs/GetLocalTypeIns.java | 38 +- .../instructions/localregs/IncLocalIIns.java | 74 +- .../instructions/localregs/IncLocalIns.java | 74 +- .../avm2/instructions/localregs/KillIns.java | 70 +- .../instructions/localregs/SetLocal0Ins.java | 104 +- .../instructions/localregs/SetLocal1Ins.java | 104 +- .../instructions/localregs/SetLocal2Ins.java | 104 +- .../instructions/localregs/SetLocal3Ins.java | 104 +- .../instructions/localregs/SetLocalIns.java | 106 +- .../localregs/SetLocalTypeIns.java | 38 +- .../instructions/other/DeletePropertyIns.java | 108 +- .../instructions/other/FindPropertyIns.java | 98 +- .../other/FindPropertyStrictIns.java | 96 +- .../instructions/other/GetDescendantsIns.java | 100 +- .../instructions/other/GetGlobalScopeIns.java | 80 +- .../instructions/other/GetGlobalSlotIns.java | 110 +- .../avm2/instructions/other/GetLexIns.java | 78 +- .../instructions/other/GetPropertyIns.java | 80 +- .../instructions/other/GetScopeObjectIns.java | 82 +- .../avm2/instructions/other/GetSlotIns.java | 110 +- .../avm2/instructions/other/GetSuperIns.java | 80 +- .../avm2/instructions/other/HasNext2Ins.java | 80 +- .../avm2/instructions/other/HasNextIns.java | 76 +- .../abc/avm2/instructions/other/InIns.java | 74 +- .../instructions/other/InitPropertyIns.java | 84 +- .../abc/avm2/instructions/other/LabelIns.java | 48 +- .../avm2/instructions/other/NextNameIns.java | 74 +- .../avm2/instructions/other/NextValueIns.java | 74 +- .../abc/avm2/instructions/other/NopIns.java | 46 +- .../instructions/other/ReturnValueIns.java | 70 +- .../instructions/other/ReturnVoidIns.java | 70 +- .../instructions/other/SetGlobalSlotIns.java | 82 +- .../instructions/other/SetPropertyIns.java | 100 +- .../avm2/instructions/other/SetSlotIns.java | 144 +- .../avm2/instructions/other/SetSuperIns.java | 100 +- .../abc/avm2/instructions/other/ThrowIns.java | 78 +- .../abc/avm2/instructions/stack/DupIns.java | 90 +- .../abc/avm2/instructions/stack/PopIns.java | 70 +- .../avm2/instructions/stack/PopScopeIns.java | 120 +- .../avm2/instructions/stack/PushByteIns.java | 72 +- .../instructions/stack/PushDoubleIns.java | 72 +- .../avm2/instructions/stack/PushFalseIns.java | 70 +- .../avm2/instructions/stack/PushIntIns.java | 72 +- .../instructions/stack/PushNamespaceIns.java | 80 +- .../avm2/instructions/stack/PushNanIns.java | 70 +- .../avm2/instructions/stack/PushNullIns.java | 70 +- .../avm2/instructions/stack/PushScopeIns.java | 72 +- .../avm2/instructions/stack/PushShortIns.java | 72 +- .../instructions/stack/PushStringIns.java | 72 +- .../avm2/instructions/stack/PushTrueIns.java | 70 +- .../avm2/instructions/stack/PushUIntIns.java | 72 +- .../instructions/stack/PushUndefinedIns.java | 70 +- .../avm2/instructions/stack/PushWithIns.java | 82 +- .../abc/avm2/instructions/stack/SwapIns.java | 86 +- .../avm2/instructions/types/AsTypeIns.java | 100 +- .../instructions/types/AsTypeLateIns.java | 94 +- .../avm2/instructions/types/CoerceAIns.java | 84 +- .../avm2/instructions/types/CoerceIns.java | 88 +- .../avm2/instructions/types/CoerceSIns.java | 86 +- .../avm2/instructions/types/ConvertBIns.java | 104 +- .../avm2/instructions/types/ConvertDIns.java | 120 +- .../avm2/instructions/types/ConvertIIns.java | 116 +- .../avm2/instructions/types/ConvertOIns.java | 82 +- .../avm2/instructions/types/ConvertSIns.java | 84 +- .../avm2/instructions/types/ConvertUIns.java | 82 +- .../instructions/types/InstanceOfIns.java | 74 +- .../avm2/instructions/types/IsTypeIns.java | 78 +- .../instructions/types/IsTypeLateIns.java | 74 +- .../avm2/instructions/types/TypeOfIns.java | 70 +- .../avm2/instructions/xml/CheckFilterIns.java | 84 +- .../abc/avm2/instructions/xml/DXNSIns.java | 70 +- .../avm2/instructions/xml/DXNSLateIns.java | 86 +- .../avm2/instructions/xml/EscXAttrIns.java | 86 +- .../avm2/instructions/xml/EscXElemIns.java | 86 +- .../asdec/abc/avm2/parser/ASM3Parser.java | 900 ++--- .../asdec/abc/avm2/parser/Flasm3Lexer.java | 20 +- .../abc/avm2/parser/MissingSymbolHandler.java | 48 +- .../asdec/abc/avm2/parser/ParseException.java | 48 +- .../asdec/abc/avm2/parser/ParsedSymbol.java | 76 +- .../abc/avm2/treemodel/BooleanTreeItem.java | 86 +- .../abc/avm2/treemodel/BreakTreeItem.java | 74 +- .../avm2/treemodel/CallMethodTreeItem.java | 90 +- .../avm2/treemodel/CallPropertyTreeItem.java | 94 +- .../avm2/treemodel/CallStaticTreeItem.java | 90 +- .../abc/avm2/treemodel/CallSuperTreeItem.java | 100 +- .../abc/avm2/treemodel/CallTreeItem.java | 90 +- .../abc/avm2/treemodel/ClassTreeItem.java | 62 +- .../abc/avm2/treemodel/CoerceTreeItem.java | 68 +- .../avm2/treemodel/ConstructPropTreeItem.java | 96 +- .../treemodel/ConstructSuperTreeItem.java | 94 +- .../abc/avm2/treemodel/ConstructTreeItem.java | 94 +- .../abc/avm2/treemodel/ContinueTreeItem.java | 74 +- .../abc/avm2/treemodel/ConvertTreeItem.java | 68 +- .../abc/avm2/treemodel/DecLocalTreeItem.java | 66 +- .../abc/avm2/treemodel/DecrementTreeItem.java | 64 +- .../abc/avm2/treemodel/EachTreeItem.java | 68 +- .../avm2/treemodel/FindPropertyTreeItem.java | 64 +- .../avm2/treemodel/FloatValueTreeItem.java | 64 +- .../avm2/treemodel/FullMultinameTreeItem.java | 146 +- .../treemodel/GetDescendantsTreeItem.java | 68 +- .../abc/avm2/treemodel/GetLexTreeItem.java | 66 +- .../avm2/treemodel/GetPropertyTreeItem.java | 68 +- .../abc/avm2/treemodel/GetSlotTreeItem.java | 70 +- .../abc/avm2/treemodel/GetSuperTreeItem.java | 74 +- .../abc/avm2/treemodel/IncLocalTreeItem.java | 66 +- .../abc/avm2/treemodel/IncrementTreeItem.java | 64 +- .../avm2/treemodel/InitPropertyTreeItem.java | 72 +- .../avm2/treemodel/IntegerValueTreeItem.java | 64 +- .../abc/avm2/treemodel/LocalRegTreeItem.java | 96 +- .../abc/avm2/treemodel/NameSpaceTreeItem.java | 60 +- .../abc/avm2/treemodel/NameValuePair.java | 72 +- .../asdec/abc/avm2/treemodel/NanTreeItem.java | 60 +- .../avm2/treemodel/NewActivationTreeItem.java | 60 +- .../abc/avm2/treemodel/NewArrayTreeItem.java | 82 +- .../avm2/treemodel/NewFunctionTreeItem.java | 72 +- .../abc/avm2/treemodel/NewObjectTreeItem.java | 78 +- .../abc/avm2/treemodel/NullTreeItem.java | 60 +- .../avm2/treemodel/NumberValueTreeItem.java | 46 +- .../avm2/treemodel/PostDecrementTreeItem.java | 64 +- .../avm2/treemodel/PostIncrementTreeItem.java | 64 +- .../avm2/treemodel/ReturnValueTreeItem.java | 64 +- .../avm2/treemodel/ReturnVoidTreeItem.java | 60 +- .../avm2/treemodel/SetGlobalSlotTreeItem.java | 68 +- .../abc/avm2/treemodel/SetLocalTreeItem.java | 70 +- .../avm2/treemodel/SetPropertyTreeItem.java | 72 +- .../abc/avm2/treemodel/SetSlotTreeItem.java | 96 +- .../abc/avm2/treemodel/SetSuperTreeItem.java | 78 +- .../abc/avm2/treemodel/StringTreeItem.java | 66 +- .../abc/avm2/treemodel/ThisTreeItem.java | 58 +- .../abc/avm2/treemodel/ThrowTreeItem.java | 64 +- .../asdec/abc/avm2/treemodel/TreeItem.java | 174 +- .../abc/avm2/treemodel/UndefinedTreeItem.java | 62 +- .../abc/avm2/treemodel/UnparsedTreeItem.java | 64 +- .../abc/avm2/treemodel/WithTreeItem.java | 98 +- .../abc/avm2/treemodel/clauses/Block.java | 42 +- .../treemodel/clauses/DoWhileTreeItem.java | 120 +- .../treemodel/clauses/ExceptionTreeItem.java | 66 +- .../treemodel/clauses/ForEachTreeItem.java | 120 +- .../avm2/treemodel/clauses/ForTreeItem.java | 172 +- .../avm2/treemodel/clauses/IfTreeItem.java | 150 +- .../avm2/treemodel/clauses/LoopTreeItem.java | 54 +- .../treemodel/clauses/SwitchTreeItem.java | 178 +- .../treemodel/clauses/TernarOpTreeItem.java | 74 +- .../avm2/treemodel/clauses/TryTreeItem.java | 192 +- .../avm2/treemodel/clauses/WhileTreeItem.java | 118 +- .../treemodel/operations/AddTreeItem.java | 48 +- .../treemodel/operations/AndTreeItem.java | 48 +- .../treemodel/operations/AsTypeTreeItem.java | 50 +- .../operations/BinaryOpTreeItem.java | 100 +- .../treemodel/operations/BitAndTreeItem.java | 48 +- .../treemodel/operations/BitNotTreeItem.java | 46 +- .../treemodel/operations/BitOrTreeItem.java | 48 +- .../treemodel/operations/BitXorTreeItem.java | 48 +- .../operations/DeletePropertyTreeItem.java | 72 +- .../treemodel/operations/DivideTreeItem.java | 48 +- .../avm2/treemodel/operations/EqTreeItem.java | 48 +- .../avm2/treemodel/operations/GeTreeItem.java | 48 +- .../avm2/treemodel/operations/GtTreeItem.java | 48 +- .../avm2/treemodel/operations/InTreeItem.java | 50 +- .../operations/InstanceOfTreeItem.java | 48 +- .../treemodel/operations/IsTypeTreeItem.java | 48 +- .../treemodel/operations/LShiftTreeItem.java | 48 +- .../avm2/treemodel/operations/LeTreeItem.java | 48 +- .../avm2/treemodel/operations/LtTreeItem.java | 48 +- .../treemodel/operations/ModuloTreeItem.java | 48 +- .../operations/MultiplyTreeItem.java | 48 +- .../treemodel/operations/NegTreeItem.java | 46 +- .../treemodel/operations/NeqTreeItem.java | 48 +- .../treemodel/operations/NotTreeItem.java | 70 +- .../avm2/treemodel/operations/OrTreeItem.java | 48 +- .../operations/PreDecrementTreeItem.java | 44 +- .../operations/PreIncrementTreeItem.java | 50 +- .../treemodel/operations/RShiftTreeItem.java | 48 +- .../operations/StrictEqTreeItem.java | 48 +- .../operations/StrictNeqTreeItem.java | 48 +- .../operations/SubtractTreeItem.java | 48 +- .../treemodel/operations/TypeOfTreeItem.java | 46 +- .../treemodel/operations/URShiftTreeItem.java | 48 +- .../treemodel/operations/UnaryOpTreeItem.java | 70 +- .../jpexs/asdec/abc/gui/ABCComboBoxModel.java | 108 +- .../asdec/abc/gui/ASMSourceEditorPane.java | 252 +- .../jpexs/asdec/abc/gui/ClassesListTree.java | 126 +- .../asdec/abc/gui/ClassesListTreeModel.java | 242 +- .../asdec/abc/gui/ConstantsListModel.java | 184 +- .../asdec/abc/gui/DecompiledEditorPane.java | 322 +- .../abc/gui/DialogMissingSymbolHandler.java | 74 +- .../jpexs/asdec/abc/gui/IconListRenderer.java | 132 +- .../com/jpexs/asdec/abc/gui/MainFrame.java | 774 ++-- .../com/jpexs/asdec/abc/gui/TraitsList.java | 104 +- .../jpexs/asdec/abc/gui/TraitsListModel.java | 118 +- .../src/com/jpexs/asdec/abc/gui/TreePart.java | 126 +- .../abc/gui/tablemodels/DoubleTableModel.java | 20 +- .../abc/gui/tablemodels/IntTableModel.java | 20 +- .../gui/tablemodels/MultinameTableModel.java | 20 +- .../tablemodels/NamespaceSetTableModel.java | 20 +- .../gui/tablemodels/NamespaceTableModel.java | 20 +- .../abc/gui/tablemodels/StringTableModel.java | 20 +- .../abc/gui/tablemodels/UIntTableModel.java | 18 + .../jpexs/asdec/abc/types/ABCException.java | 116 +- .../com/jpexs/asdec/abc/types/ClassInfo.java | 72 +- .../jpexs/asdec/abc/types/InstanceInfo.java | 154 +- .../jpexs/asdec/abc/types/MetadataInfo.java | 96 +- .../com/jpexs/asdec/abc/types/MethodBody.java | 178 +- .../com/jpexs/asdec/abc/types/MethodInfo.java | 330 +- .../com/jpexs/asdec/abc/types/Multiname.java | 304 +- .../com/jpexs/asdec/abc/types/Namespace.java | 144 +- .../jpexs/asdec/abc/types/NamespaceSet.java | 62 +- .../com/jpexs/asdec/abc/types/ScriptInfo.java | 68 +- .../com/jpexs/asdec/abc/types/ValueKind.java | 220 +- .../jpexs/asdec/abc/types/traits/Trait.java | 176 +- .../asdec/abc/types/traits/TraitClass.java | 54 +- .../asdec/abc/types/traits/TraitFunction.java | 54 +- .../types/traits/TraitMethodGetterSetter.java | 90 +- .../abc/types/traits/TraitSlotConst.java | 136 +- .../jpexs/asdec/abc/types/traits/Traits.java | 100 +- trunk/src/com/jpexs/asdec/action/Action.java | 18 + .../asdec/action/UnknownJumpException.java | 120 +- .../com/jpexs/asdec/action/gui/MainFrame.java | 18 + .../jpexs/asdec/action/gui/TagTreeItem.java | 18 + .../jpexs/asdec/action/gui/TagTreeModel.java | 18 + .../jpexs/asdec/action/parser/ASMParser.java | 18 + .../jpexs/asdec/action/parser/FlasmLexer.java | 20 +- .../com/jpexs/asdec/action/parser/Label.java | 18 + .../asdec/action/parser/ParseException.java | 48 +- .../asdec/action/parser/ParsedSymbol.java | 92 +- .../jpexs/asdec/action/swf3/ActionGetURL.java | 18 + .../asdec/action/swf3/ActionGoToLabel.java | 18 + .../asdec/action/swf3/ActionGotoFrame.java | 18 + .../asdec/action/swf3/ActionNextFrame.java | 18 + .../jpexs/asdec/action/swf3/ActionPlay.java | 18 + .../asdec/action/swf3/ActionPrevFrame.java | 20 +- .../asdec/action/swf3/ActionSetTarget.java | 18 + .../jpexs/asdec/action/swf3/ActionStop.java | 18 + .../asdec/action/swf3/ActionStopSounds.java | 18 + .../action/swf3/ActionToggleQuality.java | 18 + .../asdec/action/swf3/ActionWaitForFrame.java | 18 + .../jpexs/asdec/action/swf4/ActionAdd.java | 18 + .../jpexs/asdec/action/swf4/ActionAnd.java | 18 + .../asdec/action/swf4/ActionAsciiToChar.java | 18 + .../jpexs/asdec/action/swf4/ActionCall.java | 18 + .../asdec/action/swf4/ActionCharToAscii.java | 18 + .../asdec/action/swf4/ActionCloneSprite.java | 18 + .../jpexs/asdec/action/swf4/ActionDivide.java | 18 + .../asdec/action/swf4/ActionEndDrag.java | 20 +- .../jpexs/asdec/action/swf4/ActionEquals.java | 18 + .../asdec/action/swf4/ActionGetProperty.java | 20 +- .../asdec/action/swf4/ActionGetTime.java | 20 +- .../asdec/action/swf4/ActionGetURL2.java | 18 + .../asdec/action/swf4/ActionGetVariable.java | 18 + .../asdec/action/swf4/ActionGotoFrame2.java | 18 + .../com/jpexs/asdec/action/swf4/ActionIf.java | 20 +- .../jpexs/asdec/action/swf4/ActionJump.java | 18 + .../jpexs/asdec/action/swf4/ActionLess.java | 18 + .../action/swf4/ActionMBAsciiToChar.java | 20 +- .../action/swf4/ActionMBCharToAscii.java | 20 +- .../action/swf4/ActionMBStringExtract.java | 18 + .../action/swf4/ActionMBStringLength.java | 18 + .../asdec/action/swf4/ActionMultiply.java | 18 + .../jpexs/asdec/action/swf4/ActionNot.java | 18 + .../com/jpexs/asdec/action/swf4/ActionOr.java | 18 + .../jpexs/asdec/action/swf4/ActionPop.java | 18 + .../jpexs/asdec/action/swf4/ActionPush.java | 18 + .../asdec/action/swf4/ActionRandomNumber.java | 20 +- .../asdec/action/swf4/ActionRemoveSprite.java | 20 +- .../asdec/action/swf4/ActionSetProperty.java | 20 +- .../asdec/action/swf4/ActionSetTarget2.java | 18 + .../asdec/action/swf4/ActionSetVariable.java | 20 +- .../asdec/action/swf4/ActionStartDrag.java | 20 +- .../asdec/action/swf4/ActionStringAdd.java | 18 + .../asdec/action/swf4/ActionStringEquals.java | 18 + .../action/swf4/ActionStringExtract.java | 18 + .../asdec/action/swf4/ActionStringLength.java | 18 + .../asdec/action/swf4/ActionStringLess.java | 18 + .../asdec/action/swf4/ActionSubtract.java | 18 + .../asdec/action/swf4/ActionToInteger.java | 18 + .../jpexs/asdec/action/swf4/ActionTrace.java | 20 +- .../action/swf4/ActionWaitForFrame2.java | 20 +- .../asdec/action/swf4/ConstantIndex.java | 18 + .../src/com/jpexs/asdec/action/swf4/Null.java | 18 + .../asdec/action/swf4/RegisterNumber.java | 18 + .../jpexs/asdec/action/swf4/Undefined.java | 18 + .../jpexs/asdec/action/swf5/ActionAdd2.java | 20 +- .../jpexs/asdec/action/swf5/ActionBitAnd.java | 20 +- .../asdec/action/swf5/ActionBitLShift.java | 20 +- .../jpexs/asdec/action/swf5/ActionBitOr.java | 20 +- .../asdec/action/swf5/ActionBitRShift.java | 20 +- .../asdec/action/swf5/ActionBitURShift.java | 20 +- .../jpexs/asdec/action/swf5/ActionBitXor.java | 20 +- .../asdec/action/swf5/ActionCallFunction.java | 20 +- .../asdec/action/swf5/ActionCallMethod.java | 20 +- .../asdec/action/swf5/ActionConstantPool.java | 20 +- .../asdec/action/swf5/ActionDecrement.java | 20 +- .../action/swf5/ActionDefineFunction.java | 20 +- .../asdec/action/swf5/ActionDefineLocal.java | 20 +- .../asdec/action/swf5/ActionDefineLocal2.java | 20 +- .../jpexs/asdec/action/swf5/ActionDelete.java | 20 +- .../asdec/action/swf5/ActionDelete2.java | 20 +- .../asdec/action/swf5/ActionEnumerate.java | 20 +- .../asdec/action/swf5/ActionEquals2.java | 20 +- .../asdec/action/swf5/ActionGetMember.java | 20 +- .../asdec/action/swf5/ActionIncrement.java | 20 +- .../asdec/action/swf5/ActionInitArray.java | 20 +- .../asdec/action/swf5/ActionInitObject.java | 20 +- .../jpexs/asdec/action/swf5/ActionLess2.java | 20 +- .../jpexs/asdec/action/swf5/ActionModulo.java | 20 +- .../asdec/action/swf5/ActionNewMethod.java | 20 +- .../asdec/action/swf5/ActionNewObject.java | 20 +- .../action/swf5/ActionPushDuplicate.java | 20 +- .../jpexs/asdec/action/swf5/ActionReturn.java | 20 +- .../asdec/action/swf5/ActionSetMember.java | 20 +- .../asdec/action/swf5/ActionStackSwap.java | 20 +- .../action/swf5/ActionStoreRegister.java | 20 +- .../asdec/action/swf5/ActionTargetPath.java | 20 +- .../asdec/action/swf5/ActionToNumber.java | 20 +- .../asdec/action/swf5/ActionToString.java | 20 +- .../jpexs/asdec/action/swf5/ActionTypeOf.java | 20 +- .../jpexs/asdec/action/swf5/ActionWith.java | 20 +- .../asdec/action/swf6/ActionEnumerate2.java | 20 +- .../asdec/action/swf6/ActionGreater.java | 20 +- .../asdec/action/swf6/ActionInstanceOf.java | 20 +- .../asdec/action/swf6/ActionStrictEquals.java | 20 +- .../action/swf6/ActionStringGreater.java | 20 +- .../jpexs/asdec/action/swf7/ActionCastOp.java | 20 +- .../action/swf7/ActionDefineFunction2.java | 20 +- .../asdec/action/swf7/ActionExtends.java | 20 +- .../asdec/action/swf7/ActionImplementsOp.java | 20 +- .../jpexs/asdec/action/swf7/ActionThrow.java | 20 +- .../jpexs/asdec/action/swf7/ActionTry.java | 18 + .../action/treemodel/AsciiToCharTreeItem.java | 20 +- .../asdec/action/treemodel/BreakTreeItem.java | 72 +- .../treemodel/CallFunctionTreeItem.java | 18 + .../action/treemodel/CallMethodTreeItem.java | 20 +- .../asdec/action/treemodel/CallTreeItem.java | 20 +- .../action/treemodel/CastOpTreeItem.java | 18 + .../action/treemodel/CharToAsciiTreeItem.java | 20 +- .../action/treemodel/CloneSpriteTreeItem.java | 18 + .../asdec/action/treemodel/ConstantPool.java | 18 + .../action/treemodel/ContinueTreeItem.java | 74 +- .../action/treemodel/DecrementTreeItem.java | 20 +- .../action/treemodel/DefineLocalTreeItem.java | 18 + .../action/treemodel/DeleteTreeItem.java | 18 + .../action/treemodel/DirectValueTreeItem.java | 18 + .../asdec/action/treemodel/EachTreeItem.java | 66 +- .../action/treemodel/EnumerateTreeItem.java | 18 + .../action/treemodel/ExtendsTreeItem.java | 18 + .../action/treemodel/FunctionTreeItem.java | 18 + .../action/treemodel/GetMemberTreeItem.java | 18 + .../action/treemodel/GetPropertyTreeItem.java | 18 + .../action/treemodel/GetURL2TreeItem.java | 20 +- .../action/treemodel/GetURLTreeItem.java | 18 + .../action/treemodel/GetVariableTreeItem.java | 18 + .../action/treemodel/GotoFrame2TreeItem.java | 20 +- .../action/treemodel/GotoFrameTreeItem.java | 18 + .../action/treemodel/GotoLabelTreeItem.java | 20 +- .../treemodel/ImplementsOpTreeItem.java | 20 +- .../action/treemodel/IncrementTreeItem.java | 18 + .../action/treemodel/InitArrayTreeItem.java | 18 + .../action/treemodel/InitObjectTreeItem.java | 20 +- .../treemodel/MBAsciiToCharTreeItem.java | 20 +- .../treemodel/MBCharToAsciiTreeItem.java | 20 +- .../treemodel/MBStringExtractTreeItem.java | 20 +- .../action/treemodel/NewMethodTreeItem.java | 20 +- .../action/treemodel/NewObjectTreeItem.java | 20 +- .../treemodel/RandomNumberTreeItem.java | 20 +- .../treemodel/RemoveSpriteTreeItem.java | 20 +- .../action/treemodel/ReturnTreeItem.java | 18 + .../action/treemodel/SetMemberTreeItem.java | 20 +- .../action/treemodel/SetPropertyTreeItem.java | 20 +- .../action/treemodel/SetTarget2TreeItem.java | 20 +- .../action/treemodel/SetTargetTreeItem.java | 20 +- .../action/treemodel/SetVariableTreeItem.java | 20 +- .../treemodel/SimpleActionTreeItem.java | 18 + .../action/treemodel/StartDragTreeItem.java | 18 + .../treemodel/StoreRegisterTreeItem.java | 18 + .../treemodel/StringExtractTreeItem.java | 20 +- .../action/treemodel/TargetPathTreeItem.java | 18 + .../asdec/action/treemodel/ThrowTreeItem.java | 18 + .../action/treemodel/ToIntegerTreeItem.java | 18 + .../action/treemodel/ToNumberTreeItem.java | 20 +- .../action/treemodel/ToStringTreeItem.java | 20 +- .../asdec/action/treemodel/TraceTreeItem.java | 20 +- .../asdec/action/treemodel/TreeItem.java | 180 +- .../action/treemodel/TypeOfTreeItem.java | 20 +- .../action/treemodel/UnsupportedTreeItem.java | 18 + .../asdec/action/treemodel/VoidTreeItem.java | 18 + .../treemodel/WaitForFrame2TreeItem.java | 20 +- .../treemodel/WaitForFrameTreeItem.java | 20 +- .../asdec/action/treemodel/clauses/Block.java | 42 +- .../treemodel/clauses/DoWhileTreeItem.java | 120 +- .../treemodel/clauses/ForEachTreeItem.java | 120 +- .../treemodel/clauses/ForInTreeItem.java | 124 +- .../action/treemodel/clauses/ForTreeItem.java | 172 +- .../action/treemodel/clauses/IfTreeItem.java | 150 +- .../treemodel/clauses/LoopTreeItem.java | 54 +- .../treemodel/clauses/SwitchTreeItem.java | 182 +- .../treemodel/clauses/TernarOpTreeItem.java | 74 +- .../action/treemodel/clauses/TryTreeItem.java | 190 +- .../treemodel/clauses/WhileTreeItem.java | 118 +- .../treemodel/clauses/WithTreeItem.java | 102 +- .../treemodel/operations/AddTreeItem.java | 48 +- .../treemodel/operations/AndTreeItem.java | 48 +- .../treemodel/operations/AsTypeTreeItem.java | 50 +- .../operations/BinaryOpTreeItem.java | 100 +- .../treemodel/operations/BitAndTreeItem.java | 48 +- .../treemodel/operations/BitNotTreeItem.java | 46 +- .../treemodel/operations/BitOrTreeItem.java | 48 +- .../treemodel/operations/BitXorTreeItem.java | 48 +- .../treemodel/operations/DivideTreeItem.java | 48 +- .../treemodel/operations/EqTreeItem.java | 48 +- .../treemodel/operations/GeTreeItem.java | 48 +- .../treemodel/operations/GtTreeItem.java | 48 +- .../treemodel/operations/InTreeItem.java | 50 +- .../operations/InstanceOfTreeItem.java | 48 +- .../treemodel/operations/IsTypeTreeItem.java | 48 +- .../treemodel/operations/LShiftTreeItem.java | 48 +- .../treemodel/operations/LeTreeItem.java | 48 +- .../treemodel/operations/LtTreeItem.java | 48 +- .../operations/MBStringLengthTreeItem.java | 66 +- .../treemodel/operations/ModuloTreeItem.java | 48 +- .../operations/MultiplyTreeItem.java | 48 +- .../treemodel/operations/NegTreeItem.java | 46 +- .../treemodel/operations/NeqTreeItem.java | 48 +- .../treemodel/operations/NotTreeItem.java | 70 +- .../treemodel/operations/OrTreeItem.java | 48 +- .../operations/PreDecrementTreeItem.java | 44 +- .../operations/PreIncrementTreeItem.java | 50 +- .../treemodel/operations/RShiftTreeItem.java | 48 +- .../operations/StrictEqTreeItem.java | 48 +- .../operations/StrictNeqTreeItem.java | 48 +- .../operations/StringAddTreeItem.java | 48 +- .../operations/StringEqTreeItem.java | 48 +- .../operations/StringLengthTreeItem.java | 66 +- .../operations/StringLtTreeItem.java | 48 +- .../operations/SubtractTreeItem.java | 48 +- .../treemodel/operations/URShiftTreeItem.java | 48 +- .../treemodel/operations/UnaryOpTreeItem.java | 70 +- .../com/jpexs/asdec/gui/LoadingDialog.java | 18 + .../src/com/jpexs/asdec/gui/LoadingPanel.java | 20 +- trunk/src/com/jpexs/asdec/gui/ModeFrame.java | 18 + trunk/src/com/jpexs/asdec/gui/View.java | 18 + .../com/jpexs/asdec/gui/proxy/ProxyFrame.java | 18 + .../jpexs/asdec/gui/proxy/SWFListModel.java | 18 + trunk/src/com/jpexs/asdec/helpers/Helper.java | 238 +- .../com/jpexs/asdec/helpers/Highlighting.java | 386 +- trunk/src/com/jpexs/asdec/tags/ASMSource.java | 18 + trunk/src/com/jpexs/asdec/tags/Container.java | 18 + .../jpexs/asdec/tags/DefineButton2Tag.java | 18 + .../com/jpexs/asdec/tags/DefineButtonTag.java | 20 +- .../com/jpexs/asdec/tags/DefineSpriteTag.java | 18 + trunk/src/com/jpexs/asdec/tags/DoABCTag.java | 18 + .../src/com/jpexs/asdec/tags/DoActionTag.java | 20 +- .../com/jpexs/asdec/tags/DoInitActionTag.java | 20 +- .../com/jpexs/asdec/tags/ExportAssetsTag.java | 18 + .../com/jpexs/asdec/tags/PlaceObject2Tag.java | 18 + .../com/jpexs/asdec/tags/PlaceObject3Tag.java | 20 +- .../com/jpexs/asdec/tags/ShowFrameTag.java | 18 + trunk/src/com/jpexs/asdec/tags/Tag.java | 148 +- trunk/src/com/jpexs/asdec/types/ARGB.java | 20 +- .../jpexs/asdec/types/BUTTONCONDACTION.java | 18 + .../com/jpexs/asdec/types/BUTTONRECORD.java | 18 + .../jpexs/asdec/types/CLIPACTIONRECORD.java | 18 + .../com/jpexs/asdec/types/CLIPACTIONS.java | 18 + .../com/jpexs/asdec/types/CLIPEVENTFLAGS.java | 18 + .../jpexs/asdec/types/CXFORMWITHALPHA.java | 18 + trunk/src/com/jpexs/asdec/types/MATRIX.java | 18 + trunk/src/com/jpexs/asdec/types/RECT.java | 18 + trunk/src/com/jpexs/asdec/types/RGBA.java | 18 + .../asdec/types/filters/BEVELFILTER.java | 18 + .../jpexs/asdec/types/filters/BLURFILTER.java | 18 + .../types/filters/COLORMATRIXFILTER.java | 18 + .../types/filters/CONVOLUTIONFILTER.java | 18 + .../asdec/types/filters/DROPSHADOWFILTER.java | 18 + .../com/jpexs/asdec/types/filters/FILTER.java | 18 + .../jpexs/asdec/types/filters/GLOWFILTER.java | 18 + .../types/filters/GRADIENTBEVELFILTER.java | 20 +- .../types/filters/GRADIENTGLOWFILTER.java | 20 +- 568 files changed, 25967 insertions(+), 17089 deletions(-) create mode 100644 trunk/src/com/jpexs/asdec/abc/Usage.java diff --git a/trunk/src/com/jpexs/asdec/Main.java b/trunk/src/com/jpexs/asdec/Main.java index 707f52ae7..76e2505d1 100644 --- a/trunk/src/com/jpexs/asdec/Main.java +++ b/trunk/src/com/jpexs/asdec/Main.java @@ -1,378 +1,450 @@ -package com.jpexs.asdec; - -import com.jpexs.asdec.abc.NotSameException; -import com.jpexs.asdec.gui.LoadingDialog; -import com.jpexs.asdec.gui.ModeFrame; -import com.jpexs.asdec.gui.View; -import com.jpexs.asdec.gui.proxy.ProxyFrame; -import com.jpexs.asdec.tags.DoABCTag; -import com.jpexs.asdec.tags.Tag; -import com.jpexs.proxy.Replacement; - -import javax.swing.*; -import javax.swing.filechooser.FileFilter; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.io.*; -import java.util.ArrayList; -import java.util.List; - - -/** - * Main executable class - * - * @author JPEXS - */ -public class Main { - - public static com.jpexs.asdec.abc.gui.MainFrame abcMainFrame; - public static com.jpexs.asdec.action.gui.MainFrame actionMainFrame; - public static ProxyFrame proxyFrame; - public static String file; - public static String maskURL; - public static SWF swf; - public static final String version = "alpha7"; - public static String applicationName = "JP ActionScript Decompiler v." + version; - public static LoadingDialog loadingDialog = new LoadingDialog(); - public static ModeFrame modeFrame; - private static boolean working = false; - private static TrayIcon trayIcon; - private static MenuItem stopMenuItem; - public static boolean DEBUG_COPY = false; - public static boolean DEBUG_MODE = false; - public static boolean DISABLE_DANGEROUS = false; - - public static String getFileTitle() { - if (maskURL != null) return maskURL; - return file; - } - - /** - * List of replacements - */ - public static java.util.List replacements = new ArrayList(); - - - private static String getASDecHome() { - String dir = ".";//System.getProperty("user.home"); - if (!dir.endsWith(File.separator)) dir += File.separator; - dir += "config" + File.separator; - return dir; - } - - private static String getReplacementsFile() { - return getASDecHome() + "replacements.ini"; - } - - /** - * Saves replacements to file for future use - */ - public static void saveReplacements() { - try { - File f = new File(getASDecHome()); - if (!f.exists()) f.mkdir(); - PrintWriter pw = new PrintWriter(new FileWriter(getReplacementsFile())); - for (Replacement r : replacements) { - pw.println(r.urlPattern); - pw.println(r.targetFile); - } - pw.close(); - } catch (IOException e) { - - } - } - - /** - * Load replacements from file - */ - public static void loadReplacements() { - replacements = new ArrayList(); - try { - BufferedReader br = new BufferedReader(new FileReader(getReplacementsFile())); - String s = ""; - while ((s = br.readLine()) != null) { - Replacement r = new Replacement(s, br.readLine()); - replacements.add(r); - } - br.close(); - } catch (IOException e) { - - } - } - - public static boolean isWorking() { - return working; - } - - public static void showProxy() { - if (proxyFrame == null) proxyFrame = new ProxyFrame(); - proxyFrame.setVisible(true); - proxyFrame.setState(Frame.NORMAL); - } - - public static void startWork(String name) { - working = true; - if(abcMainFrame!=null) - abcMainFrame.setStatus(name); - if(actionMainFrame!=null) - actionMainFrame.setStatus(name); - } - - public static void stopWork() { - working = false; - if(abcMainFrame!=null) - abcMainFrame.setStatus(""); - if(actionMainFrame!=null) - actionMainFrame.setStatus(""); - } - - public static SWF parseSWF(String file) throws Exception { - FileInputStream fis = new FileInputStream(file); - SWF locswf = new SWF(fis); - return locswf; - } - - - public static void saveFile(String outfile) throws IOException { - file = outfile; - swf.saveTo(new FileOutputStream(outfile)); - } - - - private static class OpenFileWorker extends SwingWorker { - @Override - protected Object doInBackground() throws Exception { - try { - swf = parseSWF(Main.file); - FileInputStream fis = new FileInputStream(file); - DEBUG_COPY = true; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try { - swf.saveTo(baos); - } catch (NotSameException nse) { - if (DEBUG_MODE) { - nse.printStackTrace(); - System.exit(0); - } - JOptionPane.showMessageDialog(null, "WARNING: The SWF decompiler may have problems saving this file. Recommended usage is READ ONLY."); - } - DEBUG_COPY = false; - //DEBUG_COPY=true; - } catch (Exception ex) { - ex.printStackTrace(); - JOptionPane.showMessageDialog(null, "Cannot load SWF file."); - loadingDialog.setVisible(false); - return false; - } - List listAbc = new ArrayList(); - for (Tag t : swf.tags) { - if (t instanceof DoABCTag) listAbc.add(t); - } - - - if (false) { - JOptionPane.showMessageDialog(null, "This SWF file does not contain any ActionScript parts"); - loadingDialog.setVisible(false); - if (!openFileDialog()) { - System.exit(0); - } - } else { - if (listAbc.size() > 0) { - List listAbc2 = new ArrayList(); - for (Tag tag : listAbc) { - listAbc2.add((DoABCTag) tag); - } - abcMainFrame = new com.jpexs.asdec.abc.gui.MainFrame(listAbc2); - abcMainFrame.display(); - } else { - actionMainFrame = new com.jpexs.asdec.action.gui.MainFrame(swf.tags); - actionMainFrame.display(); - } - } - loadingDialog.setVisible(false); - return true; - } - } - - public static boolean openFile(String swfFile) { - if (abcMainFrame != null) - abcMainFrame.setVisible(false); - if (actionMainFrame != null) - actionMainFrame.setVisible(false); - Main.file = swfFile; - Main.loadingDialog.setVisible(true); - (new OpenFileWorker()).execute(); - return true; - } - - - public static boolean saveFileDialog(Frame f) { - JFileChooser fc = new JFileChooser(); - int returnVal = fc.showSaveDialog(f); - if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - try { - Main.saveFile(file.getAbsolutePath()); - maskURL = null; - return true; - } catch (IOException ex) { - JOptionPane.showMessageDialog(null, "Cannot write to the file"); - } - } - return false; - } - - public static boolean openFileDialog() { - maskURL = null; - JFileChooser fc = new JFileChooser(); - fc.setFileFilter(new FileFilter() { - - @Override - public boolean accept(File f) { - return (f.getName().endsWith(".swf")) || (f.isDirectory()); - } - - @Override - public String getDescription() { - return "SWF files (*.swf)"; - } - - }); - int returnVal = fc.showOpenDialog(null); - if (returnVal == JFileChooser.APPROVE_OPTION) { - File selfile = fc.getSelectedFile(); - Main.openFile(selfile.getAbsolutePath()); - return true; - } else { - return false; - } - } - - - public static void showModeFrame() { - if (modeFrame == null) modeFrame = new ModeFrame(); - modeFrame.setVisible(true); - } - - /** - * @param args the command line arguments - */ - public static void main(String[] args) throws IOException { - View.setWinLookAndFeel(); - loadReplacements(); - if (args.length < 1) { - showModeFrame(); - } else { - if (args[0].equals("-proxy")) { - int port = 55555; - for (int i = 0; i < args.length; i++) { - if (args[i].startsWith("-P")) { - try { - port = Integer.parseInt(args[i].substring(2)); - } catch (NumberFormatException nex) { - System.err.println("Bad port number"); - } - } - } - if (proxyFrame == null) proxyFrame = new ProxyFrame(); - proxyFrame.setPort(port); - addTrayIcon(); - switchProxy(); - } else { - openFile(args[0]); - } - } - } - - - public static String tempFile(String url) { - File f = new File(getASDecHome() + "saved" + File.separator); - if (!f.exists()) f.mkdirs(); - return getASDecHome() + "saved" + File.separator + "asdec_" + Integer.toHexString(url.hashCode()) + ".tmp"; - - } - - public static void removeTrayIcon() { - if (SystemTray.isSupported()) { - SystemTray tray = SystemTray.getSystemTray(); - if (trayIcon != null) { - tray.remove(trayIcon); - trayIcon = null; - } - } - } - - public static void switchProxy() { - proxyFrame.switchState(); - if (stopMenuItem != null) { - if (proxyFrame.isRunning()) { - stopMenuItem.setLabel("Stop proxy"); - } else { - stopMenuItem.setLabel("Start proxy"); - } - } - } - - public static void addTrayIcon() { - if (trayIcon != null) return; - if (SystemTray.isSupported()) { - SystemTray tray = SystemTray.getSystemTray(); - trayIcon = new TrayIcon(View.loadImage("com/jpexs/asdec/gui/graphics/proxy16.png"), "JP ASDec Proxy"); - trayIcon.setImageAutoSize(true); - PopupMenu trayPopup = new PopupMenu(); - - - ActionListener trayListener = new ActionListener() { - /** - * Invoked when an action occurs. - */ - public void actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals("EXIT")) Main.exit(); - if (e.getActionCommand().equals("SHOW")) Main.showProxy(); - if (e.getActionCommand().equals("SWITCH")) Main.switchProxy(); - } - }; - - - MenuItem showMenuItem = new MenuItem("Show proxy"); - showMenuItem.setActionCommand("SHOW"); - showMenuItem.addActionListener(trayListener); - trayPopup.add(showMenuItem); - stopMenuItem = new MenuItem("Start proxy"); - stopMenuItem.setActionCommand("SWITCH"); - stopMenuItem.addActionListener(trayListener); - trayPopup.add(stopMenuItem); - trayPopup.addSeparator(); - MenuItem exitMenuItem = new MenuItem("Exit"); - exitMenuItem.setActionCommand("EXIT"); - exitMenuItem.addActionListener(trayListener); - trayPopup.add(exitMenuItem); - - trayIcon.setPopupMenu(trayPopup); - trayIcon.addMouseListener(new MouseAdapter() { - /** - * {@inheritDoc} - */ - @Override - public void mouseClicked(MouseEvent e) { - if (e.getButton() == MouseEvent.BUTTON1) { - Main.showProxy(); - } - } - }); - try { - tray.add(trayIcon); - } catch (AWTException ex) { - - } - } - } - - public static void exit() { - saveReplacements(); - System.exit(0); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec; + +import com.jpexs.asdec.abc.NotSameException; +import com.jpexs.asdec.gui.LoadingDialog; +import com.jpexs.asdec.gui.ModeFrame; +import com.jpexs.asdec.gui.View; +import com.jpexs.asdec.gui.proxy.ProxyFrame; +import com.jpexs.asdec.tags.DoABCTag; +import com.jpexs.asdec.tags.Tag; +import com.jpexs.proxy.Replacement; +import java.util.logging.Level; +import java.util.logging.Logger; + +import javax.swing.*; +import javax.swing.filechooser.FileFilter; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.io.*; +import java.util.ArrayList; +import java.util.List; + + +/** + * Main executable class + * + * @author JPEXS + */ +public class Main { + + public static com.jpexs.asdec.abc.gui.MainFrame abcMainFrame; + public static com.jpexs.asdec.action.gui.MainFrame actionMainFrame; + public static ProxyFrame proxyFrame; + public static String file; + public static String maskURL; + public static SWF swf; + public static final String version = "alpha7"; + public static String applicationName = "JP ActionScript Decompiler v." + version; + public static LoadingDialog loadingDialog = new LoadingDialog(); + public static ModeFrame modeFrame; + private static boolean working = false; + private static TrayIcon trayIcon; + private static MenuItem stopMenuItem; + public static boolean DEBUG_COPY = false; + public static boolean DEBUG_MODE = false; + public static boolean DISABLE_DANGEROUS = false; + + public static String getFileTitle() { + if (maskURL != null) return maskURL; + return file; + } + + /** + * List of replacements + */ + public static java.util.List replacements = new ArrayList(); + + + private static String getASDecHome() { + String dir = ".";//System.getProperty("user.home"); + if (!dir.endsWith(File.separator)) dir += File.separator; + dir += "config" + File.separator; + return dir; + } + + private static String getReplacementsFile() { + return getASDecHome() + "replacements.ini"; + } + + /** + * Saves replacements to file for future use + */ + public static void saveReplacements() { + try { + File f = new File(getASDecHome()); + if (!f.exists()) f.mkdir(); + PrintWriter pw = new PrintWriter(new FileWriter(getReplacementsFile())); + for (Replacement r : replacements) { + pw.println(r.urlPattern); + pw.println(r.targetFile); + } + pw.close(); + } catch (IOException e) { + + } + } + + /** + * Load replacements from file + */ + public static void loadReplacements() { + replacements = new ArrayList(); + try { + BufferedReader br = new BufferedReader(new FileReader(getReplacementsFile())); + String s = ""; + while ((s = br.readLine()) != null) { + Replacement r = new Replacement(s, br.readLine()); + replacements.add(r); + } + br.close(); + } catch (IOException e) { + + } + } + + public static boolean isWorking() { + return working; + } + + public static void showProxy() { + if (proxyFrame == null) proxyFrame = new ProxyFrame(); + proxyFrame.setVisible(true); + proxyFrame.setState(Frame.NORMAL); + } + + public static void startWork(String name) { + working = true; + if(abcMainFrame!=null) + abcMainFrame.setStatus(name); + if(actionMainFrame!=null) + actionMainFrame.setStatus(name); + } + + public static void stopWork() { + working = false; + if(abcMainFrame!=null) + abcMainFrame.setStatus(""); + if(actionMainFrame!=null) + actionMainFrame.setStatus(""); + } + + public static SWF parseSWF(String file) throws Exception { + FileInputStream fis = new FileInputStream(file); + SWF locswf = new SWF(fis); + return locswf; + } + + + public static void saveFile(String outfile) throws IOException { + file = outfile; + swf.saveTo(new FileOutputStream(outfile)); + } + + + private static class OpenFileWorker extends SwingWorker { + @Override + protected Object doInBackground() throws Exception { + try { + swf = parseSWF(Main.file); + FileInputStream fis = new FileInputStream(file); + DEBUG_COPY = true; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try { + swf.saveTo(baos); + } catch (NotSameException nse) { + if (DEBUG_MODE) { + nse.printStackTrace(); + System.exit(0); + } + JOptionPane.showMessageDialog(null, "WARNING: The SWF decompiler may have problems saving this file. Recommended usage is READ ONLY."); + } + DEBUG_COPY = false; + //DEBUG_COPY=true; + } catch (Exception ex) { + ex.printStackTrace(); + JOptionPane.showMessageDialog(null, "Cannot load SWF file."); + loadingDialog.setVisible(false); + return false; + } + List listAbc = new ArrayList(); + for (Tag t : swf.tags) { + if (t instanceof DoABCTag) listAbc.add(t); + } + + + if (false) { + JOptionPane.showMessageDialog(null, "This SWF file does not contain any ActionScript parts"); + loadingDialog.setVisible(false); + if (!openFileDialog()) { + System.exit(0); + } + } else { + if (listAbc.size() > 0) { + List listAbc2 = new ArrayList(); + for (Tag tag : listAbc) { + listAbc2.add((DoABCTag) tag); + } + abcMainFrame = new com.jpexs.asdec.abc.gui.MainFrame(listAbc2); + abcMainFrame.display(); + } else { + actionMainFrame = new com.jpexs.asdec.action.gui.MainFrame(swf.tags); + actionMainFrame.display(); + } + } + loadingDialog.setVisible(false); + return true; + } + } + + public static boolean openFile(String swfFile) { + if (abcMainFrame != null) + abcMainFrame.setVisible(false); + if (actionMainFrame != null) + actionMainFrame.setVisible(false); + Main.file = swfFile; + Main.loadingDialog.setVisible(true); + (new OpenFileWorker()).execute(); + return true; + } + + + public static boolean saveFileDialog(Frame f) { + JFileChooser fc = new JFileChooser(); + int returnVal = fc.showSaveDialog(f); + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = fc.getSelectedFile(); + try { + Main.saveFile(file.getAbsolutePath()); + maskURL = null; + return true; + } catch (IOException ex) { + JOptionPane.showMessageDialog(null, "Cannot write to the file"); + } + } + return false; + } + + public static boolean openFileDialog() { + maskURL = null; + JFileChooser fc = new JFileChooser(); + fc.setFileFilter(new FileFilter() { + + @Override + public boolean accept(File f) { + return (f.getName().endsWith(".swf")) || (f.isDirectory()); + } + + @Override + public String getDescription() { + return "SWF files (*.swf)"; + } + + }); + int returnVal = fc.showOpenDialog(null); + if (returnVal == JFileChooser.APPROVE_OPTION) { + File selfile = fc.getSelectedFile(); + Main.openFile(selfile.getAbsolutePath()); + return true; + } else { + return false; + } + } + + + public static void showModeFrame() { + if (modeFrame == null) modeFrame = new ModeFrame(); + modeFrame.setVisible(true); + } + + + public static void updateLicenseInDir(File dir){ + String license="/*\r\n * Copyright (C) 2010 JPEXS\r\n * \r\n * This program is free software; you can redistribute it and/or\r\n * modify it under the terms of the GNU General Public License\r\n * as published by the Free Software Foundation; either version 2\r\n * of the License, or (at your option) any later version.\r\n * \r\n * This program is distributed in the hope that it will be useful,\r\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\n * GNU General Public License for more details.\r\n * \r\n * You should have received a copy of the GNU General Public License\r\n * along with this program; if not, write to the Free Software\r\n * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r\n */\r\n"; + + File files[]=dir.listFiles(); + for(File f:files){ + if(f.isDirectory()){ + updateLicenseInDir(f); + }else{ + if(f.getName().endsWith(".java")){ + ByteArrayOutputStream baos=new ByteArrayOutputStream(); + PrintWriter pw=null; + try { + pw = new PrintWriter(new OutputStreamWriter(baos, "utf8")); + } catch (UnsupportedEncodingException ex) { + + } + try { + BufferedReader br=new BufferedReader(new FileReader(f)); + String s=""; + boolean packageFound=false; + while((s=br.readLine())!=null){ + if(!packageFound){ + if(s.trim().startsWith("package")){ + packageFound=true; + pw.println(license); + } + } + if(packageFound){ + pw.println(s); + } + } + br.close(); + pw.close(); + } catch (IOException ex) { + + } + + FileOutputStream fos; + try { + fos = new FileOutputStream(f); + fos.write(baos.toByteArray()); + fos.close(); + } catch (IOException ex) { + + } + } + } + } + + } + + /** + * @param args the command line arguments + */ + public static void main(String[] args) throws IOException { + View.setWinLookAndFeel(); + loadReplacements(); + if (args.length < 1) { + showModeFrame(); + } else { + if (args[0].equals("-proxy")) { + int port = 55555; + for (int i = 0; i < args.length; i++) { + if (args[i].startsWith("-P")) { + try { + port = Integer.parseInt(args[i].substring(2)); + } catch (NumberFormatException nex) { + System.err.println("Bad port number"); + } + } + } + if (proxyFrame == null) proxyFrame = new ProxyFrame(); + proxyFrame.setPort(port); + addTrayIcon(); + switchProxy(); + } else { + openFile(args[0]); + } + } + } + + + public static String tempFile(String url) { + File f = new File(getASDecHome() + "saved" + File.separator); + if (!f.exists()) f.mkdirs(); + return getASDecHome() + "saved" + File.separator + "asdec_" + Integer.toHexString(url.hashCode()) + ".tmp"; + + } + + public static void removeTrayIcon() { + if (SystemTray.isSupported()) { + SystemTray tray = SystemTray.getSystemTray(); + if (trayIcon != null) { + tray.remove(trayIcon); + trayIcon = null; + } + } + } + + public static void switchProxy() { + proxyFrame.switchState(); + if (stopMenuItem != null) { + if (proxyFrame.isRunning()) { + stopMenuItem.setLabel("Stop proxy"); + } else { + stopMenuItem.setLabel("Start proxy"); + } + } + } + + public static void addTrayIcon() { + if (trayIcon != null) return; + if (SystemTray.isSupported()) { + SystemTray tray = SystemTray.getSystemTray(); + trayIcon = new TrayIcon(View.loadImage("com/jpexs/asdec/gui/graphics/proxy16.png"), "JP ASDec Proxy"); + trayIcon.setImageAutoSize(true); + PopupMenu trayPopup = new PopupMenu(); + + + ActionListener trayListener = new ActionListener() { + /** + * Invoked when an action occurs. + */ + public void actionPerformed(ActionEvent e) { + if (e.getActionCommand().equals("EXIT")) Main.exit(); + if (e.getActionCommand().equals("SHOW")) Main.showProxy(); + if (e.getActionCommand().equals("SWITCH")) Main.switchProxy(); + } + }; + + + MenuItem showMenuItem = new MenuItem("Show proxy"); + showMenuItem.setActionCommand("SHOW"); + showMenuItem.addActionListener(trayListener); + trayPopup.add(showMenuItem); + stopMenuItem = new MenuItem("Start proxy"); + stopMenuItem.setActionCommand("SWITCH"); + stopMenuItem.addActionListener(trayListener); + trayPopup.add(stopMenuItem); + trayPopup.addSeparator(); + MenuItem exitMenuItem = new MenuItem("Exit"); + exitMenuItem.setActionCommand("EXIT"); + exitMenuItem.addActionListener(trayListener); + trayPopup.add(exitMenuItem); + + trayIcon.setPopupMenu(trayPopup); + trayIcon.addMouseListener(new MouseAdapter() { + /** + * {@inheritDoc} + */ + @Override + public void mouseClicked(MouseEvent e) { + if (e.getButton() == MouseEvent.BUTTON1) { + Main.showProxy(); + } + } + }); + try { + tray.add(trayIcon); + } catch (AWTException ex) { + + } + } + } + + public static void exit() { + saveReplacements(); + System.exit(0); + } +} diff --git a/trunk/src/com/jpexs/asdec/SWF.java b/trunk/src/com/jpexs/asdec/SWF.java index d3319b0bc..ecb19e36a 100644 --- a/trunk/src/com/jpexs/asdec/SWF.java +++ b/trunk/src/com/jpexs/asdec/SWF.java @@ -1,190 +1,208 @@ -package com.jpexs.asdec; - -import com.jpexs.asdec.tags.Tag; -import com.jpexs.asdec.types.RECT; - -import java.io.*; -import java.util.ArrayList; -import java.util.List; -import java.util.zip.DeflaterOutputStream; -import java.util.zip.InflaterInputStream; - -/** - * Class representing SWF file - * - * @author JPEXS - */ -public class SWF { - - /** - * Tags inside of file - */ - public List tags = new ArrayList(); - /** - * Rectangle for the display - */ - public RECT displayRect; - /** - * Movie frame rate - */ - public int frameRate; - /** - * Number of frames in movie - */ - public int frameCount; - /** - * Version of SWF - */ - public int version; - /** - * Size of the file - */ - public long fileSize; - - /** - * Use compression - */ - public boolean compressed = false; - - /** - * Gets all tags with specified id - * - * @param tagId Identificator of tag type - * @return List of tags - */ - public List getTagData(int tagId) { - List ret = new ArrayList(); - for (Tag tag : tags) { - if (tag.getId() == tagId) { - ret.add(tag); - } - } - return ret; - } - - /** - * Saves this SWF into new file - * - * @param os OutputStream to save SWF in - * @throws IOException - */ - public void saveTo(OutputStream os) throws IOException { - try { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - SWFOutputStream sos = new SWFOutputStream(baos, version); - sos.writeRECT(displayRect); - sos.writeUI8(0); - sos.writeUI8(frameRate); - sos.writeUI16(frameCount); - - sos.writeTags(tags); - sos.writeUI16(0); - sos.close(); - if (compressed) { - os.write('C'); - } else { - os.write('F'); - } - os.write('W'); - os.write('S'); - os.write(version); - byte data[] = baos.toByteArray(); - sos = new SWFOutputStream(os, version); - sos.writeUI32(data.length + 8); - - if (compressed) { - os = new DeflaterOutputStream(os); - } - os.write(data); - } - finally { - if (os != null) - os.close(); - } - - } - - /** - * Construct SWF from stream - * - * @param is Stream to read SWF from - * @throws IOException - */ - public SWF(InputStream is) throws IOException { - byte hdr[] = new byte[3]; - is.read(hdr); - String shdr = new String(hdr); - if ((!shdr.equals("FWS")) && (!shdr.equals("CWS"))) { - throw new IOException("Invalid SWF file"); - } - version = is.read(); - SWFInputStream sis = new SWFInputStream(is, version); - fileSize = sis.readUI32(); - - if (hdr[0] == 'C') { - sis = new SWFInputStream(new InflaterInputStream(is), version); - compressed = true; - } - - - displayRect = sis.readRECT(); - sis.readUI8(); - frameRate = sis.readUI8(); - frameCount = sis.readUI16(); - tags = sis.readTagList(); - } - - - /** - * Compress SWF file - * - * @param fis Input stream - * @param fos Output stream - */ - public static void fws2cws(InputStream fis, OutputStream fos) { - try { - byte swfHead[] = new byte[8]; - fis.read(swfHead); - - swfHead[0] = 'C'; - fos.write(swfHead); - fos = new DeflaterOutputStream(fos); - int i = 0; - while ((i = fis.read()) != -1) { - fos.write(i); - } - - fis.close(); - fos.close(); - } catch (FileNotFoundException ex) { - } catch (IOException ex) { - } - - } - - /** - * Decompress SWF file - * - * @param fis Input stream - * @param fos Output stream - */ - public static void cws2fws(InputStream fis, OutputStream fos) { - try { - byte swfHead[] = new byte[8]; - fis.read(swfHead); - InflaterInputStream iis = new InflaterInputStream(fis); - swfHead[0] = 'F'; - fos.write(swfHead); - int i = 0; - while ((i = iis.read()) != -1) { - fos.write(i); - } - - fis.close(); - fos.close(); - } catch (FileNotFoundException ex) { - } catch (IOException ex) { - } - - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec; + +import com.jpexs.asdec.tags.Tag; +import com.jpexs.asdec.types.RECT; + +import java.io.*; +import java.util.ArrayList; +import java.util.List; +import java.util.zip.DeflaterOutputStream; +import java.util.zip.InflaterInputStream; + +/** + * Class representing SWF file + * + * @author JPEXS + */ +public class SWF { + + /** + * Tags inside of file + */ + public List tags = new ArrayList(); + /** + * Rectangle for the display + */ + public RECT displayRect; + /** + * Movie frame rate + */ + public int frameRate; + /** + * Number of frames in movie + */ + public int frameCount; + /** + * Version of SWF + */ + public int version; + /** + * Size of the file + */ + public long fileSize; + + /** + * Use compression + */ + public boolean compressed = false; + + /** + * Gets all tags with specified id + * + * @param tagId Identificator of tag type + * @return List of tags + */ + public List getTagData(int tagId) { + List ret = new ArrayList(); + for (Tag tag : tags) { + if (tag.getId() == tagId) { + ret.add(tag); + } + } + return ret; + } + + /** + * Saves this SWF into new file + * + * @param os OutputStream to save SWF in + * @throws IOException + */ + public void saveTo(OutputStream os) throws IOException { + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + SWFOutputStream sos = new SWFOutputStream(baos, version); + sos.writeRECT(displayRect); + sos.writeUI8(0); + sos.writeUI8(frameRate); + sos.writeUI16(frameCount); + + sos.writeTags(tags); + sos.writeUI16(0); + sos.close(); + if (compressed) { + os.write('C'); + } else { + os.write('F'); + } + os.write('W'); + os.write('S'); + os.write(version); + byte data[] = baos.toByteArray(); + sos = new SWFOutputStream(os, version); + sos.writeUI32(data.length + 8); + + if (compressed) { + os = new DeflaterOutputStream(os); + } + os.write(data); + } + finally { + if (os != null) + os.close(); + } + + } + + /** + * Construct SWF from stream + * + * @param is Stream to read SWF from + * @throws IOException + */ + public SWF(InputStream is) throws IOException { + byte hdr[] = new byte[3]; + is.read(hdr); + String shdr = new String(hdr); + if ((!shdr.equals("FWS")) && (!shdr.equals("CWS"))) { + throw new IOException("Invalid SWF file"); + } + version = is.read(); + SWFInputStream sis = new SWFInputStream(is, version); + fileSize = sis.readUI32(); + + if (hdr[0] == 'C') { + sis = new SWFInputStream(new InflaterInputStream(is), version); + compressed = true; + } + + + displayRect = sis.readRECT(); + sis.readUI8(); + frameRate = sis.readUI8(); + frameCount = sis.readUI16(); + tags = sis.readTagList(); + } + + + /** + * Compress SWF file + * + * @param fis Input stream + * @param fos Output stream + */ + public static void fws2cws(InputStream fis, OutputStream fos) { + try { + byte swfHead[] = new byte[8]; + fis.read(swfHead); + + swfHead[0] = 'C'; + fos.write(swfHead); + fos = new DeflaterOutputStream(fos); + int i = 0; + while ((i = fis.read()) != -1) { + fos.write(i); + } + + fis.close(); + fos.close(); + } catch (FileNotFoundException ex) { + } catch (IOException ex) { + } + + } + + /** + * Decompress SWF file + * + * @param fis Input stream + * @param fos Output stream + */ + public static void cws2fws(InputStream fis, OutputStream fos) { + try { + byte swfHead[] = new byte[8]; + fis.read(swfHead); + InflaterInputStream iis = new InflaterInputStream(fis); + swfHead[0] = 'F'; + fos.write(swfHead); + int i = 0; + while ((i = iis.read()) != -1) { + fos.write(i); + } + + fis.close(); + fos.close(); + } catch (FileNotFoundException ex) { + } catch (IOException ex) { + } + + } +} diff --git a/trunk/src/com/jpexs/asdec/SWFInputStream.java b/trunk/src/com/jpexs/asdec/SWFInputStream.java index e5a6859b8..09ff0370d 100644 --- a/trunk/src/com/jpexs/asdec/SWFInputStream.java +++ b/trunk/src/com/jpexs/asdec/SWFInputStream.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/SWFOutputStream.java b/trunk/src/com/jpexs/asdec/SWFOutputStream.java index e26d2c5b0..b59db6ace 100644 --- a/trunk/src/com/jpexs/asdec/SWFOutputStream.java +++ b/trunk/src/com/jpexs/asdec/SWFOutputStream.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/abc/ABC.java b/trunk/src/com/jpexs/asdec/abc/ABC.java index f6620ab68..a018a3603 100644 --- a/trunk/src/com/jpexs/asdec/abc/ABC.java +++ b/trunk/src/com/jpexs/asdec/abc/ABC.java @@ -1,728 +1,737 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc; - -import com.jpexs.asdec.Main; -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.UnknownInstructionCode; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.InitPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.SetPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.*; -import com.jpexs.asdec.abc.types.traits.Trait; -import com.jpexs.asdec.abc.types.traits.TraitMethodGetterSetter; -import com.jpexs.asdec.abc.types.traits.TraitSlotConst; -import com.jpexs.asdec.helpers.Highlighting; - -import java.io.*; -import java.util.ArrayList; -import java.util.List; - - -public class ABC { - - public int major_version = 0; - public int minor_version = 0; - public ConstantPool constants; - public MethodInfo method_info[]; - public MetadataInfo metadata_info[]; - public InstanceInfo instance_info[]; - public ClassInfo class_info[]; - public ScriptInfo script_info[]; - public MethodBody bodies[]; - public long stringOffsets[]; - public static String IDENT_STRING = " "; - - public ABC(InputStream is) throws IOException { - - ABCInputStream ais = new ABCInputStream(is); - major_version = ais.readU16(); - minor_version = ais.readU16(); - constants = new ConstantPool(); - //constant integers - int constant_int_pool_count = ais.readU30(); - constants.constant_int = new long[constant_int_pool_count]; - for (int i = 1; i < constant_int_pool_count; i++) { //index 0 not used. Values 1..n-1 - constants.constant_int[i] = ais.readS32(); - } - - //constant unsigned integers - int constant_uint_pool_count = ais.readU30(); - constants.constant_uint = new long[constant_uint_pool_count]; - for (int i = 1; i < constant_uint_pool_count; i++) { //index 0 not used. Values 1..n-1 - constants.constant_uint[i] = ais.readU32(); - } - - //constant double - int constant_double_pool_count = ais.readU30(); - constants.constant_double = new double[constant_double_pool_count]; - for (int i = 1; i < constant_double_pool_count; i++) { //index 0 not used. Values 1..n-1 - constants.constant_double[i] = ais.readDouble(); - } - - //constant string - int constant_string_pool_count = ais.readU30(); - constants.constant_string = new String[constant_string_pool_count]; - stringOffsets = new long[constant_string_pool_count]; - constants.constant_string[0] = ""; - for (int i = 1; i < constant_string_pool_count; i++) { //index 0 not used. Values 1..n-1 - long pos = ais.getPosition(); - constants.constant_string[i] = ais.readString(); - stringOffsets[i] = pos; - /* - INVALID STRINGS - - String invalidStr=",,if,else,finally,while,int,switch,return,case,do,"; - if(invalidStr.contains(","+constants.constant_string[i]+",")){ - //constants.constant_string[i]="s"+i+"/"+constants.constant_string[i]; - }*/ - } - - //constant namespace - int constant_namespace_pool_count = ais.readU30(); - constants.constant_namespace = new Namespace[constant_namespace_pool_count]; - for (int i = 1; i < constant_namespace_pool_count; i++) { //index 0 not used. Values 1..n-1 - constants.constant_namespace[i] = ais.readNamespace(); - cleanOneName(constants.constant_namespace[i].name_index); - } - - //constant namespace set - int constant_namespace_set_pool_count = ais.readU30(); - constants.constant_namespace_set = new NamespaceSet[constant_namespace_set_pool_count]; - for (int i = 1; i < constant_namespace_set_pool_count; i++) { //index 0 not used. Values 1..n-1 - constants.constant_namespace_set[i] = new NamespaceSet(); - int namespace_count = ais.readU30(); - constants.constant_namespace_set[i].namespaces = new int[namespace_count]; - for (int j = 0; j < namespace_count; j++) { - constants.constant_namespace_set[i].namespaces[j] = ais.readU30(); - } - } - - - //constant multiname - int constant_multiname_pool_count = ais.readU30(); - constants.constant_multiname = new Multiname[constant_multiname_pool_count]; - for (int i = 1; i < constant_multiname_pool_count; i++) { //index 0 not used. Values 1..n-1 - constants.constant_multiname[i] = ais.readMultiname(); - cleanNamespace(constants.constant_multiname[i].name_index); - } - - - //method info - int methods_count = ais.readU30(); - method_info = new MethodInfo[methods_count]; - for (int i = 0; i < methods_count; i++) { //index 0 not used. Values 1..n-1 - method_info[i] = ais.readMethodInfo(); - } - - //metadata info - int metadata_count = ais.readU30(); - metadata_info = new MetadataInfo[metadata_count]; - for (int i = 0; i < metadata_count; i++) { //index 0 not used. Values 1..n-1 - int name_index = ais.readU30(); - int values_count = ais.readU30(); - int keys[] = new int[values_count]; - for (int v = 0; v < values_count; v++) { - keys[v] = ais.readU30(); - } - int values[] = new int[values_count]; - for (int v = 0; v < values_count; v++) { - values[v] = ais.readU30(); - } - metadata_info[i] = new MetadataInfo(name_index, keys, values); - } - - int class_count = ais.readU30(); - instance_info = new InstanceInfo[class_count]; - for (int i = 0; i < class_count; i++) { - instance_info[i] = ais.readInstanceInfo(); - } - class_info = new ClassInfo[class_count]; - for (int i = 0; i < class_count; i++) { - class_info[i] = new ClassInfo(); - class_info[i].cinit_index = ais.readU30(); - class_info[i].static_traits = ais.readTraits(); - } - int script_count = ais.readU30(); - script_info = new ScriptInfo[script_count]; - for (int i = 0; i < script_count; i++) { - script_info[i] = new ScriptInfo(); - script_info[i].init_index = ais.readU30(); - script_info[i].traits = ais.readTraits(); - } - - int bodies_count = ais.readU30(); - bodies = new MethodBody[bodies_count]; - for (int i = 0; i < bodies_count; i++) { - bodies[i] = new MethodBody(); - bodies[i].method_info = ais.readU30(); - bodies[i].max_stack = ais.readU30(); - bodies[i].max_regs = ais.readU30(); - bodies[i].scope_depth = ais.readU30(); - bodies[i].max_scope = ais.readU30(); - int code_length = ais.readU30(); - bodies[i].codeBytes = new byte[code_length]; - for (int j = 0; j < code_length; j++) { - bodies[i].codeBytes[j] = (byte) ais.read(); - } - try { - bodies[i].code = new AVM2Code(new ByteArrayInputStream(bodies[i].codeBytes)); - } catch (UnknownInstructionCode re) { - bodies[i].code = new AVM2Code(); - System.err.println(re.toString()); - } - int ex_count = ais.readU30(); - bodies[i].exceptions = new ABCException[ex_count]; - for (int j = 0; j < ex_count; j++) { - bodies[i].exceptions[j] = new ABCException(); - bodies[i].exceptions[j].start = ais.readU30(); - bodies[i].exceptions[j].end = ais.readU30(); - bodies[i].exceptions[j].target = ais.readU30(); - bodies[i].exceptions[j].type_index = ais.readU30(); - bodies[i].exceptions[j].name_index = ais.readU30(); - } - bodies[i].traits = ais.readTraits(); - /*try { - bodies[i].code.clearCode(constants, bodies[i]); - } catch (ConvertException ignored) { - } */ - } - } - - public void saveToStream(OutputStream os) throws IOException { - ABCOutputStream aos = new ABCOutputStream(os); - aos.writeU16(major_version); - aos.writeU16(minor_version); - - aos.writeU30(constants.constant_int.length); - for (int i = 1; i < constants.constant_int.length; i++) { - try { - aos.writeS32(constants.constant_int[i]); - } catch (NotSameException nex) { - System.out.println("written:" + constants.constant_int[i]); - throw nex; - } - } - aos.writeU30(constants.constant_uint.length); - for (int i = 1; i < constants.constant_uint.length; i++) { - aos.writeU32(constants.constant_uint[i]); - } - - aos.writeU30(constants.constant_double.length); - for (int i = 1; i < constants.constant_double.length; i++) { - aos.writeDouble(constants.constant_double[i]); - } - - aos.writeU30(constants.constant_string.length); - for (int i = 1; i < constants.constant_string.length; i++) { - aos.writeString(constants.constant_string[i]); - } - - aos.writeU30(constants.constant_namespace.length); - for (int i = 1; i < constants.constant_namespace.length; i++) { - aos.writeNamespace(constants.constant_namespace[i]); - } - - aos.writeU30(constants.constant_namespace_set.length); - for (int i = 1; i < constants.constant_namespace_set.length; i++) { - aos.writeU30(constants.constant_namespace_set[i].namespaces.length); - for (int j = 0; j < constants.constant_namespace_set[i].namespaces.length; j++) { - aos.writeU30(constants.constant_namespace_set[i].namespaces[j]); - } - } - - aos.writeU30(constants.constant_multiname.length); - for (int i = 1; i < constants.constant_multiname.length; i++) { - aos.writeMultiname(constants.constant_multiname[i]); - } - - aos.writeU30(method_info.length); - for (int i = 0; i < method_info.length; i++) { - aos.writeMethodInfo(method_info[i]); - } - - aos.writeU30(metadata_info.length); - for (int i = 0; i < metadata_info.length; i++) { - aos.writeU30(metadata_info[i].name_index); - aos.writeU30(metadata_info[i].values.length); - for (int j = 0; j < metadata_info[i].values.length; j++) { - aos.writeU30(metadata_info[i].keys[j]); - } - for (int j = 0; j < metadata_info[i].values.length; j++) { - aos.writeU30(metadata_info[i].values[j]); - } - } - - aos.writeU30(class_info.length); - for (int i = 0; i < instance_info.length; i++) { - aos.writeInstanceInfo(instance_info[i]); - } - for (int i = 0; i < class_info.length; i++) { - aos.writeU30(class_info[i].cinit_index); - aos.writeTraits(class_info[i].static_traits); - } - aos.writeU30(script_info.length); - for (int i = 0; i < script_info.length; i++) { - aos.writeU30(script_info[i].init_index); - aos.writeTraits(script_info[i].traits); - } - - aos.writeU30(bodies.length); - for (int i = 0; i < bodies.length; i++) { - aos.writeU30(bodies[i].method_info); - aos.writeU30(bodies[i].max_stack); - aos.writeU30(bodies[i].max_regs); - aos.writeU30(bodies[i].scope_depth); - aos.writeU30(bodies[i].max_scope); - byte codeBytes[] = bodies[i].code.getBytes(); - aos.writeU30(codeBytes.length); - try { - aos.write(codeBytes); - } catch (NotSameException ex) { - System.out.println(bodies[i].code.toString(constants)); - System.exit(0); - return; - } - aos.writeU30(bodies[i].exceptions.length); - for (int j = 0; j < bodies[i].exceptions.length; j++) { - aos.writeU30(bodies[i].exceptions[j].start); - aos.writeU30(bodies[i].exceptions[j].end); - aos.writeU30(bodies[i].exceptions[j].target); - aos.writeU30(bodies[i].exceptions[j].type_index); - aos.writeU30(bodies[i].exceptions[j].name_index); - } - aos.writeTraits(bodies[i].traits); - } - } - - private void parseImportFromMultiname(List imports, Multiname m) { - if (m != null) { - Namespace ns = m.getNamespace(constants); - String name = m.getName(constants); - if (ns != null) { - String newimport = ns.getName(constants); - if (!newimport.equals("")) { - newimport += "." + name; - if (newimport.contains(":")) { - return; - } - if (!imports.contains(newimport)) { - imports.add(newimport); - } - } - } - } - } - - private List getImports(int instanceIndex) { - List imports = new ArrayList(); - - //constructor - - //parseImportFromMultiname(imports, constants.constant_multiname[instance_info[instanceIndex].name_index]); - - if (instance_info[instanceIndex].super_index > 0) { - parseImportFromMultiname(imports, constants.constant_multiname[instance_info[instanceIndex].super_index]); - } - for (int i : instance_info[instanceIndex].interfaces) { - parseImportFromMultiname(imports, constants.constant_multiname[i]); - } - //static - for (Trait t : class_info[instanceIndex].static_traits.traits) { - //parseImportFromMultiname(imports, t.getMultiName(constants)); - if (t instanceof TraitMethodGetterSetter) { - TraitMethodGetterSetter tm = (TraitMethodGetterSetter) t; - if (tm.method_info != 0) { - MethodBody body = findBody(tm.method_info); - if (body != null) { - for (AVM2Instruction ins : body.code.code) { - for (int k = 0; k < ins.definition.operands.length; k++) { - if (ins.definition.operands[k] == AVM2Code.DAT_MULTINAME_INDEX) { - int multinameIndex = ins.operands[k]; - parseImportFromMultiname(imports, constants.constant_multiname[multinameIndex]); - } - } - } - } - for (int p = 0; p < method_info[tm.method_info].param_types.length; p++) { - if (method_info[tm.method_info].param_types[p] != 0) { - parseImportFromMultiname(imports, constants.constant_multiname[method_info[tm.method_info].param_types[p]]); - } - if (method_info[tm.method_info].ret_type != 0) { - parseImportFromMultiname(imports, constants.constant_multiname[method_info[tm.method_info].ret_type]); - } - } - } - } - - } - //instance - for (Trait t : instance_info[instanceIndex].instance_traits.traits) { - //parseImportFromMultiname(imports, t.getMultiName(constants)); - if (t instanceof TraitMethodGetterSetter) { - TraitMethodGetterSetter tm = (TraitMethodGetterSetter) t; - if (tm.method_info != 0) { - MethodBody body = findBody(tm.method_info); - if (body != null) { - for (AVM2Instruction ins : body.code.code) { - for (int k = 0; k < ins.definition.operands.length; k++) { - if (ins.definition.operands[k] == AVM2Code.DAT_MULTINAME_INDEX) { - int multinameIndex = ins.operands[k]; - parseImportFromMultiname(imports, constants.constant_multiname[multinameIndex]); - } - } - } - } - for (int p = 0; p < method_info[tm.method_info].param_types.length; p++) { - if (method_info[tm.method_info].param_types[p] != 0) { - parseImportFromMultiname(imports, constants.constant_multiname[method_info[tm.method_info].param_types[p]]); - } - if (method_info[tm.method_info].ret_type != 0) { - parseImportFromMultiname(imports, constants.constant_multiname[method_info[tm.method_info].ret_type]); - } - } - } - } - } - return imports; - } - - public MethodBody findBody(int methodInfo) { - int pos = findBodyIndex(methodInfo); - if (pos == -1) { - return null; - } else { - return bodies[pos]; - } - } - - public int findBodyIndex(int methodInfo) { - if (methodInfo == -1) { - return -1; - } - for (int b = 0; b < bodies.length; b++) { - if (bodies[b].method_info == methodInfo) { - return b; - } - } - return -1; - } - - public MethodBody findBodyByClassAndName(String className, String methodName) { - for (int i = 0; i < instance_info.length; i++) { - if (className.equals(constants.constant_multiname[instance_info[i].name_index].getName(constants))) { - for (Trait t : instance_info[i].instance_traits.traits) { - if (t instanceof TraitMethodGetterSetter) { - TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t; - if (methodName.equals(t2.getMethodName(constants))) { - for (MethodBody body : bodies) { - if (body.method_info == t2.method_info) { - return body; - } - } - } - } - } - //break; - } - } - for (int i = 0; i < class_info.length; i++) { - if (className.equals(constants.constant_multiname[instance_info[i].name_index].getName(constants))) { - for (Trait t : class_info[i].static_traits.traits) { - if (t instanceof TraitMethodGetterSetter) { - TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t; - if (methodName.equals(t2.getMethodName(constants))) { - for (MethodBody body : bodies) { - if (body.method_info == t2.method_info) { - return body; - } - } - } - } - } - //break; - } - } - - - return null; - } - - private String addTabs(String s, int tabs) { - String parts[] = s.split("\r\n"); - String ret = ""; - for (int i = 0; i < parts.length; i++) { - for (int t = 0; t < tabs; t++) { - ret += IDENT_STRING; - } - ret += parts[i]; - if (i < parts.length - 1) { - ret += "\r\n"; - } - } - return ret; - } - - public int findMethodIdByTraitId(int classIndex, int traitId) { - if (traitId < class_info[classIndex].static_traits.traits.length) { - if (class_info[classIndex].static_traits.traits[traitId] instanceof TraitMethodGetterSetter) { - return ((TraitMethodGetterSetter) class_info[classIndex].static_traits.traits[traitId]).method_info; - } else { - return -1; - } - } else if (traitId < class_info[classIndex].static_traits.traits.length + instance_info[classIndex].instance_traits.traits.length) { - traitId -= class_info[classIndex].static_traits.traits.length; - if (instance_info[classIndex].instance_traits.traits[traitId] instanceof TraitMethodGetterSetter) { - return ((TraitMethodGetterSetter) instance_info[classIndex].instance_traits.traits[traitId]).method_info; - } else { - return -1; - } - } else { - traitId -= class_info[classIndex].static_traits.traits.length + instance_info[classIndex].instance_traits.traits.length; - if (traitId == 0) { - return instance_info[classIndex].iinit_index; - } else if (traitId == 1) { - return class_info[classIndex].cinit_index; - } else { - return -1; - } - } - } - - public String classToString(int i, boolean highlight) { - String ret = ""; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - PrintStream out = new PrintStream(baos); - String packageName = instance_info[i].getName(constants).getNamespace(constants).getName(constants); - out.println("package " + packageName); - out.println("{"); - - //imports - List imports = getImports(i); - for (String imp : imports) { - out.println(IDENT_STRING + "import " + imp + ";"); - } - out.println(); - - //class header - String classHeader = instance_info[i].getClassHeaderStr(constants); - if (classHeader.startsWith("private ")) - classHeader = "public " + classHeader.substring("private ".length()); - out.println(IDENT_STRING + classHeader); - out.println(IDENT_STRING + "{"); - - - if (class_info[i].cinit_index != 0) { - int bodyIndex = findBodyIndex(class_info[i].cinit_index); - List initializer = bodies[bodyIndex].code.toTree(true, i, this, constants, method_info, bodies[bodyIndex]); - for (TreeItem ti : initializer) { - if (ti instanceof SetPropertyTreeItem) { - int multinameIndex = ((SetPropertyTreeItem) ti).propertyName.multinameIndex; - TreeItem value = ((SetPropertyTreeItem) ti).value; - for (Trait t : class_info[i].static_traits.traits) { - if (t.name_index == multinameIndex) { - if (t instanceof TraitSlotConst) { - ((TraitSlotConst) t).assignedValue = value; - } - } - } - } - if (ti instanceof InitPropertyTreeItem) { - int multinameIndex = ((InitPropertyTreeItem) ti).propertyName.multinameIndex; - TreeItem value = ((InitPropertyTreeItem) ti).value; - for (Trait t : class_info[i].static_traits.traits) { - if (t.name_index == multinameIndex) { - if (t instanceof TraitSlotConst) { - ((TraitSlotConst) t).assignedValue = value; - } - } - } - } - } - /*String bodyStr = ""; - int bodyIndex = findBodyIndex(class_info[i].cinit_index); - if (bodyIndex != -1) { - bodyStr = addTabs(bodies[bodyIndex].toString(this, constants, method_info, hilight), 3); - } - if (!bodyStr.equals("")) { - String toPrint = IDENT_STRING + IDENT_STRING + "static {\r\n" + bodyStr + "\r\n" + IDENT_STRING + IDENT_STRING + "}"; - if (hilight) { - toPrint = Highlighting.hilighTrait(toPrint, class_info[i].static_traits.traits.length + instance_info[i].instance_traits.traits.length + 1); - } - out.println(toPrint); - }*/ - } - - //constructor - if (instance_info[i].iinit_index != 0) { - String modifier = ""; - Multiname m = constants.constant_multiname[instance_info[i].name_index]; - if (m != null) { - Namespace ns = m.getNamespace(constants); - if (ns != null) { - modifier = ns.getPrefix(constants) + " "; - if (modifier.equals(" ")) { - modifier = ""; - } - } - } - String constructorParams = method_info[instance_info[i].iinit_index].getParamStr(constants); - String bodyStr = ""; - int bodyIndex = findBodyIndex(instance_info[i].iinit_index); - if (bodyIndex != -1) { - bodyStr = addTabs(bodies[bodyIndex].toString(false, i, this, constants, method_info, highlight), 3); - } - String toPrint = IDENT_STRING + IDENT_STRING + modifier + "function " + constants.constant_multiname[instance_info[i].name_index].getName(constants) + "(" + constructorParams + ") {\r\n" + bodyStr + "\r\n" + IDENT_STRING + IDENT_STRING + "}"; - if (highlight) { - toPrint = Highlighting.hilighTrait(toPrint, class_info[i].static_traits.traits.length + instance_info[i].instance_traits.traits.length); - } - out.println(toPrint); - } - - //static variables,constants & methods - for (int ti = 0; ti < class_info[i].static_traits.traits.length; ti++) { - Trait t = class_info[i].static_traits.traits[ti]; - String toPrint = ""; - if (t instanceof TraitMethodGetterSetter) { - TraitMethodGetterSetter tm = (TraitMethodGetterSetter) t; - String bodyStr = ""; - int bodyIndex = findBodyIndex(tm.method_info); - if (bodyIndex != -1) { - bodyStr = addTabs(bodies[bodyIndex].toString(true, i, this, constants, method_info, highlight), 3); - } - toPrint = IDENT_STRING + IDENT_STRING + tm.convert(constants, method_info, true) + " {\r\n" + bodyStr + "\r\n" + IDENT_STRING + IDENT_STRING + "}"; - } - if (t instanceof TraitSlotConst) { - TraitSlotConst ts = (TraitSlotConst) t; - - toPrint = IDENT_STRING + IDENT_STRING + ts.convert(constants, method_info, true) + ";"; - } - if (highlight) { - toPrint = Highlighting.hilighTrait(toPrint, ti); - } else { - toPrint = Highlighting.stripHilights(toPrint); - } - out.println(toPrint); - } - for (int ti = 0; ti < instance_info[i].instance_traits.traits.length; ti++) { - Trait t = instance_info[i].instance_traits.traits[ti]; - String toPrint = ""; - if (t instanceof TraitSlotConst) { - TraitSlotConst ts = (TraitSlotConst) t; - toPrint = IDENT_STRING + IDENT_STRING + ts.convert(constants, method_info, false) + ";"; - } - - if (t instanceof TraitMethodGetterSetter) { - TraitMethodGetterSetter tm = (TraitMethodGetterSetter) t; - String bodyStr = ""; - int bodyIndex = findBodyIndex(tm.method_info); - if (bodyIndex != -1) { - bodyStr = addTabs(bodies[bodyIndex].toString(false, i, this, constants, method_info, highlight), 3); - } - toPrint = IDENT_STRING + IDENT_STRING + tm.convert(constants, method_info, false) + " {\r\n" + bodyStr + "\r\n" + IDENT_STRING + IDENT_STRING + "}"; - } - if (highlight) { - toPrint = Highlighting.hilighTrait(toPrint, class_info[i].static_traits.traits.length + ti); - } else { - toPrint = Highlighting.stripHilights(toPrint); - } - out.println(toPrint); - } - - - out.println(IDENT_STRING + "}");//class - out.println("}");//package - out.flush(); - - return baos.toString(); - } - - public void export(String directory) throws IOException { - for (int i = 0; i < instance_info.length; i++) { - String packageName = instance_info[i].getName(constants).getNamespace(constants).getName(constants); - String className = instance_info[i].getName(constants).getName(constants); - Main.startWork("Exporting " + (i + 1) + "/" + instance_info.length + " " + packageName + "." + className + "..."); - File outDir = new File(directory + File.separatorChar + packageName.replace('.', File.separatorChar)); - if (!outDir.exists()) { - outDir.mkdirs(); - } - String fileName = outDir.toString() + File.separator + className + ".as"; - FileOutputStream fos = new FileOutputStream(fileName); - fos.write(classToString(i, false).getBytes()); - fos.close(); - } - - } - - public void dump(OutputStream os) { - PrintStream output = new PrintStream(os); - constants.dump(output); - for (int i = 0; i < method_info.length; i++) { - output.println("MethodInfo[" + i + "]:" + method_info[i].toString(constants)); - } - for (int i = 0; i < metadata_info.length; i++) { - output.println("MetadataInfo[" + i + "]:" + metadata_info[i].toString(constants)); - } - for (int i = 0; i < instance_info.length; i++) { - output.println("InstanceInfo[" + i + "]:" + instance_info[i].toString(constants)); - } - for (int i = 0; i < class_info.length; i++) { - output.println("ClassInfo[" + i + "]:" + class_info[i].toString(constants)); - } - for (int i = 0; i < script_info.length; i++) { - output.println("ScriptInfo[" + i + "]:" + script_info[i].toString(constants)); - } - for (int i = 0; i < bodies.length; i++) { - output.println("MethodBody[" + i + "]:"); //+ bodies[i].toString(this, constants, method_info)); - } - } - - public static final String[] reservedWords = { - "as", "break", "case", "catch", "class", "const", "continue", /*"default",*/ "delete", "do", "each", "else", - "extends", "false", "finally", "for", "function", "if", "implements", "import", "in", "instanceof", - "interface", "internal", "is", "native", "new", "null", "package", "private", "protected", "public", - "return", "super", "switch", "this", "throw", "true", "try", "typeof", "use", "var", /*"void",*/ "while", - "with"}; - public int unknownCount = 0; - - public void cleanOneName(int index) { - cleanNamespace(index); - } - - public void cleanNamespace(int index) { - if (index <= 0) { - return; - } - String s = constants.constant_string[index]; - boolean isValid = true; - boolean isReserved = false; - for (String rw : reservedWords) { - if (rw.equals(s.trim())) { - isValid = false; - isReserved = true; - break; - } - } - if (isValid) { - for (int i = 0; i < s.length(); i++) { - if (s.charAt(i) > 127) { - isValid = false; - break; - } - } - } - - if (!isValid) { - if (isReserved) { - constants.constant_string[index] = "name_" + s.replace(" ", "_"); - } else { - unknownCount++; - constants.constant_string[index] = "_name" + unknownCount; - } - } - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc; + +import com.jpexs.asdec.Main; +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.UnknownInstructionCode; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.InitPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.SetPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.*; +import com.jpexs.asdec.abc.types.traits.Trait; +import com.jpexs.asdec.abc.types.traits.TraitMethodGetterSetter; +import com.jpexs.asdec.abc.types.traits.TraitSlotConst; +import com.jpexs.asdec.helpers.Highlighting; + +import java.io.*; +import java.util.ArrayList; +import java.util.List; + + +public class ABC { + + public int major_version = 0; + public int minor_version = 0; + public ConstantPool constants; + public MethodInfo method_info[]; + public MetadataInfo metadata_info[]; + public InstanceInfo instance_info[]; + public ClassInfo class_info[]; + public ScriptInfo script_info[]; + public MethodBody bodies[]; + public long stringOffsets[]; + public static String IDENT_STRING = " "; + + public ABC(InputStream is) throws IOException { + + ABCInputStream ais = new ABCInputStream(is); + major_version = ais.readU16(); + minor_version = ais.readU16(); + constants = new ConstantPool(); + //constant integers + int constant_int_pool_count = ais.readU30(); + constants.constant_int = new long[constant_int_pool_count]; + for (int i = 1; i < constant_int_pool_count; i++) { //index 0 not used. Values 1..n-1 + constants.constant_int[i] = ais.readS32(); + } + + //constant unsigned integers + int constant_uint_pool_count = ais.readU30(); + constants.constant_uint = new long[constant_uint_pool_count]; + for (int i = 1; i < constant_uint_pool_count; i++) { //index 0 not used. Values 1..n-1 + constants.constant_uint[i] = ais.readU32(); + } + + //constant double + int constant_double_pool_count = ais.readU30(); + constants.constant_double = new double[constant_double_pool_count]; + for (int i = 1; i < constant_double_pool_count; i++) { //index 0 not used. Values 1..n-1 + constants.constant_double[i] = ais.readDouble(); + } + + //constant string + int constant_string_pool_count = ais.readU30(); + constants.constant_string = new String[constant_string_pool_count]; + stringOffsets = new long[constant_string_pool_count]; + constants.constant_string[0] = ""; + for (int i = 1; i < constant_string_pool_count; i++) { //index 0 not used. Values 1..n-1 + long pos = ais.getPosition(); + constants.constant_string[i] = ais.readString(); + stringOffsets[i] = pos; + } + + //constant namespace + int constant_namespace_pool_count = ais.readU30(); + constants.constant_namespace = new Namespace[constant_namespace_pool_count]; + for (int i = 1; i < constant_namespace_pool_count; i++) { //index 0 not used. Values 1..n-1 + constants.constant_namespace[i] = ais.readNamespace(); + cleanOneName(constants.constant_namespace[i].name_index); + } + + //constant namespace set + int constant_namespace_set_pool_count = ais.readU30(); + constants.constant_namespace_set = new NamespaceSet[constant_namespace_set_pool_count]; + for (int i = 1; i < constant_namespace_set_pool_count; i++) { //index 0 not used. Values 1..n-1 + constants.constant_namespace_set[i] = new NamespaceSet(); + int namespace_count = ais.readU30(); + constants.constant_namespace_set[i].namespaces = new int[namespace_count]; + for (int j = 0; j < namespace_count; j++) { + constants.constant_namespace_set[i].namespaces[j] = ais.readU30(); + } + } + + + //constant multiname + int constant_multiname_pool_count = ais.readU30(); + constants.constant_multiname = new Multiname[constant_multiname_pool_count]; + for (int i = 1; i < constant_multiname_pool_count; i++) { //index 0 not used. Values 1..n-1 + constants.constant_multiname[i] = ais.readMultiname(); + cleanNamespace(constants.constant_multiname[i].name_index); + } + + + //method info + int methods_count = ais.readU30(); + method_info = new MethodInfo[methods_count]; + for (int i = 0; i < methods_count; i++) { //index 0 not used. Values 1..n-1 + method_info[i] = ais.readMethodInfo(); + } + + //metadata info + int metadata_count = ais.readU30(); + metadata_info = new MetadataInfo[metadata_count]; + for (int i = 0; i < metadata_count; i++) { //index 0 not used. Values 1..n-1 + int name_index = ais.readU30(); + int values_count = ais.readU30(); + int keys[] = new int[values_count]; + for (int v = 0; v < values_count; v++) { + keys[v] = ais.readU30(); + } + int values[] = new int[values_count]; + for (int v = 0; v < values_count; v++) { + values[v] = ais.readU30(); + } + metadata_info[i] = new MetadataInfo(name_index, keys, values); + } + + int class_count = ais.readU30(); + instance_info = new InstanceInfo[class_count]; + for (int i = 0; i < class_count; i++) { + instance_info[i] = ais.readInstanceInfo(); + } + class_info = new ClassInfo[class_count]; + for (int i = 0; i < class_count; i++) { + class_info[i] = new ClassInfo(); + class_info[i].cinit_index = ais.readU30(); + class_info[i].static_traits = ais.readTraits(); + } + int script_count = ais.readU30(); + script_info = new ScriptInfo[script_count]; + for (int i = 0; i < script_count; i++) { + script_info[i] = new ScriptInfo(); + script_info[i].init_index = ais.readU30(); + script_info[i].traits = ais.readTraits(); + } + + int bodies_count = ais.readU30(); + bodies = new MethodBody[bodies_count]; + for (int i = 0; i < bodies_count; i++) { + bodies[i] = new MethodBody(); + bodies[i].method_info = ais.readU30(); + bodies[i].max_stack = ais.readU30(); + bodies[i].max_regs = ais.readU30(); + bodies[i].scope_depth = ais.readU30(); + bodies[i].max_scope = ais.readU30(); + int code_length = ais.readU30(); + bodies[i].codeBytes = new byte[code_length]; + for (int j = 0; j < code_length; j++) { + bodies[i].codeBytes[j] = (byte) ais.read(); + } + try { + bodies[i].code = new AVM2Code(new ByteArrayInputStream(bodies[i].codeBytes)); + } catch (UnknownInstructionCode re) { + bodies[i].code = new AVM2Code(); + System.err.println(re.toString()); + } + int ex_count = ais.readU30(); + bodies[i].exceptions = new ABCException[ex_count]; + for (int j = 0; j < ex_count; j++) { + bodies[i].exceptions[j] = new ABCException(); + bodies[i].exceptions[j].start = ais.readU30(); + bodies[i].exceptions[j].end = ais.readU30(); + bodies[i].exceptions[j].target = ais.readU30(); + bodies[i].exceptions[j].type_index = ais.readU30(); + bodies[i].exceptions[j].name_index = ais.readU30(); + } + bodies[i].traits = ais.readTraits(); + /*try { + bodies[i].code.clearCode(constants, bodies[i]); + } catch (ConvertException ignored) { + } */ + } + } + + public void saveToStream(OutputStream os) throws IOException { + ABCOutputStream aos = new ABCOutputStream(os); + aos.writeU16(major_version); + aos.writeU16(minor_version); + + aos.writeU30(constants.constant_int.length); + for (int i = 1; i < constants.constant_int.length; i++) { + try { + aos.writeS32(constants.constant_int[i]); + } catch (NotSameException nex) { + System.out.println("written:" + constants.constant_int[i]); + throw nex; + } + } + aos.writeU30(constants.constant_uint.length); + for (int i = 1; i < constants.constant_uint.length; i++) { + aos.writeU32(constants.constant_uint[i]); + } + + aos.writeU30(constants.constant_double.length); + for (int i = 1; i < constants.constant_double.length; i++) { + aos.writeDouble(constants.constant_double[i]); + } + + aos.writeU30(constants.constant_string.length); + for (int i = 1; i < constants.constant_string.length; i++) { + aos.writeString(constants.constant_string[i]); + } + + aos.writeU30(constants.constant_namespace.length); + for (int i = 1; i < constants.constant_namespace.length; i++) { + aos.writeNamespace(constants.constant_namespace[i]); + } + + aos.writeU30(constants.constant_namespace_set.length); + for (int i = 1; i < constants.constant_namespace_set.length; i++) { + aos.writeU30(constants.constant_namespace_set[i].namespaces.length); + for (int j = 0; j < constants.constant_namespace_set[i].namespaces.length; j++) { + aos.writeU30(constants.constant_namespace_set[i].namespaces[j]); + } + } + + aos.writeU30(constants.constant_multiname.length); + for (int i = 1; i < constants.constant_multiname.length; i++) { + aos.writeMultiname(constants.constant_multiname[i]); + } + + aos.writeU30(method_info.length); + for (int i = 0; i < method_info.length; i++) { + aos.writeMethodInfo(method_info[i]); + } + + aos.writeU30(metadata_info.length); + for (int i = 0; i < metadata_info.length; i++) { + aos.writeU30(metadata_info[i].name_index); + aos.writeU30(metadata_info[i].values.length); + for (int j = 0; j < metadata_info[i].values.length; j++) { + aos.writeU30(metadata_info[i].keys[j]); + } + for (int j = 0; j < metadata_info[i].values.length; j++) { + aos.writeU30(metadata_info[i].values[j]); + } + } + + aos.writeU30(class_info.length); + for (int i = 0; i < instance_info.length; i++) { + aos.writeInstanceInfo(instance_info[i]); + } + for (int i = 0; i < class_info.length; i++) { + aos.writeU30(class_info[i].cinit_index); + aos.writeTraits(class_info[i].static_traits); + } + aos.writeU30(script_info.length); + for (int i = 0; i < script_info.length; i++) { + aos.writeU30(script_info[i].init_index); + aos.writeTraits(script_info[i].traits); + } + + aos.writeU30(bodies.length); + for (int i = 0; i < bodies.length; i++) { + aos.writeU30(bodies[i].method_info); + aos.writeU30(bodies[i].max_stack); + aos.writeU30(bodies[i].max_regs); + aos.writeU30(bodies[i].scope_depth); + aos.writeU30(bodies[i].max_scope); + byte codeBytes[] = bodies[i].code.getBytes(); + aos.writeU30(codeBytes.length); + try { + aos.write(codeBytes); + } catch (NotSameException ex) { + System.out.println(bodies[i].code.toString(constants)); + System.exit(0); + return; + } + aos.writeU30(bodies[i].exceptions.length); + for (int j = 0; j < bodies[i].exceptions.length; j++) { + aos.writeU30(bodies[i].exceptions[j].start); + aos.writeU30(bodies[i].exceptions[j].end); + aos.writeU30(bodies[i].exceptions[j].target); + aos.writeU30(bodies[i].exceptions[j].type_index); + aos.writeU30(bodies[i].exceptions[j].name_index); + } + aos.writeTraits(bodies[i].traits); + } + } + + private void parseImportFromMultiname(List imports, Multiname m) { + if (m != null) { + Namespace ns = m.getNamespace(constants); + String name = m.getName(constants); + if (ns != null) { + String newimport = ns.getName(constants); + if (!newimport.equals("")) { + newimport += "." + name; + if (newimport.contains(":")) { + return; + } + if (!imports.contains(newimport)) { + imports.add(newimport); + } + } + } + } + } + + private List getImports(int instanceIndex) { + List imports = new ArrayList(); + + //constructor + + //parseImportFromMultiname(imports, constants.constant_multiname[instance_info[instanceIndex].name_index]); + + if (instance_info[instanceIndex].super_index > 0) { + parseImportFromMultiname(imports, constants.constant_multiname[instance_info[instanceIndex].super_index]); + } + for (int i : instance_info[instanceIndex].interfaces) { + parseImportFromMultiname(imports, constants.constant_multiname[i]); + } + //static + for (Trait t : class_info[instanceIndex].static_traits.traits) { + //parseImportFromMultiname(imports, t.getMultiName(constants)); + if (t instanceof TraitMethodGetterSetter) { + TraitMethodGetterSetter tm = (TraitMethodGetterSetter) t; + if (tm.method_info != 0) { + MethodBody body = findBody(tm.method_info); + if (body != null) { + for (AVM2Instruction ins : body.code.code) { + for (int k = 0; k < ins.definition.operands.length; k++) { + if (ins.definition.operands[k] == AVM2Code.DAT_MULTINAME_INDEX) { + int multinameIndex = ins.operands[k]; + parseImportFromMultiname(imports, constants.constant_multiname[multinameIndex]); + } + } + } + } + for (int p = 0; p < method_info[tm.method_info].param_types.length; p++) { + if (method_info[tm.method_info].param_types[p] != 0) { + parseImportFromMultiname(imports, constants.constant_multiname[method_info[tm.method_info].param_types[p]]); + } + if (method_info[tm.method_info].ret_type != 0) { + parseImportFromMultiname(imports, constants.constant_multiname[method_info[tm.method_info].ret_type]); + } + } + } + } + + } + //instance + for (Trait t : instance_info[instanceIndex].instance_traits.traits) { + //parseImportFromMultiname(imports, t.getMultiName(constants)); + if (t instanceof TraitMethodGetterSetter) { + TraitMethodGetterSetter tm = (TraitMethodGetterSetter) t; + if (tm.method_info != 0) { + MethodBody body = findBody(tm.method_info); + if (body != null) { + for (AVM2Instruction ins : body.code.code) { + for (int k = 0; k < ins.definition.operands.length; k++) { + if (ins.definition.operands[k] == AVM2Code.DAT_MULTINAME_INDEX) { + int multinameIndex = ins.operands[k]; + parseImportFromMultiname(imports, constants.constant_multiname[multinameIndex]); + } + } + } + } + for (int p = 0; p < method_info[tm.method_info].param_types.length; p++) { + if (method_info[tm.method_info].param_types[p] != 0) { + parseImportFromMultiname(imports, constants.constant_multiname[method_info[tm.method_info].param_types[p]]); + } + if (method_info[tm.method_info].ret_type != 0) { + parseImportFromMultiname(imports, constants.constant_multiname[method_info[tm.method_info].ret_type]); + } + } + } + } + } + return imports; + } + + public MethodBody findBody(int methodInfo) { + int pos = findBodyIndex(methodInfo); + if (pos == -1) { + return null; + } else { + return bodies[pos]; + } + } + + public int findBodyIndex(int methodInfo) { + if (methodInfo == -1) { + return -1; + } + for (int b = 0; b < bodies.length; b++) { + if (bodies[b].method_info == methodInfo) { + return b; + } + } + return -1; + } + + public MethodBody findBodyByClassAndName(String className, String methodName) { + for (int i = 0; i < instance_info.length; i++) { + if (className.equals(constants.constant_multiname[instance_info[i].name_index].getName(constants))) { + for (Trait t : instance_info[i].instance_traits.traits) { + if (t instanceof TraitMethodGetterSetter) { + TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t; + if (methodName.equals(t2.getMethodName(constants))) { + for (MethodBody body : bodies) { + if (body.method_info == t2.method_info) { + return body; + } + } + } + } + } + //break; + } + } + for (int i = 0; i < class_info.length; i++) { + if (className.equals(constants.constant_multiname[instance_info[i].name_index].getName(constants))) { + for (Trait t : class_info[i].static_traits.traits) { + if (t instanceof TraitMethodGetterSetter) { + TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t; + if (methodName.equals(t2.getMethodName(constants))) { + for (MethodBody body : bodies) { + if (body.method_info == t2.method_info) { + return body; + } + } + } + } + } + //break; + } + } + + + return null; + } + + private String addTabs(String s, int tabs) { + String parts[] = s.split("\r\n"); + String ret = ""; + for (int i = 0; i < parts.length; i++) { + for (int t = 0; t < tabs; t++) { + ret += IDENT_STRING; + } + ret += parts[i]; + if (i < parts.length - 1) { + ret += "\r\n"; + } + } + return ret; + } + + public int findMethodIdByTraitId(int classIndex, int traitId) { + if (traitId < class_info[classIndex].static_traits.traits.length) { + if (class_info[classIndex].static_traits.traits[traitId] instanceof TraitMethodGetterSetter) { + return ((TraitMethodGetterSetter) class_info[classIndex].static_traits.traits[traitId]).method_info; + } else { + return -1; + } + } else if (traitId < class_info[classIndex].static_traits.traits.length + instance_info[classIndex].instance_traits.traits.length) { + traitId -= class_info[classIndex].static_traits.traits.length; + if (instance_info[classIndex].instance_traits.traits[traitId] instanceof TraitMethodGetterSetter) { + return ((TraitMethodGetterSetter) instance_info[classIndex].instance_traits.traits[traitId]).method_info; + } else { + return -1; + } + } else { + traitId -= class_info[classIndex].static_traits.traits.length + instance_info[classIndex].instance_traits.traits.length; + if (traitId == 0) { + return instance_info[classIndex].iinit_index; + } else if (traitId == 1) { + return class_info[classIndex].cinit_index; + } else { + return -1; + } + } + } + + public String classToString(int i, boolean highlight) { + String ret = ""; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + PrintStream out = new PrintStream(baos); + String packageName = instance_info[i].getName(constants).getNamespace(constants).getName(constants); + out.println("package " + packageName); + out.println("{"); + + //imports + List imports = getImports(i); + for (String imp : imports) { + out.println(IDENT_STRING + "import " + imp + ";"); + } + out.println(); + + //class header + String classHeader = instance_info[i].getClassHeaderStr(constants); + if (classHeader.startsWith("private ")) + classHeader = "public " + classHeader.substring("private ".length()); + out.println(IDENT_STRING + classHeader); + out.println(IDENT_STRING + "{"); + + + if (class_info[i].cinit_index != 0) { + int bodyIndex = findBodyIndex(class_info[i].cinit_index); + List initializer = bodies[bodyIndex].code.toTree(true, i, this, constants, method_info, bodies[bodyIndex]); + for (TreeItem ti : initializer) { + if (ti instanceof SetPropertyTreeItem) { + int multinameIndex = ((SetPropertyTreeItem) ti).propertyName.multinameIndex; + TreeItem value = ((SetPropertyTreeItem) ti).value; + for (Trait t : class_info[i].static_traits.traits) { + if (t.name_index == multinameIndex) { + if (t instanceof TraitSlotConst) { + ((TraitSlotConst) t).assignedValue = value; + } + } + } + } + if (ti instanceof InitPropertyTreeItem) { + int multinameIndex = ((InitPropertyTreeItem) ti).propertyName.multinameIndex; + TreeItem value = ((InitPropertyTreeItem) ti).value; + for (Trait t : class_info[i].static_traits.traits) { + if (t.name_index == multinameIndex) { + if (t instanceof TraitSlotConst) { + ((TraitSlotConst) t).assignedValue = value; + } + } + } + } + } + /*String bodyStr = ""; + int bodyIndex = findBodyIndex(class_info[i].cinit_index); + if (bodyIndex != -1) { + bodyStr = addTabs(bodies[bodyIndex].toString(this, constants, method_info, hilight), 3); + } + if (!bodyStr.equals("")) { + String toPrint = IDENT_STRING + IDENT_STRING + "static {\r\n" + bodyStr + "\r\n" + IDENT_STRING + IDENT_STRING + "}"; + if (hilight) { + toPrint = Highlighting.hilighTrait(toPrint, class_info[i].static_traits.traits.length + instance_info[i].instance_traits.traits.length + 1); + } + out.println(toPrint); + }*/ + } + + //constructor + if (instance_info[i].iinit_index != 0) { + String modifier = ""; + Multiname m = constants.constant_multiname[instance_info[i].name_index]; + if (m != null) { + Namespace ns = m.getNamespace(constants); + if (ns != null) { + modifier = ns.getPrefix(constants) + " "; + if (modifier.equals(" ")) { + modifier = ""; + } + } + } + String constructorParams = method_info[instance_info[i].iinit_index].getParamStr(constants); + String bodyStr = ""; + int bodyIndex = findBodyIndex(instance_info[i].iinit_index); + if (bodyIndex != -1) { + bodyStr = addTabs(bodies[bodyIndex].toString(false, i, this, constants, method_info, highlight), 3); + } + String toPrint = IDENT_STRING + IDENT_STRING + modifier + "function " + constants.constant_multiname[instance_info[i].name_index].getName(constants) + "(" + constructorParams + ") {\r\n" + bodyStr + "\r\n" + IDENT_STRING + IDENT_STRING + "}"; + if (highlight) { + toPrint = Highlighting.hilighTrait(toPrint, class_info[i].static_traits.traits.length + instance_info[i].instance_traits.traits.length); + } + out.println(toPrint); + } + + //static variables,constants & methods + for (int ti = 0; ti < class_info[i].static_traits.traits.length; ti++) { + Trait t = class_info[i].static_traits.traits[ti]; + String toPrint = ""; + if (t instanceof TraitMethodGetterSetter) { + TraitMethodGetterSetter tm = (TraitMethodGetterSetter) t; + String bodyStr = ""; + int bodyIndex = findBodyIndex(tm.method_info); + if (bodyIndex != -1) { + bodyStr = addTabs(bodies[bodyIndex].toString(true, i, this, constants, method_info, highlight), 3); + } + toPrint = IDENT_STRING + IDENT_STRING + tm.convert(constants, method_info, true) + " {\r\n" + bodyStr + "\r\n" + IDENT_STRING + IDENT_STRING + "}"; + } + if (t instanceof TraitSlotConst) { + TraitSlotConst ts = (TraitSlotConst) t; + + toPrint = IDENT_STRING + IDENT_STRING + ts.convert(constants, method_info, true) + ";"; + } + if (highlight) { + toPrint = Highlighting.hilighTrait(toPrint, ti); + } else { + toPrint = Highlighting.stripHilights(toPrint); + } + out.println(toPrint); + } + for (int ti = 0; ti < instance_info[i].instance_traits.traits.length; ti++) { + Trait t = instance_info[i].instance_traits.traits[ti]; + String toPrint = ""; + if (t instanceof TraitSlotConst) { + TraitSlotConst ts = (TraitSlotConst) t; + toPrint = IDENT_STRING + IDENT_STRING + ts.convert(constants, method_info, false) + ";"; + } + + if (t instanceof TraitMethodGetterSetter) { + TraitMethodGetterSetter tm = (TraitMethodGetterSetter) t; + String bodyStr = ""; + int bodyIndex = findBodyIndex(tm.method_info); + if (bodyIndex != -1) { + bodyStr = addTabs(bodies[bodyIndex].toString(false, i, this, constants, method_info, highlight), 3); + } + toPrint = IDENT_STRING + IDENT_STRING + tm.convert(constants, method_info, false) + " {\r\n" + bodyStr + "\r\n" + IDENT_STRING + IDENT_STRING + "}"; + } + if (highlight) { + toPrint = Highlighting.hilighTrait(toPrint, class_info[i].static_traits.traits.length + ti); + } else { + toPrint = Highlighting.stripHilights(toPrint); + } + out.println(toPrint); + } + + + out.println(IDENT_STRING + "}");//class + out.println("}");//package + out.flush(); + + return baos.toString(); + } + + public void export(String directory) throws IOException { + for (int i = 0; i < instance_info.length; i++) { + String packageName = instance_info[i].getName(constants).getNamespace(constants).getName(constants); + String className = instance_info[i].getName(constants).getName(constants); + Main.startWork("Exporting " + (i + 1) + "/" + instance_info.length + " " + packageName + "." + className + "..."); + File outDir = new File(directory + File.separatorChar + packageName.replace('.', File.separatorChar)); + if (!outDir.exists()) { + outDir.mkdirs(); + } + String fileName = outDir.toString() + File.separator + className + ".as"; + FileOutputStream fos = new FileOutputStream(fileName); + fos.write(classToString(i, false).getBytes()); + fos.close(); + } + + } + + public void dump(OutputStream os) { + PrintStream output = new PrintStream(os); + constants.dump(output); + for (int i = 0; i < method_info.length; i++) { + output.println("MethodInfo[" + i + "]:" + method_info[i].toString(constants)); + } + for (int i = 0; i < metadata_info.length; i++) { + output.println("MetadataInfo[" + i + "]:" + metadata_info[i].toString(constants)); + } + for (int i = 0; i < instance_info.length; i++) { + output.println("InstanceInfo[" + i + "]:" + instance_info[i].toString(constants)); + } + for (int i = 0; i < class_info.length; i++) { + output.println("ClassInfo[" + i + "]:" + class_info[i].toString(constants)); + } + for (int i = 0; i < script_info.length; i++) { + output.println("ScriptInfo[" + i + "]:" + script_info[i].toString(constants)); + } + for (int i = 0; i < bodies.length; i++) { + output.println("MethodBody[" + i + "]:"); //+ bodies[i].toString(this, constants, method_info)); + } + } + + public static final String[] reservedWords = { + "as", "break", "case", "catch", "class", "const", "continue", /*"default",*/ "delete", "do", "each", "else", + "extends", "false", "finally", "for", "function", "if", "implements", "import", "in", "instanceof", + "interface", "internal", "is", "native", "new", "null", "package", "private", "protected", "public", + "return", "super", "switch", "this", "throw", "true", "try", "typeof", "use", "var", /*"void",*/ "while", + "with"}; + public int unknownCount = 0; + + public void cleanOneName(int index) { + cleanNamespace(index); + } + + public void cleanNamespace(int index) { + if (index <= 0) { + return; + } + String s = constants.constant_string[index]; + boolean isValid = true; + boolean isReserved = false; + for (String rw : reservedWords) { + if (rw.equals(s.trim())) { + isValid = false; + isReserved = true; + break; + } + } + if (isValid) { + for (int i = 0; i < s.length(); i++) { + if (s.charAt(i) > 127) { + isValid = false; + break; + } + } + } + + if (!isValid) { + if (isReserved) { + constants.constant_string[index] = "name_" + s.replace(" ", "_"); + } else { + unknownCount++; + constants.constant_string[index] = "_name" + unknownCount; + } + } + } + + //public +} diff --git a/trunk/src/com/jpexs/asdec/abc/ABCInputStream.java b/trunk/src/com/jpexs/asdec/abc/ABCInputStream.java index 7b763fdc9..07df548d0 100644 --- a/trunk/src/com/jpexs/asdec/abc/ABCInputStream.java +++ b/trunk/src/com/jpexs/asdec/abc/ABCInputStream.java @@ -1,304 +1,318 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc; - -import com.jpexs.asdec.abc.types.*; -import com.jpexs.asdec.abc.types.traits.*; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - - -public class ABCInputStream extends InputStream { - - private InputStream is; - private long bytesRead = 0; - private ByteArrayOutputStream bufferOs = null; - - public void startBuffer() { - bufferOs = new ByteArrayOutputStream(); - } - - public byte[] stopBuffer() { - if (bufferOs == null) return new byte[0]; - byte ret[] = bufferOs.toByteArray(); - bufferOs = null; - return ret; - } - - public ABCInputStream(InputStream is) { - this.is = is; - } - - @Override - public int read() throws IOException { - bytesRead++; - int i = is.read(); - if (bufferOs != null) { - if (i != -1) - bufferOs.write(i); - } - return i; - } - - public int readU8() throws IOException { - return read(); - } - - public int readU32() throws IOException { - int i = 0; - int ret = 0; - int bytePos = 0; - int byteCount = 0; - boolean nextByte = false; - do { - i = read(); - nextByte = (i >> 7) == 1; - i = i & 0x7f; - ret = ret + (i << bytePos); - byteCount++; - bytePos += 7; - } while (nextByte); - return ret; - } - - public int readU30() throws IOException { - return readU32(); - } - - public int readS24() throws IOException { - int ret = (read()) + (read() << 8) + (read() << 16); - - if ((ret >> 23) == 1) { - ret = ret | 0xff000000; - } - - return ret; - } - - public int readU16() throws IOException { - return (read()) + (read() << 8); - } - - public long readS32() throws IOException { - int i = 0; - long ret = 0; - int bytePos = 0; - int byteCount = 0; - boolean nextByte = false; - do { - i = read(); - nextByte = (i >> 7) == 1; - i = i & 0x7f; - ret = ret + (i << bytePos); - byteCount++; - bytePos += 7; - if (bytePos == 35) { - if ((ret >> 31) == 1) - ret = -(ret & 0x7fffffff); - break; - } - } while (nextByte); - return ret; - } - - @Override - public int available() throws IOException { - return is.available(); - } - - - public final long readLong() throws IOException { - byte readBuffer[] = safeRead(8); - return (((long) readBuffer[7] << 56) + - ((long) (readBuffer[6] & 255) << 48) + - ((long) (readBuffer[5] & 255) << 40) + - ((long) (readBuffer[4] & 255) << 32) + - ((long) (readBuffer[3] & 255) << 24) + - ((readBuffer[2] & 255) << 16) + - ((readBuffer[1] & 255) << 8) + - ((readBuffer[0] & 255) << 0)); - } - - public double readDouble() throws IOException { - long el = readLong(); - double ret = Double.longBitsToDouble(el); - return ret; - } - - - private byte[] safeRead(int count) throws IOException { - byte ret[] = new byte[count]; - for (int i = 0; i < count; i++) { - ret[i] = (byte) read(); - } - return ret; - } - - public Namespace readNamespace() throws IOException { - int kind = read(); - int name_index = 0; - for (int k = 0; k < Namespace.nameSpaceKinds.length; k++) { - if (Namespace.nameSpaceKinds[k] == kind) { - name_index = readU30(); - break; - } - } - return new Namespace(kind, name_index); - } - - public Multiname readMultiname() throws IOException { - int kind = read(); - int namespace_index = -1; - int name_index = -1; - int namespace_set_index = -1; - - if ((kind == 7) || (kind == 0xd)) { // CONSTANT_QName and CONSTANT_QNameA. - namespace_index = readU30(); - name_index = readU30(); - } - if ((kind == 9) || (kind == 0xe)) { // CONSTANT_Multiname and CONSTANT_MultinameA. - name_index = readU30(); - namespace_set_index = readU30(); - } - if ((kind == 0xf) || (kind == 0x10)) { //CONSTANT_RTQName and CONSTANT_RTQNameA - name_index = readU30(); - } - if ((kind == 0x1B) || (kind == 0x1C)) { //CONSTANT_MultinameL and CONSTANT_MultinameLA - namespace_set_index = readU30(); - } - //kind==0x11,0x12 nothing CONSTANT_RTQNameL and CONSTANT_RTQNameLA. - return new Multiname(kind, name_index, namespace_index, namespace_set_index); - } - - public MethodInfo readMethodInfo() throws IOException { - int param_count = readU30(); - int ret_type = readU30(); - int param_types[] = new int[param_count]; - for (int i = 0; i < param_count; i++) { - param_types[i] = readU30(); - } - int name_index = readU30(); - int flags = read(); - - //// 1=need_arguments, 2=need_activation, 4=need_rest 8=has_optional (16=ignore_rest, 32=explicit,) 64=setsdxns, 128=has_paramnames - - ValueKind optional[] = new ValueKind[0]; - if ((flags & 8) == 8) { //if has_optional - int optional_count = readU30(); - optional = new ValueKind[optional_count]; - for (int i = 0; i < optional_count; i++) { - optional[i] = new ValueKind(readU30(), read()); - } - } - - int param_names[] = new int[param_count]; - if ((flags & 128) == 128) { //if has_paramnames - for (int i = 0; i < param_count; i++) { - param_names[i] = readU30(); - } - } - return new MethodInfo(param_types, ret_type, name_index, flags, optional, param_names); - } - - public Trait readTrait() throws IOException { - long pos = getPosition(); - startBuffer(); - int name_index = readU30(); - int kind = read(); - int kindType = 0xf & kind; - int kindFlags = kind >> 4; - Trait trait = new Trait(); - - switch (kindType) { - case 0: //slot - case 6: //const - TraitSlotConst t1 = new TraitSlotConst(); - t1.slot_id = readU30(); - t1.type_index = readU30(); - t1.value_index = readU30(); - if (t1.value_index != 0) - t1.value_kind = read(); - trait = t1; - break; - case 1: //method - case 2: //getter - case 3: //setter - TraitMethodGetterSetter t2 = new TraitMethodGetterSetter(); - t2.disp_id = readU30(); - t2.method_info = readU30(); - trait = t2; - break; - case 4: //class - TraitClass t3 = new TraitClass(); - t3.slot_id = readU30(); - t3.class_info = readU30(); - trait = t3; - break; - case 5: //function - TraitFunction t4 = new TraitFunction(); - t4.slot_index = readU30(); - t4.method_info = readU30(); - trait = t4; - break; - } - trait.fileOffset = pos; - trait.kindType = kindType; - trait.kindFlags = kindFlags; - trait.name_index = name_index; - if ((kindFlags & 4) == 4) { - int metadata_count = readU30(); - trait.metadata = new int[metadata_count]; - for (int i = 0; i < metadata_count; i++) { - trait.metadata[i] = readU30(); - } - } - trait.bytes = stopBuffer(); - return trait; - } - - public Traits readTraits() throws IOException { - int count = readU30(); - Traits traits = new Traits(); - traits.traits = new Trait[count]; - for (int i = 0; i < count; i++) { - traits.traits[i] = readTrait(); - } - return traits; - } - - public InstanceInfo readInstanceInfo() throws IOException { - InstanceInfo ret = new InstanceInfo(); - ret.name_index = readU30(); - ret.super_index = readU30(); - ret.flags = read(); - if ((ret.flags & 8) == 8) { - ret.protectedNS = readU30(); - } - int interfaces_count = readU30(); - ret.interfaces = new int[interfaces_count]; - for (int i = 0; i < interfaces_count; i++) { - ret.interfaces[i] = readU30(); - } - ret.iinit_index = readU30(); - ret.instance_traits = readTraits(); - return ret; - } - - public String readString() throws IOException { - int length = readU30(); - return new String(safeRead(length), "utf8"); - } - - - /*public void markStart(){ - bytesRead=0; - }*/ - - public long getPosition() { - return bytesRead; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc; + +import com.jpexs.asdec.abc.types.*; +import com.jpexs.asdec.abc.types.traits.*; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + + +public class ABCInputStream extends InputStream { + + private InputStream is; + private long bytesRead = 0; + private ByteArrayOutputStream bufferOs = null; + + public void startBuffer() { + bufferOs = new ByteArrayOutputStream(); + } + + public byte[] stopBuffer() { + if (bufferOs == null) return new byte[0]; + byte ret[] = bufferOs.toByteArray(); + bufferOs = null; + return ret; + } + + public ABCInputStream(InputStream is) { + this.is = is; + } + + @Override + public int read() throws IOException { + bytesRead++; + int i = is.read(); + if (bufferOs != null) { + if (i != -1) + bufferOs.write(i); + } + return i; + } + + public int readU8() throws IOException { + return read(); + } + + public int readU32() throws IOException { + int i = 0; + int ret = 0; + int bytePos = 0; + int byteCount = 0; + boolean nextByte = false; + do { + i = read(); + nextByte = (i >> 7) == 1; + i = i & 0x7f; + ret = ret + (i << bytePos); + byteCount++; + bytePos += 7; + } while (nextByte); + return ret; + } + + public int readU30() throws IOException { + return readU32(); + } + + public int readS24() throws IOException { + int ret = (read()) + (read() << 8) + (read() << 16); + + if ((ret >> 23) == 1) { + ret = ret | 0xff000000; + } + + return ret; + } + + public int readU16() throws IOException { + return (read()) + (read() << 8); + } + + public long readS32() throws IOException { + int i = 0; + long ret = 0; + int bytePos = 0; + int byteCount = 0; + boolean nextByte = false; + do { + i = read(); + nextByte = (i >> 7) == 1; + i = i & 0x7f; + ret = ret + (i << bytePos); + byteCount++; + bytePos += 7; + if (bytePos == 35) { + if ((ret >> 31) == 1) + ret = -(ret & 0x7fffffff); + break; + } + } while (nextByte); + return ret; + } + + @Override + public int available() throws IOException { + return is.available(); + } + + + public final long readLong() throws IOException { + byte readBuffer[] = safeRead(8); + return (((long) readBuffer[7] << 56) + + ((long) (readBuffer[6] & 255) << 48) + + ((long) (readBuffer[5] & 255) << 40) + + ((long) (readBuffer[4] & 255) << 32) + + ((long) (readBuffer[3] & 255) << 24) + + ((readBuffer[2] & 255) << 16) + + ((readBuffer[1] & 255) << 8) + + ((readBuffer[0] & 255) << 0)); + } + + public double readDouble() throws IOException { + long el = readLong(); + double ret = Double.longBitsToDouble(el); + return ret; + } + + + private byte[] safeRead(int count) throws IOException { + byte ret[] = new byte[count]; + for (int i = 0; i < count; i++) { + ret[i] = (byte) read(); + } + return ret; + } + + public Namespace readNamespace() throws IOException { + int kind = read(); + int name_index = 0; + for (int k = 0; k < Namespace.nameSpaceKinds.length; k++) { + if (Namespace.nameSpaceKinds[k] == kind) { + name_index = readU30(); + break; + } + } + return new Namespace(kind, name_index); + } + + public Multiname readMultiname() throws IOException { + int kind = read(); + int namespace_index = -1; + int name_index = -1; + int namespace_set_index = -1; + + if ((kind == 7) || (kind == 0xd)) { // CONSTANT_QName and CONSTANT_QNameA. + namespace_index = readU30(); + name_index = readU30(); + } + if ((kind == 9) || (kind == 0xe)) { // CONSTANT_Multiname and CONSTANT_MultinameA. + name_index = readU30(); + namespace_set_index = readU30(); + } + if ((kind == 0xf) || (kind == 0x10)) { //CONSTANT_RTQName and CONSTANT_RTQNameA + name_index = readU30(); + } + if ((kind == 0x1B) || (kind == 0x1C)) { //CONSTANT_MultinameL and CONSTANT_MultinameLA + namespace_set_index = readU30(); + } + //kind==0x11,0x12 nothing CONSTANT_RTQNameL and CONSTANT_RTQNameLA. + return new Multiname(kind, name_index, namespace_index, namespace_set_index); + } + + public MethodInfo readMethodInfo() throws IOException { + int param_count = readU30(); + int ret_type = readU30(); + int param_types[] = new int[param_count]; + for (int i = 0; i < param_count; i++) { + param_types[i] = readU30(); + } + int name_index = readU30(); + int flags = read(); + + //// 1=need_arguments, 2=need_activation, 4=need_rest 8=has_optional (16=ignore_rest, 32=explicit,) 64=setsdxns, 128=has_paramnames + + ValueKind optional[] = new ValueKind[0]; + if ((flags & 8) == 8) { //if has_optional + int optional_count = readU30(); + optional = new ValueKind[optional_count]; + for (int i = 0; i < optional_count; i++) { + optional[i] = new ValueKind(readU30(), read()); + } + } + + int param_names[] = new int[param_count]; + if ((flags & 128) == 128) { //if has_paramnames + for (int i = 0; i < param_count; i++) { + param_names[i] = readU30(); + } + } + return new MethodInfo(param_types, ret_type, name_index, flags, optional, param_names); + } + + public Trait readTrait() throws IOException { + long pos = getPosition(); + startBuffer(); + int name_index = readU30(); + int kind = read(); + int kindType = 0xf & kind; + int kindFlags = kind >> 4; + Trait trait = new Trait(); + + switch (kindType) { + case 0: //slot + case 6: //const + TraitSlotConst t1 = new TraitSlotConst(); + t1.slot_id = readU30(); + t1.type_index = readU30(); + t1.value_index = readU30(); + if (t1.value_index != 0) + t1.value_kind = read(); + trait = t1; + break; + case 1: //method + case 2: //getter + case 3: //setter + TraitMethodGetterSetter t2 = new TraitMethodGetterSetter(); + t2.disp_id = readU30(); + t2.method_info = readU30(); + trait = t2; + break; + case 4: //class + TraitClass t3 = new TraitClass(); + t3.slot_id = readU30(); + t3.class_info = readU30(); + trait = t3; + break; + case 5: //function + TraitFunction t4 = new TraitFunction(); + t4.slot_index = readU30(); + t4.method_info = readU30(); + trait = t4; + break; + } + trait.fileOffset = pos; + trait.kindType = kindType; + trait.kindFlags = kindFlags; + trait.name_index = name_index; + if ((kindFlags & 4) == 4) { + int metadata_count = readU30(); + trait.metadata = new int[metadata_count]; + for (int i = 0; i < metadata_count; i++) { + trait.metadata[i] = readU30(); + } + } + trait.bytes = stopBuffer(); + return trait; + } + + public Traits readTraits() throws IOException { + int count = readU30(); + Traits traits = new Traits(); + traits.traits = new Trait[count]; + for (int i = 0; i < count; i++) { + traits.traits[i] = readTrait(); + } + return traits; + } + + public InstanceInfo readInstanceInfo() throws IOException { + InstanceInfo ret = new InstanceInfo(); + ret.name_index = readU30(); + ret.super_index = readU30(); + ret.flags = read(); + if ((ret.flags & 8) == 8) { + ret.protectedNS = readU30(); + } + int interfaces_count = readU30(); + ret.interfaces = new int[interfaces_count]; + for (int i = 0; i < interfaces_count; i++) { + ret.interfaces[i] = readU30(); + } + ret.iinit_index = readU30(); + ret.instance_traits = readTraits(); + return ret; + } + + public String readString() throws IOException { + int length = readU30(); + return new String(safeRead(length), "utf8"); + } + + + /*public void markStart(){ + bytesRead=0; + }*/ + + public long getPosition() { + return bytesRead; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/ABCOutputStream.java b/trunk/src/com/jpexs/asdec/abc/ABCOutputStream.java index 68b10a350..000e956fb 100644 --- a/trunk/src/com/jpexs/asdec/abc/ABCOutputStream.java +++ b/trunk/src/com/jpexs/asdec/abc/ABCOutputStream.java @@ -1,253 +1,267 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc; - -import com.jpexs.asdec.abc.types.InstanceInfo; -import com.jpexs.asdec.abc.types.MethodInfo; -import com.jpexs.asdec.abc.types.Multiname; -import com.jpexs.asdec.abc.types.Namespace; -import com.jpexs.asdec.abc.types.traits.*; - -import java.io.IOException; -import java.io.OutputStream; - -public class ABCOutputStream extends OutputStream { - - private OutputStream os; - - public ABCOutputStream(OutputStream os) { - this.os = os; - } - - @Override - public void write(int b) throws IOException { - os.write(b); - } - - public void writeU30(long value) throws IOException { - writeS32(value); - /*boolean loop = true; - boolean underZero=value<0; - - if(underZero){ - value = value & 0xFFFFFFFF; - }else{ - value = value & 0x7FFFFFFF; - } - do { - int ret = (int) (value & 0x7F); - if (value < 0x80) { - loop = false; - } - if (value > 0x7F) { - ret += 0x80; - } - write(ret); - value = value >> 7; - } while (loop); -*/ - } - - public void writeU32(long value) throws IOException { - boolean loop = true; - value = value & 0xFFFFFFFF; - do { - int ret = (int) (value & 0x7F); - if (value < 0x80) { - loop = false; - } - if (value > 0x7F) { - ret += 0x80; - } - write(ret); - value = value >> 7; - } while (loop); - } - - public void writeS24(long value) throws IOException { - int ret = (int) (value & 0xff); - write(ret); - value = value >> 8; - ret = (int) (value & 0xff); - write(ret); - value = value >> 8; - ret = (int) (value & 0xff); - write(ret); - value = value >> 8; - } - - public void writeS32(long value) throws IOException { - boolean belowZero = value < 0; - /*if (belowZero) { - value = -value; - }*/ - int bitcount = 0; - boolean loop = true; - //value = value & 0xFFFFFFFF; - do { - bitcount += 7; - int ret = (int) (value & 0x7F); - if (value < 0x80) { - if (belowZero) { //&& bitcount < 35 - ret += 0x80; - } else { - loop = false; - } - } else { - ret += 0x80; - } - - if (bitcount == 35) { - ret = ret & 0xf; - } - write(ret); - if (bitcount == 35) { - break; - } - value = value >> 7; - } while (loop); - } - - public void writeLong(long value) throws IOException { - byte writeBuffer[] = new byte[8]; - writeBuffer[7] = (byte) (value >>> 56); - writeBuffer[6] = (byte) (value >>> 48); - writeBuffer[5] = (byte) (value >>> 40); - writeBuffer[4] = (byte) (value >>> 32); - writeBuffer[3] = (byte) (value >>> 24); - writeBuffer[2] = (byte) (value >>> 16); - writeBuffer[1] = (byte) (value >>> 8); - writeBuffer[0] = (byte) (value >>> 0); - write(writeBuffer); - } - - public void writeDouble(double value) throws IOException { - writeLong(Double.doubleToLongBits(value)); - } - - public void writeU8(int value) throws IOException { - write(value); - } - - public void writeU16(int value) throws IOException { - write(value & 0xff); - write((value >> 8) & 0xff); - } - - public void writeString(String s) throws IOException { - byte sbytes[] = s.getBytes("utf8"); - writeU30(sbytes.length); - write(sbytes); - } - - public void writeNamespace(Namespace ns) throws IOException { - write(ns.kind); - for (int k = 0; k < Namespace.nameSpaceKinds.length; k++) { - if (Namespace.nameSpaceKinds[k] == ns.kind) { - writeU30(ns.name_index); - break; - } - } - } - - public void writeMultiname(Multiname m) throws IOException { - write(m.kind); - if ((m.kind == 7) || (m.kind == 0xd)) { // CONSTANT_QName and CONSTANT_QNameA. - writeU30(m.namespace_index); - writeU30(m.name_index); - } - if ((m.kind == 9) || (m.kind == 0xe)) { // CONSTANT_Multiname and CONSTANT_MultinameA. - writeU30(m.name_index); - writeU30(m.namespace_set_index); - } - if ((m.kind == 0xf) || (m.kind == 0x10)) { //CONSTANT_RTQName and CONSTANT_RTQNameA - writeU30(m.name_index); - } - if ((m.kind == 0x1B) || (m.kind == 0x1C)) { //CONSTANT_MultinameL and CONSTANT_MultinameLA - writeU30(m.namespace_set_index); - } - //kind==0x11,0x12 nothing CONSTANT_RTQNameL and CONSTANT_RTQNameLA. - } - - public void writeMethodInfo(MethodInfo mi) throws IOException { - writeU30(mi.param_types.length); - writeU30(mi.ret_type); - for (int i = 0; i < mi.param_types.length; i++) { - writeU30(mi.param_types[i]); - } - writeU30(mi.name_index); - write(mi.flags); - if ((mi.flags & 8) == 8) { - writeU30(mi.optional.length); - for (int i = 0; i < mi.optional.length; i++) { - writeU30(mi.optional[i].value_index); - write(mi.optional[i].value_kind); - } - } - - if ((mi.flags & 128) == 128) { //if has_paramnames - for (int i = 0; i < mi.paramNames.length; i++) { - writeU30(mi.paramNames[i]); - } - } - } - - public void writeTrait(Trait t) throws IOException { - writeU30(t.name_index); - write((t.kindFlags << 4) + t.kindType); - if (t instanceof TraitSlotConst) { - TraitSlotConst t1 = (TraitSlotConst) t; - writeU30(t1.slot_id); - writeU30(t1.type_index); - writeU30(t1.value_index); - if (t1.value_index != 0) { - write(t1.value_kind); - } - } - if (t instanceof TraitMethodGetterSetter) { - TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t; - writeU30(t2.disp_id); - writeU30(t2.method_info); - } - if (t instanceof TraitClass) { - TraitClass t3 = (TraitClass) t; - writeU30(t3.slot_id); - writeU30(t3.class_info); - } - if (t instanceof TraitFunction) { - TraitFunction t4 = (TraitFunction) t; - writeU30(t4.slot_index); - writeU30(t4.method_info); - } - if ((t.kindFlags & 4) == 4) { - writeU30(t.metadata.length); - for (int i = 0; i < t.metadata.length; i++) { - writeU30(t.metadata[i]); - } - } - } - - public void writeTraits(Traits t) throws IOException { - writeU30(t.traits.length); - for (int i = 0; i < t.traits.length; i++) { - writeTrait(t.traits[i]); - } - } - - public void writeInstanceInfo(InstanceInfo ii) throws IOException { - writeU30(ii.name_index); - writeU30(ii.super_index); - write(ii.flags); - if ((ii.flags & 8) == 8) { - writeU30(ii.protectedNS); - } - writeU30(ii.interfaces.length); - for (int i = 0; i < ii.interfaces.length; i++) { - writeU30(ii.interfaces[i]); - } - writeU30(ii.iinit_index); - writeTraits(ii.instance_traits); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc; + +import com.jpexs.asdec.abc.types.InstanceInfo; +import com.jpexs.asdec.abc.types.MethodInfo; +import com.jpexs.asdec.abc.types.Multiname; +import com.jpexs.asdec.abc.types.Namespace; +import com.jpexs.asdec.abc.types.traits.*; + +import java.io.IOException; +import java.io.OutputStream; + +public class ABCOutputStream extends OutputStream { + + private OutputStream os; + + public ABCOutputStream(OutputStream os) { + this.os = os; + } + + @Override + public void write(int b) throws IOException { + os.write(b); + } + + public void writeU30(long value) throws IOException { + writeS32(value); + /*boolean loop = true; + boolean underZero=value<0; + + if(underZero){ + value = value & 0xFFFFFFFF; + }else{ + value = value & 0x7FFFFFFF; + } + do { + int ret = (int) (value & 0x7F); + if (value < 0x80) { + loop = false; + } + if (value > 0x7F) { + ret += 0x80; + } + write(ret); + value = value >> 7; + } while (loop); +*/ + } + + public void writeU32(long value) throws IOException { + boolean loop = true; + value = value & 0xFFFFFFFF; + do { + int ret = (int) (value & 0x7F); + if (value < 0x80) { + loop = false; + } + if (value > 0x7F) { + ret += 0x80; + } + write(ret); + value = value >> 7; + } while (loop); + } + + public void writeS24(long value) throws IOException { + int ret = (int) (value & 0xff); + write(ret); + value = value >> 8; + ret = (int) (value & 0xff); + write(ret); + value = value >> 8; + ret = (int) (value & 0xff); + write(ret); + value = value >> 8; + } + + public void writeS32(long value) throws IOException { + boolean belowZero = value < 0; + /*if (belowZero) { + value = -value; + }*/ + int bitcount = 0; + boolean loop = true; + //value = value & 0xFFFFFFFF; + do { + bitcount += 7; + int ret = (int) (value & 0x7F); + if (value < 0x80) { + if (belowZero) { //&& bitcount < 35 + ret += 0x80; + } else { + loop = false; + } + } else { + ret += 0x80; + } + + if (bitcount == 35) { + ret = ret & 0xf; + } + write(ret); + if (bitcount == 35) { + break; + } + value = value >> 7; + } while (loop); + } + + public void writeLong(long value) throws IOException { + byte writeBuffer[] = new byte[8]; + writeBuffer[7] = (byte) (value >>> 56); + writeBuffer[6] = (byte) (value >>> 48); + writeBuffer[5] = (byte) (value >>> 40); + writeBuffer[4] = (byte) (value >>> 32); + writeBuffer[3] = (byte) (value >>> 24); + writeBuffer[2] = (byte) (value >>> 16); + writeBuffer[1] = (byte) (value >>> 8); + writeBuffer[0] = (byte) (value >>> 0); + write(writeBuffer); + } + + public void writeDouble(double value) throws IOException { + writeLong(Double.doubleToLongBits(value)); + } + + public void writeU8(int value) throws IOException { + write(value); + } + + public void writeU16(int value) throws IOException { + write(value & 0xff); + write((value >> 8) & 0xff); + } + + public void writeString(String s) throws IOException { + byte sbytes[] = s.getBytes("utf8"); + writeU30(sbytes.length); + write(sbytes); + } + + public void writeNamespace(Namespace ns) throws IOException { + write(ns.kind); + for (int k = 0; k < Namespace.nameSpaceKinds.length; k++) { + if (Namespace.nameSpaceKinds[k] == ns.kind) { + writeU30(ns.name_index); + break; + } + } + } + + public void writeMultiname(Multiname m) throws IOException { + write(m.kind); + if ((m.kind == 7) || (m.kind == 0xd)) { // CONSTANT_QName and CONSTANT_QNameA. + writeU30(m.namespace_index); + writeU30(m.name_index); + } + if ((m.kind == 9) || (m.kind == 0xe)) { // CONSTANT_Multiname and CONSTANT_MultinameA. + writeU30(m.name_index); + writeU30(m.namespace_set_index); + } + if ((m.kind == 0xf) || (m.kind == 0x10)) { //CONSTANT_RTQName and CONSTANT_RTQNameA + writeU30(m.name_index); + } + if ((m.kind == 0x1B) || (m.kind == 0x1C)) { //CONSTANT_MultinameL and CONSTANT_MultinameLA + writeU30(m.namespace_set_index); + } + //kind==0x11,0x12 nothing CONSTANT_RTQNameL and CONSTANT_RTQNameLA. + } + + public void writeMethodInfo(MethodInfo mi) throws IOException { + writeU30(mi.param_types.length); + writeU30(mi.ret_type); + for (int i = 0; i < mi.param_types.length; i++) { + writeU30(mi.param_types[i]); + } + writeU30(mi.name_index); + write(mi.flags); + if ((mi.flags & 8) == 8) { + writeU30(mi.optional.length); + for (int i = 0; i < mi.optional.length; i++) { + writeU30(mi.optional[i].value_index); + write(mi.optional[i].value_kind); + } + } + + if ((mi.flags & 128) == 128) { //if has_paramnames + for (int i = 0; i < mi.paramNames.length; i++) { + writeU30(mi.paramNames[i]); + } + } + } + + public void writeTrait(Trait t) throws IOException { + writeU30(t.name_index); + write((t.kindFlags << 4) + t.kindType); + if (t instanceof TraitSlotConst) { + TraitSlotConst t1 = (TraitSlotConst) t; + writeU30(t1.slot_id); + writeU30(t1.type_index); + writeU30(t1.value_index); + if (t1.value_index != 0) { + write(t1.value_kind); + } + } + if (t instanceof TraitMethodGetterSetter) { + TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t; + writeU30(t2.disp_id); + writeU30(t2.method_info); + } + if (t instanceof TraitClass) { + TraitClass t3 = (TraitClass) t; + writeU30(t3.slot_id); + writeU30(t3.class_info); + } + if (t instanceof TraitFunction) { + TraitFunction t4 = (TraitFunction) t; + writeU30(t4.slot_index); + writeU30(t4.method_info); + } + if ((t.kindFlags & 4) == 4) { + writeU30(t.metadata.length); + for (int i = 0; i < t.metadata.length; i++) { + writeU30(t.metadata[i]); + } + } + } + + public void writeTraits(Traits t) throws IOException { + writeU30(t.traits.length); + for (int i = 0; i < t.traits.length; i++) { + writeTrait(t.traits[i]); + } + } + + public void writeInstanceInfo(InstanceInfo ii) throws IOException { + writeU30(ii.name_index); + writeU30(ii.super_index); + write(ii.flags); + if ((ii.flags & 8) == 8) { + writeU30(ii.protectedNS); + } + writeU30(ii.interfaces.length); + for (int i = 0; i < ii.interfaces.length; i++) { + writeU30(ii.interfaces[i]); + } + writeU30(ii.iinit_index); + writeTraits(ii.instance_traits); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/CopyOutputStream.java b/trunk/src/com/jpexs/asdec/abc/CopyOutputStream.java index 9e5d1416b..febb7a824 100644 --- a/trunk/src/com/jpexs/asdec/abc/CopyOutputStream.java +++ b/trunk/src/com/jpexs/asdec/abc/CopyOutputStream.java @@ -1,54 +1,68 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -public class CopyOutputStream extends OutputStream { - private OutputStream os; - private InputStream is; - private long pos = 0; - private int TEMPSIZE = 5; - private int temp[] = new int[TEMPSIZE]; - private int tempPos = 0; - - public CopyOutputStream(OutputStream os, InputStream is) { - this.os = os; - this.is = is; - } - - @Override - public void write(int b) throws IOException { - temp[tempPos] = b; - tempPos = (tempPos + 1) % TEMPSIZE; - - pos++; - int r = is.read(); - if ((b & 0xff) != r) { - os.flush(); - - boolean output = false; - - if (output) { - System.out.print("Last written:"); - for (int i = 0; i < TEMPSIZE; i++) { - System.out.print("" + Integer.toHexString(temp[(tempPos + i) % TEMPSIZE]) + " "); - } - System.out.println(""); - System.out.println("More expected:"); - for (int i = 0; i < TEMPSIZE; i++) { - System.out.println("" + Integer.toHexString(is.read())); - } - - System.out.println(""); - System.out.println(Integer.toHexString(r) + " expected but " + Integer.toHexString(b) + " found"); - } - throw new NotSameException(pos); - } - os.write(b); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +public class CopyOutputStream extends OutputStream { + private OutputStream os; + private InputStream is; + private long pos = 0; + private int TEMPSIZE = 5; + private int temp[] = new int[TEMPSIZE]; + private int tempPos = 0; + + public CopyOutputStream(OutputStream os, InputStream is) { + this.os = os; + this.is = is; + } + + @Override + public void write(int b) throws IOException { + temp[tempPos] = b; + tempPos = (tempPos + 1) % TEMPSIZE; + + pos++; + int r = is.read(); + if ((b & 0xff) != r) { + os.flush(); + + boolean output = false; + + if (output) { + System.out.print("Last written:"); + for (int i = 0; i < TEMPSIZE; i++) { + System.out.print("" + Integer.toHexString(temp[(tempPos + i) % TEMPSIZE]) + " "); + } + System.out.println(""); + System.out.println("More expected:"); + for (int i = 0; i < TEMPSIZE; i++) { + System.out.println("" + Integer.toHexString(is.read())); + } + + System.out.println(""); + System.out.println(Integer.toHexString(r) + " expected but " + Integer.toHexString(b) + " found"); + } + throw new NotSameException(pos); + } + os.write(b); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/NotSameException.java b/trunk/src/com/jpexs/asdec/abc/NotSameException.java index 568cd8791..833515d2a 100644 --- a/trunk/src/com/jpexs/asdec/abc/NotSameException.java +++ b/trunk/src/com/jpexs/asdec/abc/NotSameException.java @@ -1,12 +1,26 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc; - - -public class NotSameException extends RuntimeException { - public NotSameException(long pos) { - super("Streams are not the same at pos:" + pos); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc; + + +public class NotSameException extends RuntimeException { + public NotSameException(long pos) { + super("Streams are not the same at pos:" + pos); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/Usage.java b/trunk/src/com/jpexs/asdec/abc/Usage.java new file mode 100644 index 000000000..6e28f9945 --- /dev/null +++ b/trunk/src/com/jpexs/asdec/abc/Usage.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc; + +/** + * + * @author JPEXS + */ +public class Usage { + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/AVM2Code.java b/trunk/src/com/jpexs/asdec/abc/avm2/AVM2Code.java index dc1101aa7..d43756d28 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/AVM2Code.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/AVM2Code.java @@ -1,1681 +1,1695 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2; - -import com.jpexs.asdec.abc.ABC; -import com.jpexs.asdec.abc.ABCInputStream; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.arithmetic.*; -import com.jpexs.asdec.abc.avm2.instructions.bitwise.*; -import com.jpexs.asdec.abc.avm2.instructions.comparsion.*; -import com.jpexs.asdec.abc.avm2.instructions.construction.*; -import com.jpexs.asdec.abc.avm2.instructions.debug.DebugFileIns; -import com.jpexs.asdec.abc.avm2.instructions.debug.DebugIns; -import com.jpexs.asdec.abc.avm2.instructions.debug.DebugLineIns; -import com.jpexs.asdec.abc.avm2.instructions.executing.*; -import com.jpexs.asdec.abc.avm2.instructions.jumps.*; -import com.jpexs.asdec.abc.avm2.instructions.localregs.*; -import com.jpexs.asdec.abc.avm2.instructions.other.*; -import com.jpexs.asdec.abc.avm2.instructions.stack.*; -import com.jpexs.asdec.abc.avm2.instructions.types.*; -import com.jpexs.asdec.abc.avm2.instructions.xml.*; -import com.jpexs.asdec.abc.avm2.treemodel.*; -import com.jpexs.asdec.abc.avm2.treemodel.clauses.*; -import com.jpexs.asdec.abc.avm2.treemodel.operations.AndTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.OrTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.PreDecrementTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.PreIncrementTreeItem; -import com.jpexs.asdec.abc.types.ABCException; -import com.jpexs.asdec.abc.types.MethodBody; -import com.jpexs.asdec.abc.types.MethodInfo; -import com.jpexs.asdec.helpers.Helper; -import com.jpexs.asdec.helpers.Highlighting; - -import java.io.*; -import java.util.*; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - - -public class AVM2Code { - - public List code = new LinkedList(); - public static final int OPT_U30 = 0x100; - public static final int OPT_U8 = 0x200; - public static final int OPT_S24 = 0x300; - public static final int OPT_CASE_OFFSETS = 0x400; - public static final int OPT_BYTE = 0x500; - public static final int DAT_MULTINAME_INDEX = OPT_U30 + 0x01; - public static final int DAT_ARG_COUNT = OPT_U30 + 0x02; - public static final int DAT_METHOD_INDEX = OPT_U30 + 0x03; - public static final int DAT_STRING_INDEX = OPT_U30 + 0x04; - public static final int DAT_DEBUG_TYPE = OPT_U8 + 0x05; - public static final int DAT_REGISTER_INDEX = OPT_U8 + 0x06; - public static final int DAT_LINENUM = OPT_U30 + 0x07; - public static final int DAT_LOCAL_REG_INDEX = OPT_U30 + 0x08; - public static final int DAT_SLOT_INDEX = OPT_U30 + 0x09; - public static final int DAT_SLOT_SCOPE_INDEX = OPT_U30 + 0x0A; - public static final int DAT_OFFSET = OPT_S24 + 0x0B; - public static final int DAT_EXCEPTION_INDEX = OPT_U30 + 0x0C; - public static final int DAT_CLASS_INDEX = OPT_U30 + 0x0D; - public static final int DAT_INT_INDEX = OPT_U30 + 0x0E; - public static final int DAT_UINT_INDEX = OPT_U30 + 0x0F; - public static final int DAT_DOUBLE_INDEX = OPT_U30 + 0x10; - public static final int DAT_CASE_BASEOFFSET = OPT_S24 + 0x11; - public static InstructionDefinition instructionSet[] = new InstructionDefinition[]{ - new AddIns(), - new AddIIns(), - new AsTypeIns(), - new AsTypeLateIns(), - new BitAndIns(), - new BitNotIns(), - new BitOrIns(), - new BitXorIns(), - new CallIns(), - new CallMethodIns(), - new CallPropertyIns(), - new CallPropLexIns(), - new CallPropVoidIns(), - new CallStaticIns(), - new CallSuperIns(), - new CallSuperVoidIns(), - new CheckFilterIns(), - new CoerceIns(), - new CoerceAIns(), - new CoerceSIns(), - new ConstructIns(), - new ConstructPropIns(), - new ConstructSuperIns(), - new ConvertBIns(), - new ConvertIIns(), - new ConvertDIns(), - new ConvertOIns(), - new ConvertUIns(), - new ConvertSIns(), - new DebugIns(), - new DebugFileIns(), - new DebugLineIns(), - new DecLocalIns(), - new DecLocalIIns(), - new DecrementIns(), - new DecrementIIns(), - new DeletePropertyIns(), - new DivideIns(), - new DupIns(), - new DXNSIns(), - new DXNSLateIns(), - new EqualsIns(), - new EscXAttrIns(), - new EscXElemIns(), - new FindPropertyIns(), - new FindPropertyStrictIns(), - new GetDescendantsIns(), - new GetGlobalScopeIns(), - new GetGlobalSlotIns(), - new GetLexIns(), - new GetLocalIns(), - new GetLocal0Ins(), - new GetLocal1Ins(), - new GetLocal2Ins(), - new GetLocal3Ins(), - new GetPropertyIns(), - new GetScopeObjectIns(), - new GetSlotIns(), - new GetSuperIns(), - new GreaterEqualsIns(), - new GreaterThanIns(), - new HasNextIns(), - new HasNext2Ins(), - new IfEqIns(), - new IfFalseIns(), - new IfGeIns(), - new IfGtIns(), - new IfLeIns(), - new IfLtIns(), - new IfNGeIns(), - new IfNGtIns(), - new IfNLeIns(), - new IfNLtIns(), - new IfNeIns(), - new IfStrictEqIns(), - new IfStrictNeIns(), - new IfTrueIns(), - new InIns(), - new IncLocalIns(), - new IncLocalIIns(), - new IncrementIns(), - new IncrementIIns(), - new InitPropertyIns(), - new InstanceOfIns(), - new IsTypeIns(), - new IsTypeLateIns(), - new JumpIns(), - new KillIns(), - new LabelIns(), - new LessEqualsIns(), - new LessThanIns(), - new LookupSwitchIns(), - new LShiftIns(), - new ModuloIns(), - new MultiplyIns(), - new MultiplyIIns(), - new NegateIns(), - new NegateIIns(), - new NewActivationIns(), - new NewArrayIns(), - new NewCatchIns(), - new NewClassIns(), - new NewFunctionIns(), - new NewObjectIns(), - new NextNameIns(), - new NextValueIns(), - new NopIns(), - new NotIns(), - new PopIns(), - new PopScopeIns(), - new PushByteIns(), - new PushDoubleIns(), - new PushFalseIns(), - new PushIntIns(), - new PushNamespaceIns(), - new PushNanIns(), - new PushNullIns(), - new PushScopeIns(), - new PushShortIns(), - new PushStringIns(), - new PushTrueIns(), - new PushUIntIns(), - new PushUndefinedIns(), - new PushWithIns(), - new ReturnValueIns(), - new ReturnVoidIns(), - new RShiftIns(), - new SetLocalIns(), - new SetLocal0Ins(), - new SetLocal1Ins(), - new SetLocal2Ins(), - new SetLocal3Ins(), - new SetGlobalSlotIns(), - new SetPropertyIns(), - new SetSlotIns(), - new SetSuperIns(), - new StrictEqualsIns(), - new SubtractIns(), - new SubtractIIns(), - new SwapIns(), - new ThrowIns(), - new TypeOfIns(), - new URShiftIns()}; - //endoflist - public static final String IDENTOPEN = "/*IDENTOPEN*/"; - public static final String IDENTCLOSE = "/*IDENTCLOSE*/"; - - private class ConvertOutput { - - public Stack stack; - public List output; - - public ConvertOutput(Stack stack, List output) { - this.stack = stack; - this.output = output; - } - } - - public AVM2Code() { - } - - public AVM2Code(InputStream is) throws IOException { - ABCInputStream ais = new ABCInputStream(is); - while (ais.available() > 0) { - long startOffset = ais.getPosition(); - ais.startBuffer(); - int instructionCode = ais.read(); - boolean known = false; - loopi: - for (int i = 0; i < instructionSet.length; i++) { - if (instructionSet[i].instructionCode == instructionCode) { - known = true; - int actualOperands[]; - if (instructionCode == 0x1b) { //switch - int firstOperand = ais.readS24(); - int case_count = ais.readU30(); - actualOperands = new int[case_count + 3]; - actualOperands[0] = firstOperand; - actualOperands[1] = case_count; - for (int c = 0; c < case_count + 1; c++) { - actualOperands[2 + c] = ais.readS24(); - } - } else { - actualOperands = new int[instructionSet[i].operands.length]; - for (int op = 0; op < instructionSet[i].operands.length; op++) { - switch (instructionSet[i].operands[op] & 0xff00) { - case OPT_U30: - actualOperands[op] = ais.readU30(); - break; - case OPT_U8: - actualOperands[op] = ais.read(); - break; - case OPT_BYTE: - actualOperands[op] = (byte) ais.read(); - break; - case OPT_S24: - actualOperands[op] = ais.readS24(); - break; - } - } - } - - code.add(new AVM2Instruction(startOffset, instructionSet[i], actualOperands, ais.stopBuffer())); - break loopi; - } - } - if (!known) { - throw new UnknownInstructionCode(instructionCode); - } - } - } - - public byte[] getBytes() { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - try { - for (AVM2Instruction instruction : code) { - bos.write(instruction.getBytes()); - } - } catch (IOException ex) { - } - return bos.toByteArray(); - } - - @Override - public String toString() { - String s = ""; - for (AVM2Instruction instruction : code) { - s += instruction.toString() + "\r\n"; - } - return s; - } - - public String toString(ConstantPool constants) { - String s = ""; - int i = 0; - for (AVM2Instruction instruction : code) { - s += Helper.formatAddress(i) + " " + instruction.toString(constants) + "\r\n"; - i++; - } - return s; - } - - private static String popStack(Stack stack) { - for (int i = stack.size() - 1; i >= 0; i--) { - String s = stack.get(i); - if (!s.startsWith("//")) { - stack.remove(i); - return s; - } - } - return null; - } - - public String toASMSource(ConstantPool constants) { - String ret = ""; - List offsets = new ArrayList(); - for (AVM2Instruction ins : code) { - offsets.addAll(ins.getOffsets()); - } - long ofs = 0; - for (AVM2Instruction ins : code) { - if (offsets.contains(ofs)) { - ret += "ofs" + Helper.formatAddress(ofs) + ":"; - } - ret += ins.toStringNoAddress(constants) + "\n"; - ofs += ins.getBytes().length; - } - - return ret; - } - - public int adr2pos(long address) throws ConvertException { - int a = 0; - for (int i = 0; i < code.size(); i++) { - if (a == address) { - return i; - } - a += code.get(i).getBytes().length; - } - if (a == address) { - return code.size(); - } - throw new ConvertException("Bad jump", -1); - } - - public int pos2adr(int pos) { - int a = 0; - for (int i = 0; i < pos; i++) { - a += code.get(i).getBytes().length; - } - - return a; - } - - private static String listToString(List stack, ConstantPool constants) { - String ret = ""; - for (int d = 0; d < stack.size(); d++) { - TreeItem o = stack.get(d); - ret += o.toString(constants) + "\r\n"; - } - return ret; - } - - private static String innerStackToString(List stack) { - String ret = ""; - for (int d = 0; d < stack.size(); d++) { - Object o = stack.get(d); - ret += o.toString(); - if (d < stack.size() - 1) { - if (!ret.endsWith("\r\n")) { - ret += "\r\n"; - } - } - } - return ret; - } - - private class Loop { - - public int loopContinue; - public int loopBreak; - public int continueCount = 0; - public int breakCount = 0; - - public Loop(int loopContinue, int loopBreak) { - this.loopContinue = loopContinue; - this.loopBreak = loopBreak; - } - } - - private List loopList; - private List unknownJumps; - private List finallyJumps; - private List parsedExceptions; - - private String stripBrackets(String s) { - if (s.startsWith("(") && (s.endsWith(")"))) { - s = s.substring(1, s.length() - 1); - } - return s; - } - - private int checkCatches(ABC abc, ConstantPool constants, MethodInfo method_info[], Stack stack, Stack scopeStack, List output, MethodBody body, int ip) throws ConvertException { - /*int newip = ip; - loope: - for (int e = 0; e < body.exceptions.length; e++) { - if (pos2adr(ip) == body.exceptions[e].end) { - for (int f = 0; f < e; f++) { - if (body.exceptions[e].startServer == body.exceptions[f].startServer) { - if (body.exceptions[e].end == body.exceptions[f].end) { - continue loope; - } - } - } - output.add("}"); - if (!(code.get(ip).definition instanceof JumpIns)) { - throw new ConvertException("No jump to skip catches"); - } - int addrAfterCatches = pos2adr(ip + 1) + code.get(ip).operands[0]; - int posAfterCatches = adr2pos(addrAfterCatches); - for (int g = 0; g < body.exceptions.length; g++) { - if (body.exceptions[e].startServer == body.exceptions[g].startServer) { - if (body.exceptions[e].end == body.exceptions[g].end) { - if (body.exceptions[g].isFinally()) { - output.add("finally"); - } else { - output.add("catch(" + body.exceptions[g].getVarName(constants) + ":" + body.exceptions[g].getTypeName(constants) + ")"); - } - output.add("{"); - - if (body.exceptions[g].isFinally()) { - int jumppos = adr2pos(body.exceptions[g].target) - 1; - AVM2Instruction jumpIns = code.get(jumppos); - if (!(jumpIns.definition instanceof JumpIns)) { - throw new ConvertException("No jump in finally block"); - } - int nextAddr = pos2adr(jumppos + 1) + jumpIns.operands[0]; - int nextins = adr2pos(nextAddr); - int pos = nextins; - Integer uj = new Integer(nextins); - if (unknownJumps.contains(uj)) { - unknownJumps.remove(uj); - } - int endpos = 0; - do { - if (code.get(pos).definition instanceof LookupSwitchIns) { - if (code.get(pos).operands[0] == 0) { - if (adr2pos(pos2adr(pos) + code.get(pos).operands[2]) < pos) { - endpos = pos - 1; - newip = endpos + 1; - break; - } - } - } - pos++; - } while (pos < code.size()); - output.addAll(toSource(stack, scopeStack, abc, constants, method_info, body, nextins, endpos).output); - } else { - - int pos = adr2pos(body.exceptions[g].target); - int endpos = posAfterCatches - 1; - for (int p = pos; p < posAfterCatches; p++) { - if (code.get(p).definition instanceof JumpIns) { - int nextAddr = pos2adr(p + 1) + code.get(p).operands[0]; - int nextPos = adr2pos(nextAddr); - if (nextPos == posAfterCatches) { - endpos = p - 1; - break; - } - } - } - Stack cstack = new Stack(); - cstack.push("catched " + body.exceptions[g].getVarName(constants)); - List outcatch = toSource(cstack, new Stack(), abc, constants, method_info, body, pos, endpos).output; - output.addAll(outcatch); - newip = endpos + 1; - } - output.add("}"); - } - } - } - } - } - return newip;*/ - return ip; - } - - boolean isCatched = false; - - private boolean isKilled(int regName, int start, int end) { - for (int k = start; k <= end; k++) { - if (code.get(k).definition instanceof KillIns) { - if (code.get(k).operands[0] == regName) { - return true; - } - } - } - return false; - } - - private int toSourceCount = 0; - - private ConvertOutput toSource(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, int start, int end) throws ConvertException { - boolean debugMode = false; - if (debugMode) - System.out.println("OPEN SubSource:" + start + "-" + end + " " + code.get(start).toString() + " to " + code.get(end).toString()); - //if(true) return ""; - toSourceCount++; - if (toSourceCount > 255) { - throw new ConvertException("StackOverflow", start); - } - List output = new ArrayList(); - String ret = ""; - int ip = start; - try { - int addr; - iploop: - while (ip <= end) { - - addr = pos2adr(ip); - int maxend = -1; - List catchedExceptions = new ArrayList(); - for (int e = 0; e < body.exceptions.length; e++) { - if (addr == body.exceptions[e].start) { - if (!body.exceptions[e].isFinally()) { - if ((body.exceptions[e].end > maxend) && (!parsedExceptions.contains(body.exceptions[e]))) { - catchedExceptions.clear(); - maxend = body.exceptions[e].end; - catchedExceptions.add(body.exceptions[e]); - } else if (body.exceptions[e].end == maxend) { - catchedExceptions.add(body.exceptions[e]); - } - } - } - } - if (catchedExceptions.size() > 0) { - parsedExceptions.addAll(catchedExceptions); - int endpos = adr2pos(catchedExceptions.get(0).end); - - - List> catchedCommands = new ArrayList>(); - if (code.get(endpos).definition instanceof JumpIns) { - int afterCatchAddr = pos2adr(endpos + 1) + code.get(endpos).operands[0]; - int afterCatchPos = adr2pos(afterCatchAddr); - Collections.sort(catchedExceptions, new Comparator() { - - public int compare(ABCException o1, ABCException o2) { - return o1.target - o2.target; - } - }); - - - List finallyCommands = new ArrayList(); - int returnPos = afterCatchPos; - for (int e = 0; e < body.exceptions.length; e++) { - if (body.exceptions[e].isFinally()) { - if (addr == body.exceptions[e].start) { - if (afterCatchPos + 1 == adr2pos(body.exceptions[e].end)) { - AVM2Instruction jmpIns = code.get(adr2pos(body.exceptions[e].end)); - if (jmpIns.definition instanceof JumpIns) { - int finStart = adr2pos(body.exceptions[e].end + jmpIns.getBytes().length + jmpIns.operands[0]); - finallyJumps.add(finStart); - if (unknownJumps.contains(finStart)) { - unknownJumps.remove((Integer) finStart); - } - for (int f = finStart; f <= end; f++) { - if (code.get(f).definition instanceof LookupSwitchIns) { - AVM2Instruction swins = code.get(f); - if (swins.operands.length >= 3) { - if (swins.operands[0] == swins.getBytes().length) { - if (adr2pos(pos2adr(f) + swins.operands[2]) < finStart) { - finallyCommands = toSource(isStatic, classIndex, localRegs, stack, scopeStack, abc, constants, method_info, body, finStart, f - 1).output; - returnPos = f + 1; - break; - } - } - } - } - } - - break; - } - } - } - } - } - - for (int e = 0; e < catchedExceptions.size(); e++) { - int eendpos = 0; - if (e < catchedExceptions.size() - 1) { - eendpos = adr2pos(catchedExceptions.get(e + 1).target) - 2; - } else { - eendpos = afterCatchPos - 1; - } - Stack substack = new Stack(); - substack.add(new ExceptionTreeItem(catchedExceptions.get(e))); - catchedCommands.add(toSource(isStatic, classIndex, localRegs, substack, new Stack(), abc, constants, method_info, body, adr2pos(catchedExceptions.get(e).target), eendpos).output); - } - - List tryCommands = toSource(isStatic, classIndex, localRegs, stack, scopeStack, abc, constants, method_info, body, ip, endpos - 1).output; - - - output.add(new TryTreeItem(tryCommands, catchedExceptions, catchedCommands, finallyCommands)); - ip = returnPos; - addr = pos2adr(ip); - } - - } - - if (ip > end) - break; - - if (unknownJumps.contains(ip)) { - unknownJumps.remove(new Integer(ip)); - throw new UnknownJumpException(stack, ip, output); - } - AVM2Instruction ins = code.get(ip); - //Ify s vice podminkama - if (ins.definition instanceof JumpIns) { - if (ins.operands[0] == 0) { - ip++; - addr = pos2adr(ip); - } else if (ins.operands[0] > 0) { - int secondAddr = addr + ins.getBytes().length; - int jumpAddr = secondAddr + ins.operands[0]; - int jumpPos = adr2pos(jumpAddr);// - - if (finallyJumps.contains(jumpPos)) { - if (code.get(ip + 1).definition instanceof LabelIns) { - if (code.get(ip + 2).definition instanceof PopIns) { - if (code.get(ip + 3).definition instanceof LabelIns) { - if (code.get(ip + 4).definition instanceof GetLocalTypeIns) { - if (code.get(ip - 1).definition instanceof PushByteIns) { - if (code.get(ip - 2).definition instanceof SetLocalTypeIns) { - if (((SetLocalTypeIns) code.get(ip - 2).definition).getRegisterId(code.get(ip - 2)) == ((GetLocalTypeIns) code.get(ip + 4).definition).getRegisterId(code.get(ip + 4))) { - SetLocalTreeItem ti = (SetLocalTreeItem) output.remove(output.size() - 1); - stack.add(ti.value); - ip = ip + 5; - continue; - } - } - } - } - } - } - } - //continue; - ip++; - continue; - } - for (Loop l : loopList) { - if (l.loopBreak == jumpPos) { - output.add(new BreakTreeItem(ins, l.loopBreak)); - addr = secondAddr; - ip = ip + 1; - continue iploop; - } - if (l.loopContinue == jumpPos) { - l.continueCount++; - output.add(new ContinueTreeItem(ins, l.loopBreak)); - addr = secondAddr; - ip = ip + 1; - continue iploop; - } - } - - - boolean backJumpFound = false; - int afterBackJumpAddr = 0; - AVM2Instruction backJumpIns = null; - boolean isSwitch = false; - int switchPos = 0; - loopj: - for (int j = jumpPos; j <= end; j++) { - if (code.get(j).definition instanceof IfTypeIns) { - afterBackJumpAddr = pos2adr(j + 1); - - if (afterBackJumpAddr + code.get(j).operands[0] == secondAddr) { - backJumpFound = true; - backJumpIns = code.get(j); - break; - } - } - if (code.get(j).definition instanceof LookupSwitchIns) { - for (int h = 2; h < code.get(j).operands.length; h++) { - int ofs = code.get(j).operands[h] + pos2adr(j); - if (ofs == secondAddr) { - isSwitch = true; - switchPos = j; - break loopj; - } - } - } - } - if (isSwitch) { - AVM2Instruction killIns = code.get(switchPos - 1); - if (!(killIns.definition instanceof KillIns)) { - throw new ConvertException("Unknown pattern: no kill before lookupswitch", switchPos - 1); - } - int userReg = killIns.operands[0]; - int evalTo = -1; - for (int g = jumpPos; g < switchPos; g++) { - if ((code.get(g).definition instanceof SetLocal0Ins) && (userReg == 0)) { - evalTo = g; - break; - } else if ((code.get(g).definition instanceof SetLocal1Ins) && (userReg == 1)) { - evalTo = g; - break; - } else if ((code.get(g).definition instanceof SetLocal2Ins) && (userReg == 2)) { - evalTo = g; - break; - } else if ((code.get(g).definition instanceof SetLocal3Ins) && (userReg == 3)) { - evalTo = g; - break; - } - if ((code.get(g).definition instanceof SetLocalIns) && (userReg == code.get(g).operands[0])) { - evalTo = g; - break; - } - } - if (evalTo == -1) { - throw new ConvertException("Unknown pattern: no setlocal before lookupswitch", switchPos); - } - loopList.add(new Loop(ip, switchPos + 1)); - Stack substack = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, jumpPos, evalTo - 1).stack; - TreeItem switchedValue = substack.pop(); - //output.add("loop" + (switchPos + 1) + ":"); - int switchBreak = switchPos + 1; - List casesList = new ArrayList(); - List> caseCommands = new ArrayList>(); - List defaultCommands = new ArrayList(); - //output.add("switch(" + switchedValue + ")"); - //output.add("{"); - int curPos = evalTo + 1; - int casePos = 0; - do { - evalTo = -1; - for (int g = curPos; g < switchPos; g++) { - if ((code.get(g).definition instanceof GetLocal0Ins) && (userReg == 0)) { - evalTo = g; - break; - } else if ((code.get(g).definition instanceof GetLocal1Ins) && (userReg == 1)) { - evalTo = g; - break; - } else if ((code.get(g).definition instanceof GetLocal2Ins) && (userReg == 2)) { - evalTo = g; - break; - } else if ((code.get(g).definition instanceof GetLocal3Ins) && (userReg == 3)) { - evalTo = g; - break; - } - if ((code.get(g).definition instanceof GetLocalIns) && (userReg == code.get(g).operands[0])) { - evalTo = g; - break; - } - } - - - if (evalTo > -1) { - substack = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, curPos, evalTo - 1).stack; - casesList.add(substack.pop()); - } - int substart = adr2pos(code.get(switchPos).operands[2 + casePos] + pos2adr(switchPos)); - int subend = jumpPos - 1; - if (casePos + 1 < code.get(switchPos).operands.length - 2) { - subend = adr2pos(code.get(switchPos).operands[2 + casePos + 1] + pos2adr(switchPos)) - 1; - } - - if (evalTo == -1) - subend--; - List commands = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, substart, subend).output; - if ((evalTo == -1) && (casePos < code.get(switchPos).operands.length - 2)) { - if (commands.size() == 1) { - commands.remove(0); - } - if (commands.size() > 0) { - //hasDefault=true; - } - } - List caseCommandPart = new ArrayList(); - if (evalTo == -1) { - defaultCommands.addAll(commands); - } else { - caseCommandPart.addAll(commands); - caseCommands.add(caseCommandPart); - } - curPos = evalTo + 4; - casePos++; - if (evalTo == -1) { - break; - } - } while (true); - output.add(new SwitchTreeItem(code.get(switchPos), switchBreak, switchedValue, casesList, caseCommands, defaultCommands)); - ip = switchPos + 1; - addr = pos2adr(ip); - continue; - } - - if (!backJumpFound) { - if (jumpPos <= end + 1) { //probably skipping catch - ip = jumpPos; - addr = pos2adr(ip); - continue; - } - output.add(new ContinueTreeItem(ins, jumpPos, false)); - addr = secondAddr; - ip = ip + 1; - if (!unknownJumps.contains(jumpPos)) { - unknownJumps.add(jumpPos); - } - continue; - //throw new ConvertException("Unknown pattern: forjump with no backjump"); - } - Loop currentLoop = new Loop(jumpPos, adr2pos(afterBackJumpAddr)); - loopList.add(currentLoop); - - - ConvertOutput co = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, jumpPos, adr2pos(afterBackJumpAddr) - 2); - Stack substack = co.stack; - backJumpIns.definition.translate(isStatic, classIndex, localRegs, substack, scopeStack, constants, backJumpIns, method_info, output, body, abc); - - TreeItem expression = substack.pop(); - List subins = new ArrayList(); - boolean isFor = false; - List finalExpression = new ArrayList(); - try { - subins = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, adr2pos(secondAddr) + 1/*label*/, jumpPos - 1).output; - } catch (UnknownJumpException uje) { - if ((uje.ip >= start) && (uje.ip <= end)) { - currentLoop.loopContinue = uje.ip; - subins = uje.output; - - List contList = new ArrayList(); - for (TreeItem ti : subins) { - if (ti instanceof ContinueTreeItem) { - contList.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - contList.addAll(((Block) ti).getContinues()); - } - } - for (int u = 0; u < contList.size(); u++) { - if (contList.get(u) instanceof ContinueTreeItem) { - if (((ContinueTreeItem) contList.get(u)).loopPos == uje.ip) { - if (!((ContinueTreeItem) contList.get(u)).isKnown) { - ((ContinueTreeItem) contList.get(u)).isKnown = true; - ((ContinueTreeItem) contList.get(u)).loopPos = currentLoop.loopBreak; - } - } - } - } - finalExpression = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, uje.ip, jumpPos - 1).output; - isFor = true; - } else { - throw new ConvertException("Unknown pattern: jump to nowhere", ip); - } - } - boolean isDoWhile = false; - - if (jumpPos == ip + 2) { - if (code.get(ip + 1).definition instanceof LabelIns) { - isDoWhile = true; - } - } - if (!isDoWhile) { - if (!isFor) { - for (Loop l : loopList) { - if (l.loopContinue == jumpPos) { - if (l.continueCount == 0) { - //isFor = true; - //finalExpression = subins.remove(subins.size() - 1).toString(); - } - break; - } - } - } - } - - String firstIns = ""; - if (isFor) { - if (output.size() > 0) { - //firstIns = output.remove(output.size() - 1).toString(); - } - } - - List loopBody = new ArrayList(); - loopBody.addAll(co.output); - loopBody.addAll(subins); - - if (isFor) { - output.add(new ForTreeItem(ins, currentLoop.loopBreak, currentLoop.loopContinue, new ArrayList(), expression, finalExpression, loopBody)); - } else if (isDoWhile) { - output.add(new DoWhileTreeItem(ins, currentLoop.loopBreak, currentLoop.loopContinue, loopBody, expression)); - } else { - if (expression instanceof EachTreeItem) { - output.add(new ForEachTreeItem(ins, currentLoop.loopBreak, currentLoop.loopContinue, (EachTreeItem) expression, loopBody)); - } else { - output.add(new WhileTreeItem(ins, currentLoop.loopBreak, currentLoop.loopContinue, expression, loopBody)); - } - } - addr = afterBackJumpAddr; - ip = adr2pos(addr); - } else { - throw new ConvertException("Unknown pattern: back jump ", ip); - } - } else if (ins.definition instanceof DupIns) { - int nextPos = 0; - do { - AVM2Instruction insAfter = code.get(ip + 1); - AVM2Instruction insBefore = ins; - if (ip - 1 >= start) { - insBefore = code.get(ip - 1); - } - boolean isAnd = false; - if (insAfter.definition instanceof IfFalseIns) { - //stack.add("(" + stack.pop() + ")&&"); - isAnd = true; - } else if (insAfter.definition instanceof IfTrueIns) { - //stack.add("(" + stack.pop() + ")||"); - isAnd = false; - } else if ((insAfter.definition instanceof IncrementIIns) || ((insAfter.definition instanceof IncrementIns))) { - if (((ip - 1 >= start) && (ip + 2 <= end)) && ((code.get(ip + 2).definition instanceof SetLocalTypeIns) && (code.get(ip - 1).definition instanceof GetLocalTypeIns))) { - stack.add(new PostIncrementTreeItem(insAfter, stack.pop())); - ip += 3; - addr = pos2adr(ip); - break; - } - if (((ip - 1 >= start) && (ip + 2 <= end)) - && (code.get(ip + 2).definition instanceof SetLocalTypeIns) - && (isKilled(((SetLocalTypeIns) code.get(ip + 2).definition).getRegisterId(code.get(ip + 2)), ip + 3, end))) { - int pos = -1; - for (int d = ip + 3; d <= end; d++) { - if (!((code.get(d).definition instanceof GetLocalTypeIns) - && (isKilled(((GetLocalTypeIns) code.get(d).definition).getRegisterId(code.get(d)), d + 1, end)))) { - pos = d; - break; - } - } - if (pos > -1) { - if (code.get(pos).definition instanceof SetTypeIns) { - stack.push(new PostIncrementTreeItem(insAfter, stack.pop())); - ip = pos + 1; - addr = pos2adr(ip); - break; - } - } - - } - ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); - ip++; - addr = pos2adr(ip); - break; - } else if ((insAfter.definition instanceof DecrementIIns) || ((insAfter.definition instanceof DecrementIns))) { - if (((ip - 1 >= start) && (ip + 2 <= end)) && ((code.get(ip + 2).definition instanceof SetLocalTypeIns) && (code.get(ip - 1).definition instanceof GetLocalTypeIns))) { - stack.add(new PostDecrementTreeItem(insAfter, stack.pop())); - ip += 3; - addr = pos2adr(ip); - break; - } - if (((ip - 1 >= start) && (ip + 2 <= end)) - && (code.get(ip + 2).definition instanceof SetLocalTypeIns) - && (isKilled(((SetLocalTypeIns) code.get(ip + 2).definition).getRegisterId(code.get(ip + 2)), ip + 3, end))) { - int pos = -1; - for (int d = ip + 3; d <= end; d++) { - if (!((code.get(d).definition instanceof GetLocalTypeIns) - && (isKilled(((GetLocalTypeIns) code.get(d).definition).getRegisterId(code.get(d)), d + 1, end)))) { - pos = d; - break; - } - } - if (pos > -1) { - if (code.get(pos).definition instanceof SetTypeIns) { - stack.push(new PostDecrementTreeItem(insAfter, stack.pop())); - ip = pos + 1; - addr = pos2adr(ip); - break; - } - } - - } - ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); - ip++; - addr = pos2adr(ip); - break; - } else if ((insBefore.definition instanceof IncrementIIns) || ((insBefore.definition instanceof IncrementIns))) { - if (((ip - 2 >= start) && (ip + 2 <= end)) && (code.get(ip + 1).definition instanceof ConvertIIns) && (code.get(ip + 2).definition instanceof SetLocalTypeIns) && (code.get(ip - 2).definition instanceof GetLocalTypeIns)) { - stack.pop(); - int regId = ((SetLocalTypeIns) code.get(ip + 2).definition).getRegisterId(code.get(ip + 2)); - stack.add(new PreIncrementTreeItem(insBefore, new LocalRegTreeItem(code.get(ip + 2), regId, localRegs.get(regId)))); - ip += 3; - addr = pos2adr(ip); - break; - } - if (((ip - 1 >= start) && (ip + 2 <= end)) - && (code.get(ip + 1).definition instanceof SetLocalTypeIns) - && (isKilled(((SetLocalTypeIns) code.get(ip + 1).definition).getRegisterId(code.get(ip + 1)), ip + 2, end))) { - int pos = -1; - for (int d = ip + 2; d <= end; d++) { - if (!((code.get(d).definition instanceof GetLocalTypeIns) - && (isKilled(((GetLocalTypeIns) code.get(d).definition).getRegisterId(code.get(d)), d + 1, end)))) { - pos = d; - break; - } - } - if (pos > -1) { - if (code.get(pos).definition instanceof SetTypeIns) { - TreeItem s = stack.pop(); - if (s instanceof IncrementTreeItem) { - stack.push(new PreIncrementTreeItem(insBefore, ((IncrementTreeItem) s).object)); - } - ip = pos + 1; - addr = pos2adr(ip); - break; - } - } - - } - ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); - ip++; - addr = pos2adr(ip); - break; - } else if ((insBefore.definition instanceof DecrementIIns) || ((insBefore.definition instanceof DecrementIns))) { - if (((ip - 2 >= start) && (ip + 2 <= end)) && (code.get(ip + 1).definition instanceof ConvertIIns) && (code.get(ip + 2).definition instanceof SetLocalTypeIns) && (code.get(ip - 2).definition instanceof GetLocalTypeIns)) { - stack.pop(); - int regId = ((SetLocalTypeIns) code.get(ip + 2).definition).getRegisterId(code.get(ip + 2)); - stack.add(new PreDecrementTreeItem(insBefore, new LocalRegTreeItem(code.get(ip + 2), regId, localRegs.get(regId)))); - ip += 3; - addr = pos2adr(ip); - break; - } - if (((ip - 1 >= start) && (ip + 2 <= end)) - && (code.get(ip + 1).definition instanceof SetLocalTypeIns) - && (isKilled(((SetLocalTypeIns) code.get(ip + 1).definition).getRegisterId(code.get(ip + 1)), ip + 2, end))) { - int pos = -1; - for (int d = ip + 2; d <= end; d++) { - if (!((code.get(d).definition instanceof GetLocalTypeIns) - && (isKilled(((GetLocalTypeIns) code.get(d).definition).getRegisterId(code.get(d)), d + 1, end)))) { - pos = d; - break; - } - } - if (pos > -1) { - if (code.get(pos).definition instanceof SetTypeIns) { - TreeItem s = stack.pop(); - if (s instanceof DecrementTreeItem) { - stack.push(new PreDecrementTreeItem(insBefore, ((DecrementTreeItem) s).object)); - } - ip = pos + 1; - addr = pos2adr(ip); - break; - } - } - - } - ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); - ip++; - addr = pos2adr(ip); - break; - } else if (insAfter.definition instanceof SetLocalTypeIns) { - /*if (isKilled(((SetLocalTypeIns) insAfter.definition).getRegisterId(insAfter), ip + 2, end)) { - ip += 2; - addr = pos2adr(ip); - break; - } else {*/ - ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); - ip++; - addr = pos2adr(ip); - break; - //} - - } else { - ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); - ip++; - addr = pos2adr(ip); - break; - //throw new ConvertException("Unknown pattern after DUP:" + insComparsion.toString()); - } - addr = addr + ins.getBytes().length + insAfter.getBytes().length + insAfter.operands[0]; - nextPos = adr2pos(addr) - 1; - if (isAnd) { - stack.add(new AndTreeItem(insAfter, stack.pop(), toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, ip + 3, nextPos).stack.pop())); - } else { - stack.add(new OrTreeItem(insAfter, stack.pop(), toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, ip + 3, nextPos).stack.pop())); - } - ins = code.get(nextPos + 1); - ip = nextPos + 1; - } while (ins.definition instanceof DupIns); - } else if (ins.definition instanceof IfTypeIns) { - int targetAddr = pos2adr(ip) + ins.getBytes().length + ins.operands[0]; - int targetIns = adr2pos(targetAddr); - ((IfTypeIns) ins.definition).translateInverted(localRegs, stack, ins); - - TreeItem condition = stack.pop(); - - if (condition.isFalse()) { - //ins.definition = new JumpIns(); - //continue; - } - if (condition.isTrue()) { - //ip = targetIns; - //continue; - } - //stack.add("if"+stack.pop()); - //stack.add("{"); - boolean hasElse = false; - boolean hasReturn = false; - if (code.get(targetIns - 1).definition instanceof JumpIns) { - - if ((targetIns - 2 > ip) && ((code.get(targetIns - 2).definition instanceof ReturnValueIns) || (code.get(targetIns - 2).definition instanceof ReturnVoidIns) || (code.get(targetIns - 2).definition instanceof ThrowIns))) { - hasElse = false; - hasReturn = true; - } else { - int jumpAddr = targetAddr + code.get(targetIns - 1).operands[0]; - int jumpPos = adr2pos(jumpAddr); - hasElse = true; - - for (Loop l : loopList) { - if (l.loopBreak == jumpPos) { - hasElse = false; - break; - } - } - if (hasElse) { - if (adr2pos(jumpAddr) > end + 1) { - hasElse = false; - //throw new ConvertException("Unknown pattern: forward jump outside of the block"); - } - } - } - } - ConvertOutput onTrue = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, ip + 1, targetIns - 1 - ((hasElse || hasReturn) ? 1 : 0)); - addr = targetAddr; - ip = targetIns; - ConvertOutput onFalse = new ConvertOutput(new Stack(), new ArrayList()); - if (hasElse) { - int finalAddr = targetAddr + code.get(targetIns - 1).operands[0]; - int finalIns = adr2pos(finalAddr); - onFalse = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, targetIns, finalIns - 1); - addr = finalAddr; - ip = finalIns; - } - if ((onTrue.stack.size() > 0) && (onFalse != null) && (onFalse.stack.size() > 0)) { - stack.add(new TernarOpTreeItem(ins, condition, onTrue.stack.pop(), onFalse.stack.pop())); - } else { - output.add(new IfTreeItem(ins, condition, onTrue.output, onFalse.output)); - } - - } else if ((ins.definition instanceof ReturnValueIns) || (ins.definition instanceof ReturnVoidIns) || (ins.definition instanceof ThrowIns)) { - ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); - ip = end + 1; - break; - } else { - ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); - - addr += ins.getBytes().length; - ip++; - } - - } - if (debugMode) - System.out.println("CLOSE SubSource:" + start + "-" + end + " " + code.get(start).toString() + " to " + code.get(end).toString()); - - return new ConvertOutput(stack, output); - } catch (ConvertException cex) { - throw cex; - } catch (Exception ex) { - if (ex instanceof UnknownJumpException) { - throw (UnknownJumpException) ex; - } - throw new ConvertException(ex.toString(), ip); - } - } - - public String tabString(int len) { - String ret = ""; - for (int i = 0; i < len; i++) { - ret += ABC.IDENT_STRING; - } - return ret; - } - - public String toSource(boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body) { - return toSource(isStatic, classIndex, abc, constants, method_info, body, false); - } - - public List toTree(boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body) { - toSourceCount = 0; - loopList = new ArrayList(); - unknownJumps = new ArrayList(); - parsedExceptions = new ArrayList(); - finallyJumps = new ArrayList(); - HashMap localRegs = new HashMap(); - try { - return toSource(isStatic, classIndex, localRegs, new Stack(), new Stack(), abc, constants, method_info, body, 0, code.size() - 1).output; - } catch (ConvertException ex) { - return new ArrayList(); - } - } - - public String toSource(boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, boolean hilighted) { - toSourceCount = 0; - loopList = new ArrayList(); - unknownJumps = new ArrayList(); - finallyJumps = new ArrayList(); - parsedExceptions = new ArrayList(); - List list; - String s = ""; - try { - HashMap localRegs = new HashMap(); - list = toSource(isStatic, classIndex, localRegs, new Stack(), new Stack(), abc, constants, method_info, body, 0, code.size() - 1).output; - s = listToString(list, constants); - } catch (Exception ex) { - ex.printStackTrace(); - s = "Convert error - " + ex.toString(); - return s; - } - - String parts[] = s.split("\r\n"); - String sub = ""; - int level = 0; - for (int t = 0; t < body.traits.traits.length; t++) { - sub += body.traits.traits[t].convert(constants, method_info) + ";\r\n"; - } - try { - Stack loopStack = new Stack(); - for (int p = 0; p < parts.length; p++) { - String stripped = Highlighting.stripHilights(parts[p]); - if (stripped.endsWith(":") && (!stripped.startsWith("case ")) && (!stripped.equals("default:"))) { - loopStack.add(stripped.substring(0, stripped.length() - 1)); - } - if (stripped.startsWith("break ")) { - if (stripped.equals("break " + loopStack.peek() + ";")) { - parts[p] = parts[p].replace(" " + loopStack.peek(), ""); - } - } - if (stripped.startsWith("continue ")) { - if (loopStack.size() > 0) { - if (stripped.equals("continue " + loopStack.peek() + ";")) { - parts[p] = parts[p].replace(" " + loopStack.peek(), ""); - } - } - } - if (stripped.startsWith(":")) { - loopStack.pop(); - } - } - } catch (Exception ex) { - } - for (int p = 0; p < parts.length; p++) { - String strippedP = Highlighting.stripHilights(parts[p]); - if (strippedP.endsWith(":") && (!strippedP.startsWith("case ")) && (!strippedP.equals("default:"))) { - String loopname = strippedP.substring(0, strippedP.length() - 1); - boolean dorefer = false; - for (int q = p + 1; q < parts.length; q++) { - String strippedQ = Highlighting.stripHilights(parts[q]); - if (strippedQ.equals("break " + loopname + ";")) { - dorefer = true; - break; - } - if (strippedQ.equals("continue " + loopname + ";")) { - dorefer = true; - break; - } - if (strippedQ.equals(":" + loopname)) { - break; - } - } - if (!dorefer) { - continue; - } - } - if (strippedP.startsWith(":")) { - continue; - } - if (strippedP.equals(IDENTOPEN)) { - level++; - } else if (strippedP.equals(IDENTCLOSE)) { - level--; - } else if (strippedP.equals("{")) { - level++; - sub += tabString(level) + parts[p] + "\r\n"; - level++; - } else if (strippedP.equals("}")) { - level--; - sub += tabString(level) + parts[p] + "\r\n"; - level--; - } else { - sub += tabString(level) + parts[p] + "\r\n"; - } - } - if (!hilighted) { - sub = Highlighting.stripHilights(sub); - } - return sub; - } - - public static void main(String[] args) { - FileInputStream fis = null; - try { - fis = new FileInputStream("src/asdec/abc/avm2/AVM2Code.java"); - byte[] data = new byte[fis.available()]; - fis.read(data); - - String content = new String(data); - Pattern partPat = Pattern.compile("private static InstructionDefinition instructionSet(.*)endoflist", Pattern.MULTILINE | Pattern.DOTALL); - Matcher m = partPat.matcher(content); - if (m.find()) { - System.out.println("1 found"); - content = m.group(1); - System.out.println(content); - Pattern part2Pat = Pattern.compile("new InstructionDefinition(\\([^\\)]*\"([^\"]*)\"[^\\)]*\\))\\{(.*)\\},", Pattern.MULTILINE | Pattern.DOTALL); - m = part2Pat.matcher(content); - while (m.find()) { - System.out.println("2 found"); - String superCall = m.group(1); - String name = m.group(2); - String methods = m.group(3); - FileOutputStream fos = new FileOutputStream("src/asdec/abc/avm2/instructions/generated/" + name + "Ins.java"); - String out = "public class " + name + "Ins extends InstructionDefinition {\r\n public " + name + "Ins(){\r\nsuper" + superCall + ";\r\n}" + methods + "}"; - fos.write(out.getBytes()); - fos.close(); - } - } - } catch (IOException ex) { - } finally { - try { - fis.close(); - } catch (IOException ex) { - Logger.getLogger(AVM2Code.class.getName()).log(Level.SEVERE, null, ex); - } - } - } - - public void removeInstruction(int pos, MethodBody body) { - if ((pos < 0) || (pos >= code.size())) { - throw new IndexOutOfBoundsException(); - } - int byteCount = code.get(pos).getBytes().length; - long remOffset = code.get(pos).offset; - for (int i = pos + 1; i < code.size(); i++) { - code.get(i).offset -= byteCount; - } - - for (ABCException ex : body.exceptions) { - if (ex.start > remOffset) { - ex.start -= byteCount; - } - if (ex.end > remOffset) { - ex.start -= byteCount; - } - if (ex.target > remOffset) { - ex.start -= byteCount; - } - } - - - for (int i = 0; i < pos; i++) { - if (code.get(i).definition instanceof LookupSwitchIns) { - long target = code.get(i).offset + code.get(i).operands[0]; - if (target > remOffset) { - code.get(i).operands[0] -= byteCount; - } - for (int k = 2; k < code.get(i).operands.length; k++) { - target = code.get(i).offset + code.get(i).operands[k]; - if (target > remOffset) { - code.get(i).operands[k] -= byteCount; - } - } - } else { - for (int j = 0; j < code.get(i).definition.operands.length; j++) { - if (code.get(i).definition.operands[j] == AVM2Code.DAT_OFFSET) { - long target = code.get(i).offset + code.get(i).getBytes().length + code.get(i).operands[j]; - if (target > remOffset) { - code.get(i).operands[j] -= byteCount; - } - } - } - } - } - for (int i = pos + 1; i < code.size(); i++) { - if (code.get(i).definition instanceof LookupSwitchIns) { - long target = code.get(i).offset + code.get(i).operands[0]; - if (target < remOffset) { - code.get(i).operands[0] += byteCount; - } - for (int k = 2; k < code.get(i).operands.length; k++) { - target = code.get(i).offset + code.get(i).operands[k]; - if (target < remOffset) { - code.get(i).operands[k] += byteCount; - } - } - } else { - for (int j = 0; j < code.get(i).definition.operands.length; j++) { - if (code.get(i).definition.operands[j] == AVM2Code.DAT_OFFSET) { - long target = code.get(i).offset + code.get(i).getBytes().length + code.get(i).operands[j]; - if (target < remOffset) { - code.get(i).operands[j] += byteCount; - } - } - } - } - } - - code.remove(pos); - - } - - public void insertInstruction(int pos, AVM2Instruction instruction) { - if (pos < 0) { - pos = 0; - } - if (pos > code.size()) { - pos = code.size(); - } - int byteCount = instruction.getBytes().length; - if (pos == code.size()) { - instruction.offset = code.get(pos - 1).offset + code.get(pos - 1).getBytes().length; - } else { - instruction.offset = code.get(pos).offset; - } - - for (int i = 0; i < pos; i++) { - for (int j = 0; j < code.get(i).definition.operands.length; j++) { - if (code.get(i).definition.operands[j] == AVM2Code.DAT_OFFSET) { - long target = code.get(i).offset + code.get(i).getBytes().length + code.get(i).operands[j]; - if (target >= instruction.offset) { - code.get(i).operands[j] += byteCount; - } - } - } - } - for (int i = pos; i < code.size(); i++) { - for (int j = 0; j < code.get(i).definition.operands.length; j++) { - if (code.get(i).definition.operands[j] == AVM2Code.DAT_OFFSET) { - long target = code.get(i).offset + code.get(i).getBytes().length + code.get(i).operands[j]; - if (target < instruction.offset) { - code.get(i).operands[j] -= byteCount; - } - } - } - } - - for (int i = pos + 1; i < code.size(); i++) { - code.get(i).offset += byteCount; - } - code.add(pos, instruction); - } - - private void removeFreeBlocks(ConstantPool constants, MethodBody body) throws ConvertException { - List offsets = new ArrayList(); - for (AVM2Instruction ins : code) { - offsets.addAll(ins.getOffsets()); - } - for (ABCException ex : body.exceptions) { - offsets.add((long) ex.start); - offsets.add((long) ex.end); - offsets.add((long) ex.target); - } - - int clearedCount = 0; - loopip: - for (int ip = 0; ip < code.size(); ip++) { - AVM2Instruction ins = code.get(ip); - if (ins.definition instanceof JumpIns) { - int secondAddr = pos2adr(ip + 1); - int jumpAddr = secondAddr + ins.operands[0]; - int jumpPos = adr2pos(jumpAddr); - if (jumpPos <= ip) { - continue; - } - if (jumpPos > code.size()) { - continue; - } - for (int k = ip + 1; k < jumpPos; k++) { - if (offsets.contains((long) pos2adr(k))) { - continue loopip; - } - } - for (int k = ip; k < jumpPos; k++) { - removeInstruction(ip, body); - clearedCount++; - } - offsets.clear(); - for (AVM2Instruction ins2 : code) { - offsets.addAll(ins2.getOffsets()); - } - for (ABCException ex : body.exceptions) { - offsets.add((long) ex.start); - offsets.add((long) ex.end); - offsets.add((long) ex.target); - } - ip--; - //ip=jumpPos; - } - } - if (clearedCount > 0) { - //System.out.println("Cleared " + clearedCount + " lines of code TO:"); - //System.out.println(toASMSource(constants)); - //System.exit(1); - } - } - - public void clearSecureSWF(ConstantPool constants, MethodBody body) throws ConvertException { - if (code.size() > 4) { - AVM2Instruction first = code.get(0); - AVM2Instruction second = code.get(1); - boolean firstValue = false; - boolean secondValue = false; - boolean isSecure = true; - if (first.definition instanceof PushFalseIns) { - firstValue = false; - } else if (first.definition instanceof PushTrueIns) { - firstValue = true; - } else { - isSecure = false; - } - if (isSecure) { - if (second.definition instanceof PushFalseIns) { - secondValue = false; - } else if (second.definition instanceof PushTrueIns) { - secondValue = true; - } else { - isSecure = false; - } - if (isSecure) { - AVM2Instruction third = code.get(2); - int pos = 2; - if (third.definition instanceof SwapIns) { - pos++; - boolean dup = firstValue; - firstValue = secondValue; - secondValue = dup; - } - AVM2Instruction firstSet = code.get(pos); - AVM2Instruction secondSet = code.get(pos + 1); - int trueIndex = -1; - int falseIndex = -1; - if (firstSet.definition instanceof SetLocalTypeIns) { - if (secondValue == true) { - trueIndex = ((SetLocalTypeIns) firstSet.definition).getRegisterId(firstSet); - } - if (secondValue == false) { - falseIndex = ((SetLocalTypeIns) firstSet.definition).getRegisterId(firstSet); - } - } else { - isSecure = false; - } - if (isSecure) { - if (secondSet.definition instanceof SetLocalTypeIns) { - if (firstValue == true) { - trueIndex = ((SetLocalTypeIns) secondSet.definition).getRegisterId(firstSet); - } - if (firstValue == false) { - falseIndex = ((SetLocalTypeIns) secondSet.definition).getRegisterId(firstSet); - } - - //Yes, secure - pos += 2; - for (int i = 0; i < pos; i++) { - code.get(i).ignored = true; - //removeInstruction(0, body); - } - System.out.println("trueIndex:" + trueIndex); - System.out.println("falseIndex:" + falseIndex); - boolean found = false; - do { - found = false; - for (int ip = pos; ip < code.size(); ip++) { - if (code.get(ip).ignored) continue; - if (code.get(ip).definition instanceof GetLocalTypeIns) { - int regIndex = ((GetLocalTypeIns) code.get(ip).definition).getRegisterId(code.get(ip)); - if ((regIndex == trueIndex) || (regIndex == falseIndex)) { - found = true; - Stack myStack = new Stack(); - do { - AVM2Instruction ins = code.get(ip); - if (ins.ignored) { - ip++; - continue; - } else if (ins.definition instanceof GetLocalTypeIns) { - regIndex = ((GetLocalTypeIns) ins.definition).getRegisterId(ins); - if (regIndex == trueIndex) myStack.push(true); - if (regIndex == falseIndex) myStack.push(false); - ip++; - ins.ignored = true; - } else if (ins.definition instanceof DupIns) { - Boolean b = myStack.pop(); - myStack.push(b); - myStack.push(b); - ins.ignored = true; - ip++; - } else if (ins.definition instanceof PopIns) { - myStack.pop(); - ins.ignored = true; - ip++; - } else if (ins.definition instanceof IfTrueIns) { - System.out.println("iftrue found"); - boolean val = myStack.pop(); - if (val) { - code.get(ip).definition = new JumpIns(); - System.out.println("changed to jump"); - ip = adr2pos(pos2adr(ip + 1) + code.get(ip).operands[0]); - } else { - code.get(ip).ignored = true; - ip++; - } - } else if (ins.definition instanceof IfFalseIns) { - boolean val = myStack.pop(); - if (!val) { - code.get(ip).definition = new JumpIns(); - ip = adr2pos(pos2adr(ip + 1) + code.get(ip).operands[0]); - } else { - code.get(ip).ignored = true; - ip++; - } - } else if (ins.definition instanceof JumpIns) { - ip = adr2pos(pos2adr(ip + 1) + code.get(ip).operands[0]); - } else { - - } - - } while (myStack.size() > 0); - - /*for(int rem=code.size();rem>=0;rem--){ - if(code.get(rem).ignored){ - code.remove(rem); - } - } */ - break; - } - - } - } - } - while (found); - } else { - isSecure = false; - } - } - - } - } - } - } - - public void clearCode(ConstantPool constants, MethodBody body) throws ConvertException { - - if (code.size() > 3) { - if (code.get(0).definition instanceof PushByteIns) { - if (code.get(1).definition instanceof PushByteIns) { - if (code.get(2).definition instanceof IfNeIns) { - if (code.get(0).operands[0] != code.get(1).operands[0]) { - int targetAddr = pos2adr(2) + code.get(2).getBytes().length + code.get(2).operands[0]; - int targetPos = adr2pos(targetAddr); - for (int i = 0; i < targetPos; i++) { - removeInstruction(0, body); - } - } - } - } - } - } - - removeFreeBlocks(constants, body); - //clearSecureSWF(constants, body); - - - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2; + +import com.jpexs.asdec.abc.ABC; +import com.jpexs.asdec.abc.ABCInputStream; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.arithmetic.*; +import com.jpexs.asdec.abc.avm2.instructions.bitwise.*; +import com.jpexs.asdec.abc.avm2.instructions.comparsion.*; +import com.jpexs.asdec.abc.avm2.instructions.construction.*; +import com.jpexs.asdec.abc.avm2.instructions.debug.DebugFileIns; +import com.jpexs.asdec.abc.avm2.instructions.debug.DebugIns; +import com.jpexs.asdec.abc.avm2.instructions.debug.DebugLineIns; +import com.jpexs.asdec.abc.avm2.instructions.executing.*; +import com.jpexs.asdec.abc.avm2.instructions.jumps.*; +import com.jpexs.asdec.abc.avm2.instructions.localregs.*; +import com.jpexs.asdec.abc.avm2.instructions.other.*; +import com.jpexs.asdec.abc.avm2.instructions.stack.*; +import com.jpexs.asdec.abc.avm2.instructions.types.*; +import com.jpexs.asdec.abc.avm2.instructions.xml.*; +import com.jpexs.asdec.abc.avm2.treemodel.*; +import com.jpexs.asdec.abc.avm2.treemodel.clauses.*; +import com.jpexs.asdec.abc.avm2.treemodel.operations.AndTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.OrTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.PreDecrementTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.PreIncrementTreeItem; +import com.jpexs.asdec.abc.types.ABCException; +import com.jpexs.asdec.abc.types.MethodBody; +import com.jpexs.asdec.abc.types.MethodInfo; +import com.jpexs.asdec.helpers.Helper; +import com.jpexs.asdec.helpers.Highlighting; + +import java.io.*; +import java.util.*; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +public class AVM2Code { + + public List code = new LinkedList(); + public static final int OPT_U30 = 0x100; + public static final int OPT_U8 = 0x200; + public static final int OPT_S24 = 0x300; + public static final int OPT_CASE_OFFSETS = 0x400; + public static final int OPT_BYTE = 0x500; + public static final int DAT_MULTINAME_INDEX = OPT_U30 + 0x01; + public static final int DAT_ARG_COUNT = OPT_U30 + 0x02; + public static final int DAT_METHOD_INDEX = OPT_U30 + 0x03; + public static final int DAT_STRING_INDEX = OPT_U30 + 0x04; + public static final int DAT_DEBUG_TYPE = OPT_U8 + 0x05; + public static final int DAT_REGISTER_INDEX = OPT_U8 + 0x06; + public static final int DAT_LINENUM = OPT_U30 + 0x07; + public static final int DAT_LOCAL_REG_INDEX = OPT_U30 + 0x08; + public static final int DAT_SLOT_INDEX = OPT_U30 + 0x09; + public static final int DAT_SLOT_SCOPE_INDEX = OPT_U30 + 0x0A; + public static final int DAT_OFFSET = OPT_S24 + 0x0B; + public static final int DAT_EXCEPTION_INDEX = OPT_U30 + 0x0C; + public static final int DAT_CLASS_INDEX = OPT_U30 + 0x0D; + public static final int DAT_INT_INDEX = OPT_U30 + 0x0E; + public static final int DAT_UINT_INDEX = OPT_U30 + 0x0F; + public static final int DAT_DOUBLE_INDEX = OPT_U30 + 0x10; + public static final int DAT_CASE_BASEOFFSET = OPT_S24 + 0x11; + public static InstructionDefinition instructionSet[] = new InstructionDefinition[]{ + new AddIns(), + new AddIIns(), + new AsTypeIns(), + new AsTypeLateIns(), + new BitAndIns(), + new BitNotIns(), + new BitOrIns(), + new BitXorIns(), + new CallIns(), + new CallMethodIns(), + new CallPropertyIns(), + new CallPropLexIns(), + new CallPropVoidIns(), + new CallStaticIns(), + new CallSuperIns(), + new CallSuperVoidIns(), + new CheckFilterIns(), + new CoerceIns(), + new CoerceAIns(), + new CoerceSIns(), + new ConstructIns(), + new ConstructPropIns(), + new ConstructSuperIns(), + new ConvertBIns(), + new ConvertIIns(), + new ConvertDIns(), + new ConvertOIns(), + new ConvertUIns(), + new ConvertSIns(), + new DebugIns(), + new DebugFileIns(), + new DebugLineIns(), + new DecLocalIns(), + new DecLocalIIns(), + new DecrementIns(), + new DecrementIIns(), + new DeletePropertyIns(), + new DivideIns(), + new DupIns(), + new DXNSIns(), + new DXNSLateIns(), + new EqualsIns(), + new EscXAttrIns(), + new EscXElemIns(), + new FindPropertyIns(), + new FindPropertyStrictIns(), + new GetDescendantsIns(), + new GetGlobalScopeIns(), + new GetGlobalSlotIns(), + new GetLexIns(), + new GetLocalIns(), + new GetLocal0Ins(), + new GetLocal1Ins(), + new GetLocal2Ins(), + new GetLocal3Ins(), + new GetPropertyIns(), + new GetScopeObjectIns(), + new GetSlotIns(), + new GetSuperIns(), + new GreaterEqualsIns(), + new GreaterThanIns(), + new HasNextIns(), + new HasNext2Ins(), + new IfEqIns(), + new IfFalseIns(), + new IfGeIns(), + new IfGtIns(), + new IfLeIns(), + new IfLtIns(), + new IfNGeIns(), + new IfNGtIns(), + new IfNLeIns(), + new IfNLtIns(), + new IfNeIns(), + new IfStrictEqIns(), + new IfStrictNeIns(), + new IfTrueIns(), + new InIns(), + new IncLocalIns(), + new IncLocalIIns(), + new IncrementIns(), + new IncrementIIns(), + new InitPropertyIns(), + new InstanceOfIns(), + new IsTypeIns(), + new IsTypeLateIns(), + new JumpIns(), + new KillIns(), + new LabelIns(), + new LessEqualsIns(), + new LessThanIns(), + new LookupSwitchIns(), + new LShiftIns(), + new ModuloIns(), + new MultiplyIns(), + new MultiplyIIns(), + new NegateIns(), + new NegateIIns(), + new NewActivationIns(), + new NewArrayIns(), + new NewCatchIns(), + new NewClassIns(), + new NewFunctionIns(), + new NewObjectIns(), + new NextNameIns(), + new NextValueIns(), + new NopIns(), + new NotIns(), + new PopIns(), + new PopScopeIns(), + new PushByteIns(), + new PushDoubleIns(), + new PushFalseIns(), + new PushIntIns(), + new PushNamespaceIns(), + new PushNanIns(), + new PushNullIns(), + new PushScopeIns(), + new PushShortIns(), + new PushStringIns(), + new PushTrueIns(), + new PushUIntIns(), + new PushUndefinedIns(), + new PushWithIns(), + new ReturnValueIns(), + new ReturnVoidIns(), + new RShiftIns(), + new SetLocalIns(), + new SetLocal0Ins(), + new SetLocal1Ins(), + new SetLocal2Ins(), + new SetLocal3Ins(), + new SetGlobalSlotIns(), + new SetPropertyIns(), + new SetSlotIns(), + new SetSuperIns(), + new StrictEqualsIns(), + new SubtractIns(), + new SubtractIIns(), + new SwapIns(), + new ThrowIns(), + new TypeOfIns(), + new URShiftIns()}; + //endoflist + public static final String IDENTOPEN = "/*IDENTOPEN*/"; + public static final String IDENTCLOSE = "/*IDENTCLOSE*/"; + + private class ConvertOutput { + + public Stack stack; + public List output; + + public ConvertOutput(Stack stack, List output) { + this.stack = stack; + this.output = output; + } + } + + public AVM2Code() { + } + + public AVM2Code(InputStream is) throws IOException { + ABCInputStream ais = new ABCInputStream(is); + while (ais.available() > 0) { + long startOffset = ais.getPosition(); + ais.startBuffer(); + int instructionCode = ais.read(); + boolean known = false; + loopi: + for (int i = 0; i < instructionSet.length; i++) { + if (instructionSet[i].instructionCode == instructionCode) { + known = true; + int actualOperands[]; + if (instructionCode == 0x1b) { //switch + int firstOperand = ais.readS24(); + int case_count = ais.readU30(); + actualOperands = new int[case_count + 3]; + actualOperands[0] = firstOperand; + actualOperands[1] = case_count; + for (int c = 0; c < case_count + 1; c++) { + actualOperands[2 + c] = ais.readS24(); + } + } else { + actualOperands = new int[instructionSet[i].operands.length]; + for (int op = 0; op < instructionSet[i].operands.length; op++) { + switch (instructionSet[i].operands[op] & 0xff00) { + case OPT_U30: + actualOperands[op] = ais.readU30(); + break; + case OPT_U8: + actualOperands[op] = ais.read(); + break; + case OPT_BYTE: + actualOperands[op] = (byte) ais.read(); + break; + case OPT_S24: + actualOperands[op] = ais.readS24(); + break; + } + } + } + + code.add(new AVM2Instruction(startOffset, instructionSet[i], actualOperands, ais.stopBuffer())); + break loopi; + } + } + if (!known) { + throw new UnknownInstructionCode(instructionCode); + } + } + } + + public byte[] getBytes() { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + try { + for (AVM2Instruction instruction : code) { + bos.write(instruction.getBytes()); + } + } catch (IOException ex) { + } + return bos.toByteArray(); + } + + @Override + public String toString() { + String s = ""; + for (AVM2Instruction instruction : code) { + s += instruction.toString() + "\r\n"; + } + return s; + } + + public String toString(ConstantPool constants) { + String s = ""; + int i = 0; + for (AVM2Instruction instruction : code) { + s += Helper.formatAddress(i) + " " + instruction.toString(constants) + "\r\n"; + i++; + } + return s; + } + + private static String popStack(Stack stack) { + for (int i = stack.size() - 1; i >= 0; i--) { + String s = stack.get(i); + if (!s.startsWith("//")) { + stack.remove(i); + return s; + } + } + return null; + } + + public String toASMSource(ConstantPool constants) { + String ret = ""; + List offsets = new ArrayList(); + for (AVM2Instruction ins : code) { + offsets.addAll(ins.getOffsets()); + } + long ofs = 0; + for (AVM2Instruction ins : code) { + if (offsets.contains(ofs)) { + ret += "ofs" + Helper.formatAddress(ofs) + ":"; + } + ret += ins.toStringNoAddress(constants) + "\n"; + ofs += ins.getBytes().length; + } + + return ret; + } + + public int adr2pos(long address) throws ConvertException { + int a = 0; + for (int i = 0; i < code.size(); i++) { + if (a == address) { + return i; + } + a += code.get(i).getBytes().length; + } + if (a == address) { + return code.size(); + } + throw new ConvertException("Bad jump", -1); + } + + public int pos2adr(int pos) { + int a = 0; + for (int i = 0; i < pos; i++) { + a += code.get(i).getBytes().length; + } + + return a; + } + + private static String listToString(List stack, ConstantPool constants) { + String ret = ""; + for (int d = 0; d < stack.size(); d++) { + TreeItem o = stack.get(d); + ret += o.toString(constants) + "\r\n"; + } + return ret; + } + + private static String innerStackToString(List stack) { + String ret = ""; + for (int d = 0; d < stack.size(); d++) { + Object o = stack.get(d); + ret += o.toString(); + if (d < stack.size() - 1) { + if (!ret.endsWith("\r\n")) { + ret += "\r\n"; + } + } + } + return ret; + } + + private class Loop { + + public int loopContinue; + public int loopBreak; + public int continueCount = 0; + public int breakCount = 0; + + public Loop(int loopContinue, int loopBreak) { + this.loopContinue = loopContinue; + this.loopBreak = loopBreak; + } + } + + private List loopList; + private List unknownJumps; + private List finallyJumps; + private List parsedExceptions; + + private String stripBrackets(String s) { + if (s.startsWith("(") && (s.endsWith(")"))) { + s = s.substring(1, s.length() - 1); + } + return s; + } + + private int checkCatches(ABC abc, ConstantPool constants, MethodInfo method_info[], Stack stack, Stack scopeStack, List output, MethodBody body, int ip) throws ConvertException { + /*int newip = ip; + loope: + for (int e = 0; e < body.exceptions.length; e++) { + if (pos2adr(ip) == body.exceptions[e].end) { + for (int f = 0; f < e; f++) { + if (body.exceptions[e].startServer == body.exceptions[f].startServer) { + if (body.exceptions[e].end == body.exceptions[f].end) { + continue loope; + } + } + } + output.add("}"); + if (!(code.get(ip).definition instanceof JumpIns)) { + throw new ConvertException("No jump to skip catches"); + } + int addrAfterCatches = pos2adr(ip + 1) + code.get(ip).operands[0]; + int posAfterCatches = adr2pos(addrAfterCatches); + for (int g = 0; g < body.exceptions.length; g++) { + if (body.exceptions[e].startServer == body.exceptions[g].startServer) { + if (body.exceptions[e].end == body.exceptions[g].end) { + if (body.exceptions[g].isFinally()) { + output.add("finally"); + } else { + output.add("catch(" + body.exceptions[g].getVarName(constants) + ":" + body.exceptions[g].getTypeName(constants) + ")"); + } + output.add("{"); + + if (body.exceptions[g].isFinally()) { + int jumppos = adr2pos(body.exceptions[g].target) - 1; + AVM2Instruction jumpIns = code.get(jumppos); + if (!(jumpIns.definition instanceof JumpIns)) { + throw new ConvertException("No jump in finally block"); + } + int nextAddr = pos2adr(jumppos + 1) + jumpIns.operands[0]; + int nextins = adr2pos(nextAddr); + int pos = nextins; + Integer uj = new Integer(nextins); + if (unknownJumps.contains(uj)) { + unknownJumps.remove(uj); + } + int endpos = 0; + do { + if (code.get(pos).definition instanceof LookupSwitchIns) { + if (code.get(pos).operands[0] == 0) { + if (adr2pos(pos2adr(pos) + code.get(pos).operands[2]) < pos) { + endpos = pos - 1; + newip = endpos + 1; + break; + } + } + } + pos++; + } while (pos < code.size()); + output.addAll(toSource(stack, scopeStack, abc, constants, method_info, body, nextins, endpos).output); + } else { + + int pos = adr2pos(body.exceptions[g].target); + int endpos = posAfterCatches - 1; + for (int p = pos; p < posAfterCatches; p++) { + if (code.get(p).definition instanceof JumpIns) { + int nextAddr = pos2adr(p + 1) + code.get(p).operands[0]; + int nextPos = adr2pos(nextAddr); + if (nextPos == posAfterCatches) { + endpos = p - 1; + break; + } + } + } + Stack cstack = new Stack(); + cstack.push("catched " + body.exceptions[g].getVarName(constants)); + List outcatch = toSource(cstack, new Stack(), abc, constants, method_info, body, pos, endpos).output; + output.addAll(outcatch); + newip = endpos + 1; + } + output.add("}"); + } + } + } + } + } + return newip;*/ + return ip; + } + + boolean isCatched = false; + + private boolean isKilled(int regName, int start, int end) { + for (int k = start; k <= end; k++) { + if (code.get(k).definition instanceof KillIns) { + if (code.get(k).operands[0] == regName) { + return true; + } + } + } + return false; + } + + private int toSourceCount = 0; + + private ConvertOutput toSource(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, int start, int end) throws ConvertException { + boolean debugMode = false; + if (debugMode) + System.out.println("OPEN SubSource:" + start + "-" + end + " " + code.get(start).toString() + " to " + code.get(end).toString()); + //if(true) return ""; + toSourceCount++; + if (toSourceCount > 255) { + throw new ConvertException("StackOverflow", start); + } + List output = new ArrayList(); + String ret = ""; + int ip = start; + try { + int addr; + iploop: + while (ip <= end) { + + addr = pos2adr(ip); + int maxend = -1; + List catchedExceptions = new ArrayList(); + for (int e = 0; e < body.exceptions.length; e++) { + if (addr == body.exceptions[e].start) { + if (!body.exceptions[e].isFinally()) { + if ((body.exceptions[e].end > maxend) && (!parsedExceptions.contains(body.exceptions[e]))) { + catchedExceptions.clear(); + maxend = body.exceptions[e].end; + catchedExceptions.add(body.exceptions[e]); + } else if (body.exceptions[e].end == maxend) { + catchedExceptions.add(body.exceptions[e]); + } + } + } + } + if (catchedExceptions.size() > 0) { + parsedExceptions.addAll(catchedExceptions); + int endpos = adr2pos(catchedExceptions.get(0).end); + + + List> catchedCommands = new ArrayList>(); + if (code.get(endpos).definition instanceof JumpIns) { + int afterCatchAddr = pos2adr(endpos + 1) + code.get(endpos).operands[0]; + int afterCatchPos = adr2pos(afterCatchAddr); + Collections.sort(catchedExceptions, new Comparator() { + + public int compare(ABCException o1, ABCException o2) { + return o1.target - o2.target; + } + }); + + + List finallyCommands = new ArrayList(); + int returnPos = afterCatchPos; + for (int e = 0; e < body.exceptions.length; e++) { + if (body.exceptions[e].isFinally()) { + if (addr == body.exceptions[e].start) { + if (afterCatchPos + 1 == adr2pos(body.exceptions[e].end)) { + AVM2Instruction jmpIns = code.get(adr2pos(body.exceptions[e].end)); + if (jmpIns.definition instanceof JumpIns) { + int finStart = adr2pos(body.exceptions[e].end + jmpIns.getBytes().length + jmpIns.operands[0]); + finallyJumps.add(finStart); + if (unknownJumps.contains(finStart)) { + unknownJumps.remove((Integer) finStart); + } + for (int f = finStart; f <= end; f++) { + if (code.get(f).definition instanceof LookupSwitchIns) { + AVM2Instruction swins = code.get(f); + if (swins.operands.length >= 3) { + if (swins.operands[0] == swins.getBytes().length) { + if (adr2pos(pos2adr(f) + swins.operands[2]) < finStart) { + finallyCommands = toSource(isStatic, classIndex, localRegs, stack, scopeStack, abc, constants, method_info, body, finStart, f - 1).output; + returnPos = f + 1; + break; + } + } + } + } + } + + break; + } + } + } + } + } + + for (int e = 0; e < catchedExceptions.size(); e++) { + int eendpos = 0; + if (e < catchedExceptions.size() - 1) { + eendpos = adr2pos(catchedExceptions.get(e + 1).target) - 2; + } else { + eendpos = afterCatchPos - 1; + } + Stack substack = new Stack(); + substack.add(new ExceptionTreeItem(catchedExceptions.get(e))); + catchedCommands.add(toSource(isStatic, classIndex, localRegs, substack, new Stack(), abc, constants, method_info, body, adr2pos(catchedExceptions.get(e).target), eendpos).output); + } + + List tryCommands = toSource(isStatic, classIndex, localRegs, stack, scopeStack, abc, constants, method_info, body, ip, endpos - 1).output; + + + output.add(new TryTreeItem(tryCommands, catchedExceptions, catchedCommands, finallyCommands)); + ip = returnPos; + addr = pos2adr(ip); + } + + } + + if (ip > end) + break; + + if (unknownJumps.contains(ip)) { + unknownJumps.remove(new Integer(ip)); + throw new UnknownJumpException(stack, ip, output); + } + AVM2Instruction ins = code.get(ip); + //Ify s vice podminkama + if (ins.definition instanceof JumpIns) { + if (ins.operands[0] == 0) { + ip++; + addr = pos2adr(ip); + } else if (ins.operands[0] > 0) { + int secondAddr = addr + ins.getBytes().length; + int jumpAddr = secondAddr + ins.operands[0]; + int jumpPos = adr2pos(jumpAddr);// + + if (finallyJumps.contains(jumpPos)) { + if (code.get(ip + 1).definition instanceof LabelIns) { + if (code.get(ip + 2).definition instanceof PopIns) { + if (code.get(ip + 3).definition instanceof LabelIns) { + if (code.get(ip + 4).definition instanceof GetLocalTypeIns) { + if (code.get(ip - 1).definition instanceof PushByteIns) { + if (code.get(ip - 2).definition instanceof SetLocalTypeIns) { + if (((SetLocalTypeIns) code.get(ip - 2).definition).getRegisterId(code.get(ip - 2)) == ((GetLocalTypeIns) code.get(ip + 4).definition).getRegisterId(code.get(ip + 4))) { + SetLocalTreeItem ti = (SetLocalTreeItem) output.remove(output.size() - 1); + stack.add(ti.value); + ip = ip + 5; + continue; + } + } + } + } + } + } + } + //continue; + ip++; + continue; + } + for (Loop l : loopList) { + if (l.loopBreak == jumpPos) { + output.add(new BreakTreeItem(ins, l.loopBreak)); + addr = secondAddr; + ip = ip + 1; + continue iploop; + } + if (l.loopContinue == jumpPos) { + l.continueCount++; + output.add(new ContinueTreeItem(ins, l.loopBreak)); + addr = secondAddr; + ip = ip + 1; + continue iploop; + } + } + + + boolean backJumpFound = false; + int afterBackJumpAddr = 0; + AVM2Instruction backJumpIns = null; + boolean isSwitch = false; + int switchPos = 0; + loopj: + for (int j = jumpPos; j <= end; j++) { + if (code.get(j).definition instanceof IfTypeIns) { + afterBackJumpAddr = pos2adr(j + 1); + + if (afterBackJumpAddr + code.get(j).operands[0] == secondAddr) { + backJumpFound = true; + backJumpIns = code.get(j); + break; + } + } + if (code.get(j).definition instanceof LookupSwitchIns) { + for (int h = 2; h < code.get(j).operands.length; h++) { + int ofs = code.get(j).operands[h] + pos2adr(j); + if (ofs == secondAddr) { + isSwitch = true; + switchPos = j; + break loopj; + } + } + } + } + if (isSwitch) { + AVM2Instruction killIns = code.get(switchPos - 1); + if (!(killIns.definition instanceof KillIns)) { + throw new ConvertException("Unknown pattern: no kill before lookupswitch", switchPos - 1); + } + int userReg = killIns.operands[0]; + int evalTo = -1; + for (int g = jumpPos; g < switchPos; g++) { + if ((code.get(g).definition instanceof SetLocal0Ins) && (userReg == 0)) { + evalTo = g; + break; + } else if ((code.get(g).definition instanceof SetLocal1Ins) && (userReg == 1)) { + evalTo = g; + break; + } else if ((code.get(g).definition instanceof SetLocal2Ins) && (userReg == 2)) { + evalTo = g; + break; + } else if ((code.get(g).definition instanceof SetLocal3Ins) && (userReg == 3)) { + evalTo = g; + break; + } + if ((code.get(g).definition instanceof SetLocalIns) && (userReg == code.get(g).operands[0])) { + evalTo = g; + break; + } + } + if (evalTo == -1) { + throw new ConvertException("Unknown pattern: no setlocal before lookupswitch", switchPos); + } + loopList.add(new Loop(ip, switchPos + 1)); + Stack substack = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, jumpPos, evalTo - 1).stack; + TreeItem switchedValue = substack.pop(); + //output.add("loop" + (switchPos + 1) + ":"); + int switchBreak = switchPos + 1; + List casesList = new ArrayList(); + List> caseCommands = new ArrayList>(); + List defaultCommands = new ArrayList(); + //output.add("switch(" + switchedValue + ")"); + //output.add("{"); + int curPos = evalTo + 1; + int casePos = 0; + do { + evalTo = -1; + for (int g = curPos; g < switchPos; g++) { + if ((code.get(g).definition instanceof GetLocal0Ins) && (userReg == 0)) { + evalTo = g; + break; + } else if ((code.get(g).definition instanceof GetLocal1Ins) && (userReg == 1)) { + evalTo = g; + break; + } else if ((code.get(g).definition instanceof GetLocal2Ins) && (userReg == 2)) { + evalTo = g; + break; + } else if ((code.get(g).definition instanceof GetLocal3Ins) && (userReg == 3)) { + evalTo = g; + break; + } + if ((code.get(g).definition instanceof GetLocalIns) && (userReg == code.get(g).operands[0])) { + evalTo = g; + break; + } + } + + + if (evalTo > -1) { + substack = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, curPos, evalTo - 1).stack; + casesList.add(substack.pop()); + } + int substart = adr2pos(code.get(switchPos).operands[2 + casePos] + pos2adr(switchPos)); + int subend = jumpPos - 1; + if (casePos + 1 < code.get(switchPos).operands.length - 2) { + subend = adr2pos(code.get(switchPos).operands[2 + casePos + 1] + pos2adr(switchPos)) - 1; + } + + if (evalTo == -1) + subend--; + List commands = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, substart, subend).output; + if ((evalTo == -1) && (casePos < code.get(switchPos).operands.length - 2)) { + if (commands.size() == 1) { + commands.remove(0); + } + if (commands.size() > 0) { + //hasDefault=true; + } + } + List caseCommandPart = new ArrayList(); + if (evalTo == -1) { + defaultCommands.addAll(commands); + } else { + caseCommandPart.addAll(commands); + caseCommands.add(caseCommandPart); + } + curPos = evalTo + 4; + casePos++; + if (evalTo == -1) { + break; + } + } while (true); + output.add(new SwitchTreeItem(code.get(switchPos), switchBreak, switchedValue, casesList, caseCommands, defaultCommands)); + ip = switchPos + 1; + addr = pos2adr(ip); + continue; + } + + if (!backJumpFound) { + if (jumpPos <= end + 1) { //probably skipping catch + ip = jumpPos; + addr = pos2adr(ip); + continue; + } + output.add(new ContinueTreeItem(ins, jumpPos, false)); + addr = secondAddr; + ip = ip + 1; + if (!unknownJumps.contains(jumpPos)) { + unknownJumps.add(jumpPos); + } + continue; + //throw new ConvertException("Unknown pattern: forjump with no backjump"); + } + Loop currentLoop = new Loop(jumpPos, adr2pos(afterBackJumpAddr)); + loopList.add(currentLoop); + + + ConvertOutput co = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, jumpPos, adr2pos(afterBackJumpAddr) - 2); + Stack substack = co.stack; + backJumpIns.definition.translate(isStatic, classIndex, localRegs, substack, scopeStack, constants, backJumpIns, method_info, output, body, abc); + + TreeItem expression = substack.pop(); + List subins = new ArrayList(); + boolean isFor = false; + List finalExpression = new ArrayList(); + try { + subins = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, adr2pos(secondAddr) + 1/*label*/, jumpPos - 1).output; + } catch (UnknownJumpException uje) { + if ((uje.ip >= start) && (uje.ip <= end)) { + currentLoop.loopContinue = uje.ip; + subins = uje.output; + + List contList = new ArrayList(); + for (TreeItem ti : subins) { + if (ti instanceof ContinueTreeItem) { + contList.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + contList.addAll(((Block) ti).getContinues()); + } + } + for (int u = 0; u < contList.size(); u++) { + if (contList.get(u) instanceof ContinueTreeItem) { + if (((ContinueTreeItem) contList.get(u)).loopPos == uje.ip) { + if (!((ContinueTreeItem) contList.get(u)).isKnown) { + ((ContinueTreeItem) contList.get(u)).isKnown = true; + ((ContinueTreeItem) contList.get(u)).loopPos = currentLoop.loopBreak; + } + } + } + } + finalExpression = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, uje.ip, jumpPos - 1).output; + isFor = true; + } else { + throw new ConvertException("Unknown pattern: jump to nowhere", ip); + } + } + boolean isDoWhile = false; + + if (jumpPos == ip + 2) { + if (code.get(ip + 1).definition instanceof LabelIns) { + isDoWhile = true; + } + } + if (!isDoWhile) { + if (!isFor) { + for (Loop l : loopList) { + if (l.loopContinue == jumpPos) { + if (l.continueCount == 0) { + //isFor = true; + //finalExpression = subins.remove(subins.size() - 1).toString(); + } + break; + } + } + } + } + + String firstIns = ""; + if (isFor) { + if (output.size() > 0) { + //firstIns = output.remove(output.size() - 1).toString(); + } + } + + List loopBody = new ArrayList(); + loopBody.addAll(co.output); + loopBody.addAll(subins); + + if (isFor) { + output.add(new ForTreeItem(ins, currentLoop.loopBreak, currentLoop.loopContinue, new ArrayList(), expression, finalExpression, loopBody)); + } else if (isDoWhile) { + output.add(new DoWhileTreeItem(ins, currentLoop.loopBreak, currentLoop.loopContinue, loopBody, expression)); + } else { + if (expression instanceof EachTreeItem) { + output.add(new ForEachTreeItem(ins, currentLoop.loopBreak, currentLoop.loopContinue, (EachTreeItem) expression, loopBody)); + } else { + output.add(new WhileTreeItem(ins, currentLoop.loopBreak, currentLoop.loopContinue, expression, loopBody)); + } + } + addr = afterBackJumpAddr; + ip = adr2pos(addr); + } else { + throw new ConvertException("Unknown pattern: back jump ", ip); + } + } else if (ins.definition instanceof DupIns) { + int nextPos = 0; + do { + AVM2Instruction insAfter = code.get(ip + 1); + AVM2Instruction insBefore = ins; + if (ip - 1 >= start) { + insBefore = code.get(ip - 1); + } + boolean isAnd = false; + if (insAfter.definition instanceof IfFalseIns) { + //stack.add("(" + stack.pop() + ")&&"); + isAnd = true; + } else if (insAfter.definition instanceof IfTrueIns) { + //stack.add("(" + stack.pop() + ")||"); + isAnd = false; + } else if ((insAfter.definition instanceof IncrementIIns) || ((insAfter.definition instanceof IncrementIns))) { + if (((ip - 1 >= start) && (ip + 2 <= end)) && ((code.get(ip + 2).definition instanceof SetLocalTypeIns) && (code.get(ip - 1).definition instanceof GetLocalTypeIns))) { + stack.add(new PostIncrementTreeItem(insAfter, stack.pop())); + ip += 3; + addr = pos2adr(ip); + break; + } + if (((ip - 1 >= start) && (ip + 2 <= end)) + && (code.get(ip + 2).definition instanceof SetLocalTypeIns) + && (isKilled(((SetLocalTypeIns) code.get(ip + 2).definition).getRegisterId(code.get(ip + 2)), ip + 3, end))) { + int pos = -1; + for (int d = ip + 3; d <= end; d++) { + if (!((code.get(d).definition instanceof GetLocalTypeIns) + && (isKilled(((GetLocalTypeIns) code.get(d).definition).getRegisterId(code.get(d)), d + 1, end)))) { + pos = d; + break; + } + } + if (pos > -1) { + if (code.get(pos).definition instanceof SetTypeIns) { + stack.push(new PostIncrementTreeItem(insAfter, stack.pop())); + ip = pos + 1; + addr = pos2adr(ip); + break; + } + } + + } + ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); + ip++; + addr = pos2adr(ip); + break; + } else if ((insAfter.definition instanceof DecrementIIns) || ((insAfter.definition instanceof DecrementIns))) { + if (((ip - 1 >= start) && (ip + 2 <= end)) && ((code.get(ip + 2).definition instanceof SetLocalTypeIns) && (code.get(ip - 1).definition instanceof GetLocalTypeIns))) { + stack.add(new PostDecrementTreeItem(insAfter, stack.pop())); + ip += 3; + addr = pos2adr(ip); + break; + } + if (((ip - 1 >= start) && (ip + 2 <= end)) + && (code.get(ip + 2).definition instanceof SetLocalTypeIns) + && (isKilled(((SetLocalTypeIns) code.get(ip + 2).definition).getRegisterId(code.get(ip + 2)), ip + 3, end))) { + int pos = -1; + for (int d = ip + 3; d <= end; d++) { + if (!((code.get(d).definition instanceof GetLocalTypeIns) + && (isKilled(((GetLocalTypeIns) code.get(d).definition).getRegisterId(code.get(d)), d + 1, end)))) { + pos = d; + break; + } + } + if (pos > -1) { + if (code.get(pos).definition instanceof SetTypeIns) { + stack.push(new PostDecrementTreeItem(insAfter, stack.pop())); + ip = pos + 1; + addr = pos2adr(ip); + break; + } + } + + } + ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); + ip++; + addr = pos2adr(ip); + break; + } else if ((insBefore.definition instanceof IncrementIIns) || ((insBefore.definition instanceof IncrementIns))) { + if (((ip - 2 >= start) && (ip + 2 <= end)) && (code.get(ip + 1).definition instanceof ConvertIIns) && (code.get(ip + 2).definition instanceof SetLocalTypeIns) && (code.get(ip - 2).definition instanceof GetLocalTypeIns)) { + stack.pop(); + int regId = ((SetLocalTypeIns) code.get(ip + 2).definition).getRegisterId(code.get(ip + 2)); + stack.add(new PreIncrementTreeItem(insBefore, new LocalRegTreeItem(code.get(ip + 2), regId, localRegs.get(regId)))); + ip += 3; + addr = pos2adr(ip); + break; + } + if (((ip - 1 >= start) && (ip + 2 <= end)) + && (code.get(ip + 1).definition instanceof SetLocalTypeIns) + && (isKilled(((SetLocalTypeIns) code.get(ip + 1).definition).getRegisterId(code.get(ip + 1)), ip + 2, end))) { + int pos = -1; + for (int d = ip + 2; d <= end; d++) { + if (!((code.get(d).definition instanceof GetLocalTypeIns) + && (isKilled(((GetLocalTypeIns) code.get(d).definition).getRegisterId(code.get(d)), d + 1, end)))) { + pos = d; + break; + } + } + if (pos > -1) { + if (code.get(pos).definition instanceof SetTypeIns) { + TreeItem s = stack.pop(); + if (s instanceof IncrementTreeItem) { + stack.push(new PreIncrementTreeItem(insBefore, ((IncrementTreeItem) s).object)); + } + ip = pos + 1; + addr = pos2adr(ip); + break; + } + } + + } + ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); + ip++; + addr = pos2adr(ip); + break; + } else if ((insBefore.definition instanceof DecrementIIns) || ((insBefore.definition instanceof DecrementIns))) { + if (((ip - 2 >= start) && (ip + 2 <= end)) && (code.get(ip + 1).definition instanceof ConvertIIns) && (code.get(ip + 2).definition instanceof SetLocalTypeIns) && (code.get(ip - 2).definition instanceof GetLocalTypeIns)) { + stack.pop(); + int regId = ((SetLocalTypeIns) code.get(ip + 2).definition).getRegisterId(code.get(ip + 2)); + stack.add(new PreDecrementTreeItem(insBefore, new LocalRegTreeItem(code.get(ip + 2), regId, localRegs.get(regId)))); + ip += 3; + addr = pos2adr(ip); + break; + } + if (((ip - 1 >= start) && (ip + 2 <= end)) + && (code.get(ip + 1).definition instanceof SetLocalTypeIns) + && (isKilled(((SetLocalTypeIns) code.get(ip + 1).definition).getRegisterId(code.get(ip + 1)), ip + 2, end))) { + int pos = -1; + for (int d = ip + 2; d <= end; d++) { + if (!((code.get(d).definition instanceof GetLocalTypeIns) + && (isKilled(((GetLocalTypeIns) code.get(d).definition).getRegisterId(code.get(d)), d + 1, end)))) { + pos = d; + break; + } + } + if (pos > -1) { + if (code.get(pos).definition instanceof SetTypeIns) { + TreeItem s = stack.pop(); + if (s instanceof DecrementTreeItem) { + stack.push(new PreDecrementTreeItem(insBefore, ((DecrementTreeItem) s).object)); + } + ip = pos + 1; + addr = pos2adr(ip); + break; + } + } + + } + ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); + ip++; + addr = pos2adr(ip); + break; + } else if (insAfter.definition instanceof SetLocalTypeIns) { + /*if (isKilled(((SetLocalTypeIns) insAfter.definition).getRegisterId(insAfter), ip + 2, end)) { + ip += 2; + addr = pos2adr(ip); + break; + } else {*/ + ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); + ip++; + addr = pos2adr(ip); + break; + //} + + } else { + ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); + ip++; + addr = pos2adr(ip); + break; + //throw new ConvertException("Unknown pattern after DUP:" + insComparsion.toString()); + } + addr = addr + ins.getBytes().length + insAfter.getBytes().length + insAfter.operands[0]; + nextPos = adr2pos(addr) - 1; + if (isAnd) { + stack.add(new AndTreeItem(insAfter, stack.pop(), toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, ip + 3, nextPos).stack.pop())); + } else { + stack.add(new OrTreeItem(insAfter, stack.pop(), toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, ip + 3, nextPos).stack.pop())); + } + ins = code.get(nextPos + 1); + ip = nextPos + 1; + } while (ins.definition instanceof DupIns); + } else if (ins.definition instanceof IfTypeIns) { + int targetAddr = pos2adr(ip) + ins.getBytes().length + ins.operands[0]; + int targetIns = adr2pos(targetAddr); + ((IfTypeIns) ins.definition).translateInverted(localRegs, stack, ins); + + TreeItem condition = stack.pop(); + + if (condition.isFalse()) { + //ins.definition = new JumpIns(); + //continue; + } + if (condition.isTrue()) { + //ip = targetIns; + //continue; + } + //stack.add("if"+stack.pop()); + //stack.add("{"); + boolean hasElse = false; + boolean hasReturn = false; + if (code.get(targetIns - 1).definition instanceof JumpIns) { + + if ((targetIns - 2 > ip) && ((code.get(targetIns - 2).definition instanceof ReturnValueIns) || (code.get(targetIns - 2).definition instanceof ReturnVoidIns) || (code.get(targetIns - 2).definition instanceof ThrowIns))) { + hasElse = false; + hasReturn = true; + } else { + int jumpAddr = targetAddr + code.get(targetIns - 1).operands[0]; + int jumpPos = adr2pos(jumpAddr); + hasElse = true; + + for (Loop l : loopList) { + if (l.loopBreak == jumpPos) { + hasElse = false; + break; + } + } + if (hasElse) { + if (adr2pos(jumpAddr) > end + 1) { + hasElse = false; + //throw new ConvertException("Unknown pattern: forward jump outside of the block"); + } + } + } + } + ConvertOutput onTrue = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, ip + 1, targetIns - 1 - ((hasElse || hasReturn) ? 1 : 0)); + addr = targetAddr; + ip = targetIns; + ConvertOutput onFalse = new ConvertOutput(new Stack(), new ArrayList()); + if (hasElse) { + int finalAddr = targetAddr + code.get(targetIns - 1).operands[0]; + int finalIns = adr2pos(finalAddr); + onFalse = toSource(isStatic, classIndex, localRegs, new Stack(), scopeStack, abc, constants, method_info, body, targetIns, finalIns - 1); + addr = finalAddr; + ip = finalIns; + } + if ((onTrue.stack.size() > 0) && (onFalse != null) && (onFalse.stack.size() > 0)) { + stack.add(new TernarOpTreeItem(ins, condition, onTrue.stack.pop(), onFalse.stack.pop())); + } else { + output.add(new IfTreeItem(ins, condition, onTrue.output, onFalse.output)); + } + + } else if ((ins.definition instanceof ReturnValueIns) || (ins.definition instanceof ReturnVoidIns) || (ins.definition instanceof ThrowIns)) { + ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); + ip = end + 1; + break; + } else { + ins.definition.translate(isStatic, classIndex, localRegs, stack, scopeStack, constants, ins, method_info, output, body, abc); + + addr += ins.getBytes().length; + ip++; + } + + } + if (debugMode) + System.out.println("CLOSE SubSource:" + start + "-" + end + " " + code.get(start).toString() + " to " + code.get(end).toString()); + + return new ConvertOutput(stack, output); + } catch (ConvertException cex) { + throw cex; + } catch (Exception ex) { + if (ex instanceof UnknownJumpException) { + throw (UnknownJumpException) ex; + } + throw new ConvertException(ex.toString(), ip); + } + } + + public String tabString(int len) { + String ret = ""; + for (int i = 0; i < len; i++) { + ret += ABC.IDENT_STRING; + } + return ret; + } + + public String toSource(boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body) { + return toSource(isStatic, classIndex, abc, constants, method_info, body, false); + } + + public List toTree(boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body) { + toSourceCount = 0; + loopList = new ArrayList(); + unknownJumps = new ArrayList(); + parsedExceptions = new ArrayList(); + finallyJumps = new ArrayList(); + HashMap localRegs = new HashMap(); + try { + return toSource(isStatic, classIndex, localRegs, new Stack(), new Stack(), abc, constants, method_info, body, 0, code.size() - 1).output; + } catch (ConvertException ex) { + return new ArrayList(); + } + } + + public String toSource(boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], MethodBody body, boolean hilighted) { + toSourceCount = 0; + loopList = new ArrayList(); + unknownJumps = new ArrayList(); + finallyJumps = new ArrayList(); + parsedExceptions = new ArrayList(); + List list; + String s = ""; + try { + HashMap localRegs = new HashMap(); + list = toSource(isStatic, classIndex, localRegs, new Stack(), new Stack(), abc, constants, method_info, body, 0, code.size() - 1).output; + s = listToString(list, constants); + } catch (Exception ex) { + ex.printStackTrace(); + s = "Convert error - " + ex.toString(); + return s; + } + + String parts[] = s.split("\r\n"); + String sub = ""; + int level = 0; + for (int t = 0; t < body.traits.traits.length; t++) { + sub += body.traits.traits[t].convert(constants, method_info) + ";\r\n"; + } + try { + Stack loopStack = new Stack(); + for (int p = 0; p < parts.length; p++) { + String stripped = Highlighting.stripHilights(parts[p]); + if (stripped.endsWith(":") && (!stripped.startsWith("case ")) && (!stripped.equals("default:"))) { + loopStack.add(stripped.substring(0, stripped.length() - 1)); + } + if (stripped.startsWith("break ")) { + if (stripped.equals("break " + loopStack.peek() + ";")) { + parts[p] = parts[p].replace(" " + loopStack.peek(), ""); + } + } + if (stripped.startsWith("continue ")) { + if (loopStack.size() > 0) { + if (stripped.equals("continue " + loopStack.peek() + ";")) { + parts[p] = parts[p].replace(" " + loopStack.peek(), ""); + } + } + } + if (stripped.startsWith(":")) { + loopStack.pop(); + } + } + } catch (Exception ex) { + } + for (int p = 0; p < parts.length; p++) { + String strippedP = Highlighting.stripHilights(parts[p]); + if (strippedP.endsWith(":") && (!strippedP.startsWith("case ")) && (!strippedP.equals("default:"))) { + String loopname = strippedP.substring(0, strippedP.length() - 1); + boolean dorefer = false; + for (int q = p + 1; q < parts.length; q++) { + String strippedQ = Highlighting.stripHilights(parts[q]); + if (strippedQ.equals("break " + loopname + ";")) { + dorefer = true; + break; + } + if (strippedQ.equals("continue " + loopname + ";")) { + dorefer = true; + break; + } + if (strippedQ.equals(":" + loopname)) { + break; + } + } + if (!dorefer) { + continue; + } + } + if (strippedP.startsWith(":")) { + continue; + } + if (strippedP.equals(IDENTOPEN)) { + level++; + } else if (strippedP.equals(IDENTCLOSE)) { + level--; + } else if (strippedP.equals("{")) { + level++; + sub += tabString(level) + parts[p] + "\r\n"; + level++; + } else if (strippedP.equals("}")) { + level--; + sub += tabString(level) + parts[p] + "\r\n"; + level--; + } else { + sub += tabString(level) + parts[p] + "\r\n"; + } + } + if (!hilighted) { + sub = Highlighting.stripHilights(sub); + } + return sub; + } + + public static void main(String[] args) { + FileInputStream fis = null; + try { + fis = new FileInputStream("src/asdec/abc/avm2/AVM2Code.java"); + byte[] data = new byte[fis.available()]; + fis.read(data); + + String content = new String(data); + Pattern partPat = Pattern.compile("private static InstructionDefinition instructionSet(.*)endoflist", Pattern.MULTILINE | Pattern.DOTALL); + Matcher m = partPat.matcher(content); + if (m.find()) { + System.out.println("1 found"); + content = m.group(1); + System.out.println(content); + Pattern part2Pat = Pattern.compile("new InstructionDefinition(\\([^\\)]*\"([^\"]*)\"[^\\)]*\\))\\{(.*)\\},", Pattern.MULTILINE | Pattern.DOTALL); + m = part2Pat.matcher(content); + while (m.find()) { + System.out.println("2 found"); + String superCall = m.group(1); + String name = m.group(2); + String methods = m.group(3); + FileOutputStream fos = new FileOutputStream("src/asdec/abc/avm2/instructions/generated/" + name + "Ins.java"); + String out = "public class " + name + "Ins extends InstructionDefinition {\r\n public " + name + "Ins(){\r\nsuper" + superCall + ";\r\n}" + methods + "}"; + fos.write(out.getBytes()); + fos.close(); + } + } + } catch (IOException ex) { + } finally { + try { + fis.close(); + } catch (IOException ex) { + Logger.getLogger(AVM2Code.class.getName()).log(Level.SEVERE, null, ex); + } + } + } + + public void removeInstruction(int pos, MethodBody body) { + if ((pos < 0) || (pos >= code.size())) { + throw new IndexOutOfBoundsException(); + } + int byteCount = code.get(pos).getBytes().length; + long remOffset = code.get(pos).offset; + for (int i = pos + 1; i < code.size(); i++) { + code.get(i).offset -= byteCount; + } + + for (ABCException ex : body.exceptions) { + if (ex.start > remOffset) { + ex.start -= byteCount; + } + if (ex.end > remOffset) { + ex.start -= byteCount; + } + if (ex.target > remOffset) { + ex.start -= byteCount; + } + } + + + for (int i = 0; i < pos; i++) { + if (code.get(i).definition instanceof LookupSwitchIns) { + long target = code.get(i).offset + code.get(i).operands[0]; + if (target > remOffset) { + code.get(i).operands[0] -= byteCount; + } + for (int k = 2; k < code.get(i).operands.length; k++) { + target = code.get(i).offset + code.get(i).operands[k]; + if (target > remOffset) { + code.get(i).operands[k] -= byteCount; + } + } + } else { + for (int j = 0; j < code.get(i).definition.operands.length; j++) { + if (code.get(i).definition.operands[j] == AVM2Code.DAT_OFFSET) { + long target = code.get(i).offset + code.get(i).getBytes().length + code.get(i).operands[j]; + if (target > remOffset) { + code.get(i).operands[j] -= byteCount; + } + } + } + } + } + for (int i = pos + 1; i < code.size(); i++) { + if (code.get(i).definition instanceof LookupSwitchIns) { + long target = code.get(i).offset + code.get(i).operands[0]; + if (target < remOffset) { + code.get(i).operands[0] += byteCount; + } + for (int k = 2; k < code.get(i).operands.length; k++) { + target = code.get(i).offset + code.get(i).operands[k]; + if (target < remOffset) { + code.get(i).operands[k] += byteCount; + } + } + } else { + for (int j = 0; j < code.get(i).definition.operands.length; j++) { + if (code.get(i).definition.operands[j] == AVM2Code.DAT_OFFSET) { + long target = code.get(i).offset + code.get(i).getBytes().length + code.get(i).operands[j]; + if (target < remOffset) { + code.get(i).operands[j] += byteCount; + } + } + } + } + } + + code.remove(pos); + + } + + public void insertInstruction(int pos, AVM2Instruction instruction) { + if (pos < 0) { + pos = 0; + } + if (pos > code.size()) { + pos = code.size(); + } + int byteCount = instruction.getBytes().length; + if (pos == code.size()) { + instruction.offset = code.get(pos - 1).offset + code.get(pos - 1).getBytes().length; + } else { + instruction.offset = code.get(pos).offset; + } + + for (int i = 0; i < pos; i++) { + for (int j = 0; j < code.get(i).definition.operands.length; j++) { + if (code.get(i).definition.operands[j] == AVM2Code.DAT_OFFSET) { + long target = code.get(i).offset + code.get(i).getBytes().length + code.get(i).operands[j]; + if (target >= instruction.offset) { + code.get(i).operands[j] += byteCount; + } + } + } + } + for (int i = pos; i < code.size(); i++) { + for (int j = 0; j < code.get(i).definition.operands.length; j++) { + if (code.get(i).definition.operands[j] == AVM2Code.DAT_OFFSET) { + long target = code.get(i).offset + code.get(i).getBytes().length + code.get(i).operands[j]; + if (target < instruction.offset) { + code.get(i).operands[j] -= byteCount; + } + } + } + } + + for (int i = pos + 1; i < code.size(); i++) { + code.get(i).offset += byteCount; + } + code.add(pos, instruction); + } + + private void removeFreeBlocks(ConstantPool constants, MethodBody body) throws ConvertException { + List offsets = new ArrayList(); + for (AVM2Instruction ins : code) { + offsets.addAll(ins.getOffsets()); + } + for (ABCException ex : body.exceptions) { + offsets.add((long) ex.start); + offsets.add((long) ex.end); + offsets.add((long) ex.target); + } + + int clearedCount = 0; + loopip: + for (int ip = 0; ip < code.size(); ip++) { + AVM2Instruction ins = code.get(ip); + if (ins.definition instanceof JumpIns) { + int secondAddr = pos2adr(ip + 1); + int jumpAddr = secondAddr + ins.operands[0]; + int jumpPos = adr2pos(jumpAddr); + if (jumpPos <= ip) { + continue; + } + if (jumpPos > code.size()) { + continue; + } + for (int k = ip + 1; k < jumpPos; k++) { + if (offsets.contains((long) pos2adr(k))) { + continue loopip; + } + } + for (int k = ip; k < jumpPos; k++) { + removeInstruction(ip, body); + clearedCount++; + } + offsets.clear(); + for (AVM2Instruction ins2 : code) { + offsets.addAll(ins2.getOffsets()); + } + for (ABCException ex : body.exceptions) { + offsets.add((long) ex.start); + offsets.add((long) ex.end); + offsets.add((long) ex.target); + } + ip--; + //ip=jumpPos; + } + } + if (clearedCount > 0) { + //System.out.println("Cleared " + clearedCount + " lines of code TO:"); + //System.out.println(toASMSource(constants)); + //System.exit(1); + } + } + + public void clearSecureSWF(ConstantPool constants, MethodBody body) throws ConvertException { + if (code.size() > 4) { + AVM2Instruction first = code.get(0); + AVM2Instruction second = code.get(1); + boolean firstValue = false; + boolean secondValue = false; + boolean isSecure = true; + if (first.definition instanceof PushFalseIns) { + firstValue = false; + } else if (first.definition instanceof PushTrueIns) { + firstValue = true; + } else { + isSecure = false; + } + if (isSecure) { + if (second.definition instanceof PushFalseIns) { + secondValue = false; + } else if (second.definition instanceof PushTrueIns) { + secondValue = true; + } else { + isSecure = false; + } + if (isSecure) { + AVM2Instruction third = code.get(2); + int pos = 2; + if (third.definition instanceof SwapIns) { + pos++; + boolean dup = firstValue; + firstValue = secondValue; + secondValue = dup; + } + AVM2Instruction firstSet = code.get(pos); + AVM2Instruction secondSet = code.get(pos + 1); + int trueIndex = -1; + int falseIndex = -1; + if (firstSet.definition instanceof SetLocalTypeIns) { + if (secondValue == true) { + trueIndex = ((SetLocalTypeIns) firstSet.definition).getRegisterId(firstSet); + } + if (secondValue == false) { + falseIndex = ((SetLocalTypeIns) firstSet.definition).getRegisterId(firstSet); + } + } else { + isSecure = false; + } + if (isSecure) { + if (secondSet.definition instanceof SetLocalTypeIns) { + if (firstValue == true) { + trueIndex = ((SetLocalTypeIns) secondSet.definition).getRegisterId(firstSet); + } + if (firstValue == false) { + falseIndex = ((SetLocalTypeIns) secondSet.definition).getRegisterId(firstSet); + } + + //Yes, secure + pos += 2; + for (int i = 0; i < pos; i++) { + code.get(i).ignored = true; + //removeInstruction(0, body); + } + System.out.println("trueIndex:" + trueIndex); + System.out.println("falseIndex:" + falseIndex); + boolean found = false; + do { + found = false; + for (int ip = pos; ip < code.size(); ip++) { + if (code.get(ip).ignored) continue; + if (code.get(ip).definition instanceof GetLocalTypeIns) { + int regIndex = ((GetLocalTypeIns) code.get(ip).definition).getRegisterId(code.get(ip)); + if ((regIndex == trueIndex) || (regIndex == falseIndex)) { + found = true; + Stack myStack = new Stack(); + do { + AVM2Instruction ins = code.get(ip); + if (ins.ignored) { + ip++; + continue; + } else if (ins.definition instanceof GetLocalTypeIns) { + regIndex = ((GetLocalTypeIns) ins.definition).getRegisterId(ins); + if (regIndex == trueIndex) myStack.push(true); + if (regIndex == falseIndex) myStack.push(false); + ip++; + ins.ignored = true; + } else if (ins.definition instanceof DupIns) { + Boolean b = myStack.pop(); + myStack.push(b); + myStack.push(b); + ins.ignored = true; + ip++; + } else if (ins.definition instanceof PopIns) { + myStack.pop(); + ins.ignored = true; + ip++; + } else if (ins.definition instanceof IfTrueIns) { + System.out.println("iftrue found"); + boolean val = myStack.pop(); + if (val) { + code.get(ip).definition = new JumpIns(); + System.out.println("changed to jump"); + ip = adr2pos(pos2adr(ip + 1) + code.get(ip).operands[0]); + } else { + code.get(ip).ignored = true; + ip++; + } + } else if (ins.definition instanceof IfFalseIns) { + boolean val = myStack.pop(); + if (!val) { + code.get(ip).definition = new JumpIns(); + ip = adr2pos(pos2adr(ip + 1) + code.get(ip).operands[0]); + } else { + code.get(ip).ignored = true; + ip++; + } + } else if (ins.definition instanceof JumpIns) { + ip = adr2pos(pos2adr(ip + 1) + code.get(ip).operands[0]); + } else { + + } + + } while (myStack.size() > 0); + + /*for(int rem=code.size();rem>=0;rem--){ + if(code.get(rem).ignored){ + code.remove(rem); + } + } */ + break; + } + + } + } + } + while (found); + } else { + isSecure = false; + } + } + + } + } + } + } + + public void clearCode(ConstantPool constants, MethodBody body) throws ConvertException { + + if (code.size() > 3) { + if (code.get(0).definition instanceof PushByteIns) { + if (code.get(1).definition instanceof PushByteIns) { + if (code.get(2).definition instanceof IfNeIns) { + if (code.get(0).operands[0] != code.get(1).operands[0]) { + int targetAddr = pos2adr(2) + code.get(2).getBytes().length + code.get(2).operands[0]; + int targetPos = adr2pos(targetAddr); + for (int i = 0; i < targetPos; i++) { + removeInstruction(0, body); + } + } + } + } + } + } + + removeFreeBlocks(constants, body); + //clearSecureSWF(constants, body); + + + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/ConstantPool.java b/trunk/src/com/jpexs/asdec/abc/avm2/ConstantPool.java index 71f97fb2f..9fe96caa5 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/ConstantPool.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/ConstantPool.java @@ -1,122 +1,136 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2; - -import com.jpexs.asdec.abc.types.Multiname; -import com.jpexs.asdec.abc.types.Namespace; -import com.jpexs.asdec.abc.types.NamespaceSet; - -import java.io.OutputStream; -import java.io.PrintStream; -import java.util.Arrays; - - -public class ConstantPool { - public long constant_int[]; - public long constant_uint[]; - public double constant_double[]; - public String constant_string[]; - public Namespace constant_namespace[]; - public NamespaceSet constant_namespace_set[]; - public Multiname constant_multiname[]; - - public int addInt(long value) { - constant_int = Arrays.copyOf(constant_int, constant_int.length + 1); - constant_int[constant_int.length - 1] = value; - return constant_int.length - 1; - } - - public int addUInt(long value) { - constant_uint = Arrays.copyOf(constant_uint, constant_uint.length + 1); - constant_uint[constant_uint.length - 1] = value; - return constant_uint.length - 1; - } - - public int addDouble(double value) { - constant_double = Arrays.copyOf(constant_double, constant_double.length + 1); - constant_double[constant_double.length - 1] = value; - return constant_double.length - 1; - } - - public int addString(String value) { - constant_string = Arrays.copyOf(constant_string, constant_string.length + 1); - constant_string[constant_string.length - 1] = value; - return constant_string.length - 1; - } - - public int getIntId(long value) { - for (int i = 1; i < constant_int.length; i++) { - if (constant_int[i] == value) { - return i; - } - } - return 0; - } - - public int getUIntId(long value) { - for (int i = 1; i < constant_uint.length; i++) { - if (constant_uint[i] == value) { - return i; - } - } - return 0; - } - - public int getDoubleId(double value) { - for (int i = 1; i < constant_double.length; i++) { - if (constant_double[i] == value) { - return i; - } - } - return 0; - } - - public int getStringId(String s) { - for (int i = 1; i < constant_string.length; i++) { - if (constant_string[i].equals(s)) { - return i; - } - } - return 0; - } - - public int getMultiNameId(String s) { - for (int i = 1; i < constant_multiname.length; i++) { - if (constant_multiname[i].getName(this).equals(s)) { - return i; - } - } - return 0; - } - - public void dump(OutputStream os) { - PrintStream output = new PrintStream(os); - String s = ""; - for (int i = 1; i < constant_int.length; i++) { - output.println("INT[" + i + "]=" + constant_int[i]); - } - for (int i = 1; i < constant_uint.length; i++) { - output.println("UINT[" + i + "]=" + constant_uint[i]); - } - for (int i = 1; i < constant_double.length; i++) { - output.println("Double[" + i + "]=" + constant_double[i]); - } - for (int i = 1; i < constant_string.length; i++) { - output.println("String[" + i + "]=" + constant_string[i]); - } - for (int i = 1; i < constant_namespace.length; i++) { - output.println("Namespace[" + i + "]=" + constant_namespace[i].toString(this)); - } - for (int i = 1; i < constant_namespace_set.length; i++) { - output.println("NamespaceSet[" + i + "]=" + constant_namespace_set[i].toString(this)); - } - - for (int i = 1; i < constant_multiname.length; i++) { - output.println("Multiname[" + i + "]=" + constant_multiname[i].toString(this)); - } - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2; + +import com.jpexs.asdec.abc.types.Multiname; +import com.jpexs.asdec.abc.types.Namespace; +import com.jpexs.asdec.abc.types.NamespaceSet; + +import java.io.OutputStream; +import java.io.PrintStream; +import java.util.Arrays; + + +public class ConstantPool { + public long constant_int[]; + public long constant_uint[]; + public double constant_double[]; + public String constant_string[]; + public Namespace constant_namespace[]; + public NamespaceSet constant_namespace_set[]; + public Multiname constant_multiname[]; + + public int addInt(long value) { + constant_int = Arrays.copyOf(constant_int, constant_int.length + 1); + constant_int[constant_int.length - 1] = value; + return constant_int.length - 1; + } + + public int addUInt(long value) { + constant_uint = Arrays.copyOf(constant_uint, constant_uint.length + 1); + constant_uint[constant_uint.length - 1] = value; + return constant_uint.length - 1; + } + + public int addDouble(double value) { + constant_double = Arrays.copyOf(constant_double, constant_double.length + 1); + constant_double[constant_double.length - 1] = value; + return constant_double.length - 1; + } + + public int addString(String value) { + constant_string = Arrays.copyOf(constant_string, constant_string.length + 1); + constant_string[constant_string.length - 1] = value; + return constant_string.length - 1; + } + + public int getIntId(long value) { + for (int i = 1; i < constant_int.length; i++) { + if (constant_int[i] == value) { + return i; + } + } + return 0; + } + + public int getUIntId(long value) { + for (int i = 1; i < constant_uint.length; i++) { + if (constant_uint[i] == value) { + return i; + } + } + return 0; + } + + public int getDoubleId(double value) { + for (int i = 1; i < constant_double.length; i++) { + if (constant_double[i] == value) { + return i; + } + } + return 0; + } + + public int getStringId(String s) { + for (int i = 1; i < constant_string.length; i++) { + if (constant_string[i].equals(s)) { + return i; + } + } + return 0; + } + + public int getMultiNameId(String s) { + for (int i = 1; i < constant_multiname.length; i++) { + if (constant_multiname[i].getName(this).equals(s)) { + return i; + } + } + return 0; + } + + public void dump(OutputStream os) { + PrintStream output = new PrintStream(os); + String s = ""; + for (int i = 1; i < constant_int.length; i++) { + output.println("INT[" + i + "]=" + constant_int[i]); + } + for (int i = 1; i < constant_uint.length; i++) { + output.println("UINT[" + i + "]=" + constant_uint[i]); + } + for (int i = 1; i < constant_double.length; i++) { + output.println("Double[" + i + "]=" + constant_double[i]); + } + for (int i = 1; i < constant_string.length; i++) { + output.println("String[" + i + "]=" + constant_string[i]); + } + for (int i = 1; i < constant_namespace.length; i++) { + output.println("Namespace[" + i + "]=" + constant_namespace[i].toString(this)); + } + for (int i = 1; i < constant_namespace_set.length; i++) { + output.println("NamespaceSet[" + i + "]=" + constant_namespace_set[i].toString(this)); + } + + for (int i = 1; i < constant_multiname.length; i++) { + output.println("Multiname[" + i + "]=" + constant_multiname[i].toString(this)); + } + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/ConvertException.java b/trunk/src/com/jpexs/asdec/abc/avm2/ConvertException.java index dceb09739..982e54009 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/ConvertException.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/ConvertException.java @@ -1,14 +1,28 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2; - - -public class ConvertException extends Exception { - public int line; - public ConvertException(String s,int line) { - super(s+" on line "+line); - this.line=line; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2; + + +public class ConvertException extends Exception { + public int line; + public ConvertException(String s,int line) { + super(s+" on line "+line); + this.line=line; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/InvalidInstructionArguments.java b/trunk/src/com/jpexs/asdec/abc/avm2/InvalidInstructionArguments.java index eb484d2f5..d03826daa 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/InvalidInstructionArguments.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/InvalidInstructionArguments.java @@ -1,14 +1,28 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2; - - -public class InvalidInstructionArguments extends RuntimeException { - - public InvalidInstructionArguments() { - super("Invalid method arguments"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2; + + +public class InvalidInstructionArguments extends RuntimeException { + + public InvalidInstructionArguments() { + super("Invalid method arguments"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/LocalDataArea.java b/trunk/src/com/jpexs/asdec/abc/avm2/LocalDataArea.java index 4d6d1c459..a294940c3 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/LocalDataArea.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/LocalDataArea.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class LocalDataArea { - public Stack operandStack = new Stack(); - public Stack scopeStack = new Stack(); - public List localRegisters = new ArrayList(); - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + + +public class LocalDataArea { + public Stack operandStack = new Stack(); + public Stack scopeStack = new Stack(); + public List localRegisters = new ArrayList(); + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/UnknownInstructionCode.java b/trunk/src/com/jpexs/asdec/abc/avm2/UnknownInstructionCode.java index 1e996f77c..63778842a 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/UnknownInstructionCode.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/UnknownInstructionCode.java @@ -1,15 +1,29 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2; - - -public class UnknownInstructionCode extends RuntimeException { - public int code; - - public UnknownInstructionCode(int code) { - super("Unknown instruction code:" + Integer.toHexString(code)); - this.code = code; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2; + + +public class UnknownInstructionCode extends RuntimeException { + public int code; + + public UnknownInstructionCode(int code) { + super("Unknown instruction code:" + Integer.toHexString(code)); + this.code = code; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/UnknownJumpException.java b/trunk/src/com/jpexs/asdec/abc/avm2/UnknownJumpException.java index 23f655cd5..91167745c 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/UnknownJumpException.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/UnknownJumpException.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2; - -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - -import java.util.List; -import java.util.Stack; - - -public class UnknownJumpException extends RuntimeException { - public Stack stack; - public int ip; - public List output; - - public UnknownJumpException(Stack stack, int ip, List output) { - this.stack = stack; - this.ip = ip; - this.output = output; - } - - @Override - public String toString() { - return "Unknown jump to " + ip; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2; + +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + +import java.util.List; +import java.util.Stack; + + +public class UnknownJumpException extends RuntimeException { + public Stack stack; + public int ip; + public List output; + + public UnknownJumpException(Stack stack, int ip, List output) { + this.stack = stack; + this.ip = ip; + this.output = output; + } + + @Override + public String toString() { + return "Unknown jump to " + ip; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/AVM2Instruction.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/AVM2Instruction.java index fc4ec9900..363239ce3 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/AVM2Instruction.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/AVM2Instruction.java @@ -1,172 +1,186 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions; - -import com.jpexs.asdec.abc.ABCOutputStream; -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.helpers.Helper; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - - -public class AVM2Instruction { - - public InstructionDefinition definition; - public int operands[]; - public long offset; - public byte bytes[]; - public String comment; - public boolean ignored = false; - - public AVM2Instruction(long offset, InstructionDefinition definition, int[] operands, byte bytes[]) { - this.definition = definition; - this.operands = operands; - this.offset = offset; - this.bytes = bytes; - } - - public byte[] getBytes() { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - try { - ABCOutputStream aos = new ABCOutputStream(bos); - aos.write(definition.instructionCode); - for (int i = 0; i < definition.operands.length; i++) { - int opt = definition.operands[i] & 0xff00; - switch (opt) { - case AVM2Code.OPT_S24: - aos.writeS24(operands[i]); - break; - case AVM2Code.OPT_U30: - aos.writeU30(operands[i]); - break; - case AVM2Code.OPT_U8: - aos.writeU8(operands[i]); - break; - case AVM2Code.OPT_BYTE: - aos.writeU8(0xff & operands[i]); - break; - case AVM2Code.OPT_CASE_OFFSETS: - - aos.writeU30(operands[i]); //case count - for (int j = i + 1; j < operands.length; j++) { - aos.writeS24(operands[j]); - } - break; - } - } - } catch (IOException ex) { - //ignored - } - return bos.toByteArray(); - } - - @Override - public String toString() { - String s = definition.instructionName; - for (int i = 0; i < operands.length; i++) { - s += " " + operands[i]; - } - return s; - } - - public List getOffsets() { - List ret = new ArrayList(); - String s = ""; - for (int i = 0; i < definition.operands.length; i++) { - switch (definition.operands[i]) { - case AVM2Code.DAT_OFFSET: - ret.add(offset + operands[i] + getBytes().length); - break; - case AVM2Code.DAT_CASE_BASEOFFSET: - ret.add(offset + operands[i]); - break; - case AVM2Code.OPT_CASE_OFFSETS: - for (int j = i + 1; j < operands.length; j++) { - ret.add(offset + operands[j]); - } - break; - } - - } - return ret; - } - - public String getParams(ConstantPool constants) { - String s = ""; - for (int i = 0; i < definition.operands.length; i++) { - switch (definition.operands[i]) { - case AVM2Code.DAT_MULTINAME_INDEX: - s += " m[" + operands[i] + "]\"" + Helper.escapeString(constants.constant_multiname[operands[i]].toString(constants)) + "\""; - break; - case AVM2Code.DAT_STRING_INDEX: - s += " \"" + Helper.escapeString(constants.constant_string[operands[i]]) + "\""; - break; - case AVM2Code.DAT_INT_INDEX: - s += " " + constants.constant_int[operands[i]] + ""; - break; - case AVM2Code.DAT_UINT_INDEX: - s += " " + constants.constant_uint[operands[i]] + ""; - break; - case AVM2Code.DAT_DOUBLE_INDEX: - s += " " + constants.constant_double[operands[i]] + ""; - break; - case AVM2Code.DAT_OFFSET: - s += " "; - if (operands[i] > 0) { - //s += "+"; - }//operands[i] - s += "ofs" + Helper.formatAddress(offset + operands[i] + getBytes().length) + ""; - break; - case AVM2Code.DAT_CASE_BASEOFFSET: - s += " "; - if (operands[i] > 0) { - //s += "+"; - }//operands[i] - s += "ofs" + Helper.formatAddress(offset + operands[i]) + ""; - break; - case AVM2Code.OPT_CASE_OFFSETS: - s += " " + operands[i]; - for (int j = i + 1; j < operands.length; j++) { - s += " "; - if (operands[j] > 0) { - //s += "+"; - }//operands[j] - s += "ofs" + Helper.formatAddress(offset + operands[j]) + ""; - } - break; - default: - s += " " + operands[i]; - } - - } - return s; - } - - public String getComment() { - if (ignored) { - return " ;ignored"; - } - if ((comment == null) || comment.equals("")) { - return ""; - } - return " ;" + comment; - } - - public String toString(ConstantPool constants) { - String s = Helper.formatAddress(offset) + " " + Helper.padSpaceRight(Helper.byteArrToString(getBytes()), 30) + definition.instructionName; - s += getParams(constants) + getComment(); - return s; - } - - public String toStringNoAddress(ConstantPool constants) { - String s = definition.instructionName; - s += getParams(constants) + getComment(); - return s; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions; + +import com.jpexs.asdec.abc.ABCOutputStream; +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.helpers.Helper; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + + +public class AVM2Instruction { + + public InstructionDefinition definition; + public int operands[]; + public long offset; + public byte bytes[]; + public String comment; + public boolean ignored = false; + + public AVM2Instruction(long offset, InstructionDefinition definition, int[] operands, byte bytes[]) { + this.definition = definition; + this.operands = operands; + this.offset = offset; + this.bytes = bytes; + } + + public byte[] getBytes() { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + try { + ABCOutputStream aos = new ABCOutputStream(bos); + aos.write(definition.instructionCode); + for (int i = 0; i < definition.operands.length; i++) { + int opt = definition.operands[i] & 0xff00; + switch (opt) { + case AVM2Code.OPT_S24: + aos.writeS24(operands[i]); + break; + case AVM2Code.OPT_U30: + aos.writeU30(operands[i]); + break; + case AVM2Code.OPT_U8: + aos.writeU8(operands[i]); + break; + case AVM2Code.OPT_BYTE: + aos.writeU8(0xff & operands[i]); + break; + case AVM2Code.OPT_CASE_OFFSETS: + + aos.writeU30(operands[i]); //case count + for (int j = i + 1; j < operands.length; j++) { + aos.writeS24(operands[j]); + } + break; + } + } + } catch (IOException ex) { + //ignored + } + return bos.toByteArray(); + } + + @Override + public String toString() { + String s = definition.instructionName; + for (int i = 0; i < operands.length; i++) { + s += " " + operands[i]; + } + return s; + } + + public List getOffsets() { + List ret = new ArrayList(); + String s = ""; + for (int i = 0; i < definition.operands.length; i++) { + switch (definition.operands[i]) { + case AVM2Code.DAT_OFFSET: + ret.add(offset + operands[i] + getBytes().length); + break; + case AVM2Code.DAT_CASE_BASEOFFSET: + ret.add(offset + operands[i]); + break; + case AVM2Code.OPT_CASE_OFFSETS: + for (int j = i + 1; j < operands.length; j++) { + ret.add(offset + operands[j]); + } + break; + } + + } + return ret; + } + + public String getParams(ConstantPool constants) { + String s = ""; + for (int i = 0; i < definition.operands.length; i++) { + switch (definition.operands[i]) { + case AVM2Code.DAT_MULTINAME_INDEX: + s += " m[" + operands[i] + "]\"" + Helper.escapeString(constants.constant_multiname[operands[i]].toString(constants)) + "\""; + break; + case AVM2Code.DAT_STRING_INDEX: + s += " \"" + Helper.escapeString(constants.constant_string[operands[i]]) + "\""; + break; + case AVM2Code.DAT_INT_INDEX: + s += " " + constants.constant_int[operands[i]] + ""; + break; + case AVM2Code.DAT_UINT_INDEX: + s += " " + constants.constant_uint[operands[i]] + ""; + break; + case AVM2Code.DAT_DOUBLE_INDEX: + s += " " + constants.constant_double[operands[i]] + ""; + break; + case AVM2Code.DAT_OFFSET: + s += " "; + if (operands[i] > 0) { + //s += "+"; + }//operands[i] + s += "ofs" + Helper.formatAddress(offset + operands[i] + getBytes().length) + ""; + break; + case AVM2Code.DAT_CASE_BASEOFFSET: + s += " "; + if (operands[i] > 0) { + //s += "+"; + }//operands[i] + s += "ofs" + Helper.formatAddress(offset + operands[i]) + ""; + break; + case AVM2Code.OPT_CASE_OFFSETS: + s += " " + operands[i]; + for (int j = i + 1; j < operands.length; j++) { + s += " "; + if (operands[j] > 0) { + //s += "+"; + }//operands[j] + s += "ofs" + Helper.formatAddress(offset + operands[j]) + ""; + } + break; + default: + s += " " + operands[i]; + } + + } + return s; + } + + public String getComment() { + if (ignored) { + return " ;ignored"; + } + if ((comment == null) || comment.equals("")) { + return ""; + } + return " ;" + comment; + } + + public String toString(ConstantPool constants) { + String s = Helper.formatAddress(offset) + " " + Helper.padSpaceRight(Helper.byteArrToString(getBytes()), 30) + definition.instructionName; + s += getParams(constants) + getComment(); + return s; + } + + public String toStringNoAddress(ConstantPool constants) { + String s = definition.instructionName; + s += getParams(constants) + getComment(); + return s; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/IfTypeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/IfTypeIns.java index 312bea296..c6ae422b5 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/IfTypeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/IfTypeIns.java @@ -1,14 +1,28 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions; - -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - -import java.util.Stack; - - -public interface IfTypeIns { - public abstract void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins); -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions; + +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + +import java.util.Stack; + + +public interface IfTypeIns { + public abstract void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins); +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/InstructionDefinition.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/InstructionDefinition.java index 4d3e6c685..6c1ecdf65 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/InstructionDefinition.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/InstructionDefinition.java @@ -1,109 +1,123 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; -import com.jpexs.asdec.helpers.Highlighting; - -import java.util.List; -import java.util.Stack; - - -public class InstructionDefinition { - - - protected String hilighOffset(String text, long offset) { - return Highlighting.hilighOffset(text, offset); - } - - public int operands[]; - public String instructionName = ""; - public int instructionCode = 0; - - public static String localRegName(int reg) { - if (reg == 0) return "this"; - return "_loc" + reg + "_"; - } - - public InstructionDefinition(int instructionCode, String instructionName, int operands[]) { - this.instructionCode = instructionCode; - this.instructionName = instructionName; - this.operands = operands; - } - - @Override - public String toString() { - String s = instructionName; - for (int i = 0; i < operands.length; i++) { - if ((operands[i] & 0xff00) == AVM2Code.OPT_U30) { - s += " U30"; - } - if ((operands[i] & 0xff00) == AVM2Code.OPT_U8) { - s += " U8"; - } - if ((operands[i] & 0xff00) == AVM2Code.OPT_BYTE) { - s += " BYTE"; - } - if ((operands[i] & 0xff00) == AVM2Code.OPT_S24) { - s += " S24"; - } - if ((operands[i] & 0xff00) == AVM2Code.OPT_CASE_OFFSETS) { - s += " U30 S24,[S24]..."; - } - } - return s; - } - - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - } - - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - - } - - protected FullMultinameTreeItem resolveMultiname(Stack stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) { - TreeItem ns = null; - TreeItem name = null; - if (constants.constant_multiname[multinameIndex].needsNs()) { - ns = (TreeItem) stack.pop(); - } - if (constants.constant_multiname[multinameIndex].needsName()) { - name = (TreeItem) stack.pop(); - } - return new FullMultinameTreeItem(ins, multinameIndex, name, ns); - } - - protected int resolvedCount(ConstantPool constants, int multinameIndex) { - int pos = 0; - if (constants.constant_multiname[multinameIndex].needsNs()) { - pos++; - } - if (constants.constant_multiname[multinameIndex].needsName()) { - pos++; - } - return pos; - - } - - protected String resolveMultinameNoPop(int pos, Stack stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) { - String ns = ""; - String name = ""; - if (constants.constant_multiname[multinameIndex].needsNs()) { - ns = "[" + stack.get(pos) + "]"; - pos++; - } - if (constants.constant_multiname[multinameIndex].needsName()) { - name = stack.get(pos).toString(); - } else { - name = hilighOffset(constants.constant_multiname[multinameIndex].getName(constants), ins.offset); - } - return name + ns; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; +import com.jpexs.asdec.helpers.Highlighting; + +import java.util.List; +import java.util.Stack; + + +public class InstructionDefinition { + + + protected String hilighOffset(String text, long offset) { + return Highlighting.hilighOffset(text, offset); + } + + public int operands[]; + public String instructionName = ""; + public int instructionCode = 0; + + public static String localRegName(int reg) { + if (reg == 0) return "this"; + return "_loc" + reg + "_"; + } + + public InstructionDefinition(int instructionCode, String instructionName, int operands[]) { + this.instructionCode = instructionCode; + this.instructionName = instructionName; + this.operands = operands; + } + + @Override + public String toString() { + String s = instructionName; + for (int i = 0; i < operands.length; i++) { + if ((operands[i] & 0xff00) == AVM2Code.OPT_U30) { + s += " U30"; + } + if ((operands[i] & 0xff00) == AVM2Code.OPT_U8) { + s += " U8"; + } + if ((operands[i] & 0xff00) == AVM2Code.OPT_BYTE) { + s += " BYTE"; + } + if ((operands[i] & 0xff00) == AVM2Code.OPT_S24) { + s += " S24"; + } + if ((operands[i] & 0xff00) == AVM2Code.OPT_CASE_OFFSETS) { + s += " U30 S24,[S24]..."; + } + } + return s; + } + + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + } + + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + + } + + protected FullMultinameTreeItem resolveMultiname(Stack stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) { + TreeItem ns = null; + TreeItem name = null; + if (constants.constant_multiname[multinameIndex].needsNs()) { + ns = (TreeItem) stack.pop(); + } + if (constants.constant_multiname[multinameIndex].needsName()) { + name = (TreeItem) stack.pop(); + } + return new FullMultinameTreeItem(ins, multinameIndex, name, ns); + } + + protected int resolvedCount(ConstantPool constants, int multinameIndex) { + int pos = 0; + if (constants.constant_multiname[multinameIndex].needsNs()) { + pos++; + } + if (constants.constant_multiname[multinameIndex].needsName()) { + pos++; + } + return pos; + + } + + protected String resolveMultinameNoPop(int pos, Stack stack, ConstantPool constants, int multinameIndex, AVM2Instruction ins) { + String ns = ""; + String name = ""; + if (constants.constant_multiname[multinameIndex].needsNs()) { + ns = "[" + stack.get(pos) + "]"; + pos++; + } + if (constants.constant_multiname[multinameIndex].needsName()) { + name = stack.get(pos).toString(); + } else { + name = hilighOffset(constants.constant_multiname[multinameIndex].getName(constants), ins.offset); + } + return name + ns; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/SetTypeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/SetTypeIns.java index 66fc856d0..e67e68d5a 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/SetTypeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/SetTypeIns.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public interface SetTypeIns { - public abstract String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body); -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public interface SetTypeIns { + public abstract String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body); +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/AddIIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/AddIIns.java index 59de2f6d5..0a1f766f1 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/AddIIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/AddIIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.AddTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class AddIIns extends AddIns { - - public AddIIns() { - instructionName = "add_i"; - instructionCode = 0xc5; - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new AddTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.AddTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class AddIIns extends AddIns { + + public AddIIns() { + instructionName = "add_i"; + instructionCode = 0xc5; + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new AddTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/AddIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/AddIns.java index bd64e51af..3d500dc14 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/AddIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/AddIns.java @@ -1,53 +1,67 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.AddTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class AddIns extends InstructionDefinition { - - public AddIns() { - super(0xa0, "add", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Object o1 = lda.operandStack.pop(); - Object o2 = lda.operandStack.pop(); - if ((o1 instanceof Long) && ((o2 instanceof Long))) { - Long ret = new Long(((Long) o1).longValue() + ((Long) o2).longValue()); - lda.operandStack.push(ret); - } else if ((o1 instanceof Double) && ((o2 instanceof Double))) { - Double ret = new Double(((Double) o1).doubleValue() + ((Double) o2).doubleValue()); - lda.operandStack.push(ret); - } else if ((o1 instanceof Long) && ((o2 instanceof Double))) { - Double ret = new Double(((Long) o1).longValue() + ((Double) o2).doubleValue()); - lda.operandStack.push(ret); - } else if ((o1 instanceof Double) && ((o2 instanceof Long))) { - Double ret = new Double(((Double) o1).doubleValue() + ((Long) o2).longValue()); - lda.operandStack.push(ret); - } else { - String s = o1.toString() + o2.toString(); - lda.operandStack.push(s); - } - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new AddTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.AddTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class AddIns extends InstructionDefinition { + + public AddIns() { + super(0xa0, "add", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Object o1 = lda.operandStack.pop(); + Object o2 = lda.operandStack.pop(); + if ((o1 instanceof Long) && ((o2 instanceof Long))) { + Long ret = new Long(((Long) o1).longValue() + ((Long) o2).longValue()); + lda.operandStack.push(ret); + } else if ((o1 instanceof Double) && ((o2 instanceof Double))) { + Double ret = new Double(((Double) o1).doubleValue() + ((Double) o2).doubleValue()); + lda.operandStack.push(ret); + } else if ((o1 instanceof Long) && ((o2 instanceof Double))) { + Double ret = new Double(((Long) o1).longValue() + ((Double) o2).doubleValue()); + lda.operandStack.push(ret); + } else if ((o1 instanceof Double) && ((o2 instanceof Long))) { + Double ret = new Double(((Double) o1).doubleValue() + ((Long) o2).longValue()); + lda.operandStack.push(ret); + } else { + String s = o1.toString() + o2.toString(); + lda.operandStack.push(s); + } + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new AddTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/DecrementIIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/DecrementIIns.java index f19cf7753..2d2800b37 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/DecrementIIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/DecrementIIns.java @@ -1,47 +1,61 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.DecrementTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class DecrementIIns extends InstructionDefinition { - - public DecrementIIns() { - super(0xc1, "decrement_i", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Object obj = lda.operandStack.pop(); - if (obj instanceof Long) { - Long obj2 = ((Long) obj).longValue() - 1; - lda.operandStack.push(obj2); - } else if (obj instanceof Double) { - Double obj2 = ((Double) obj).doubleValue() - 1; - lda.operandStack.push(obj2); - } - if (obj instanceof String) { - Double obj2 = Double.parseDouble((String) obj) - 1; - lda.operandStack.push(obj2); - } else { - throw new RuntimeException("Cannot decrement local register"); - } - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new DecrementTreeItem(ins, (TreeItem) stack.pop())); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.DecrementTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class DecrementIIns extends InstructionDefinition { + + public DecrementIIns() { + super(0xc1, "decrement_i", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Object obj = lda.operandStack.pop(); + if (obj instanceof Long) { + Long obj2 = ((Long) obj).longValue() - 1; + lda.operandStack.push(obj2); + } else if (obj instanceof Double) { + Double obj2 = ((Double) obj).doubleValue() - 1; + lda.operandStack.push(obj2); + } + if (obj instanceof String) { + Double obj2 = Double.parseDouble((String) obj) - 1; + lda.operandStack.push(obj2); + } else { + throw new RuntimeException("Cannot decrement local register"); + } + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new DecrementTreeItem(ins, (TreeItem) stack.pop())); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/DecrementIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/DecrementIns.java index c64b96b30..133b120fa 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/DecrementIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/DecrementIns.java @@ -1,47 +1,61 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.DecrementTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class DecrementIns extends InstructionDefinition { - - public DecrementIns() { - super(0x93, "decrement", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Object obj = lda.operandStack.pop(); - if (obj instanceof Long) { - Long obj2 = ((Long) obj).longValue() - 1; - lda.operandStack.push(obj2); - } else if (obj instanceof Double) { - Double obj2 = ((Double) obj).doubleValue() - 1; - lda.operandStack.push(obj2); - } - if (obj instanceof String) { - Double obj2 = Double.parseDouble((String) obj) - 1; - lda.operandStack.push(obj2); - } else { - throw new RuntimeException("Cannot decrement local register"); - } - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new DecrementTreeItem(ins, (TreeItem) stack.pop())); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.DecrementTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class DecrementIns extends InstructionDefinition { + + public DecrementIns() { + super(0x93, "decrement", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Object obj = lda.operandStack.pop(); + if (obj instanceof Long) { + Long obj2 = ((Long) obj).longValue() - 1; + lda.operandStack.push(obj2); + } else if (obj instanceof Double) { + Double obj2 = ((Double) obj).doubleValue() - 1; + lda.operandStack.push(obj2); + } + if (obj instanceof String) { + Double obj2 = Double.parseDouble((String) obj) - 1; + lda.operandStack.push(obj2); + } else { + throw new RuntimeException("Cannot decrement local register"); + } + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new DecrementTreeItem(ins, (TreeItem) stack.pop())); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/DivideIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/DivideIns.java index 635a63633..bbf5a9d3f 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/DivideIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/DivideIns.java @@ -1,52 +1,66 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.DivideTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class DivideIns extends InstructionDefinition { - - public DivideIns() { - super(0xa3, "divide", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Object o1 = lda.operandStack.pop(); - Object o2 = lda.operandStack.pop(); - if ((o1 instanceof Long) && ((o2 instanceof Long))) { - Long ret = new Long(((Long) o1).longValue() / ((Long) o2).longValue()); - lda.operandStack.push(ret); - } else if ((o1 instanceof Double) && ((o2 instanceof Double))) { - Double ret = new Double(((Double) o1).doubleValue() / ((Double) o2).doubleValue()); - lda.operandStack.push(ret); - } else if ((o1 instanceof Long) && ((o2 instanceof Double))) { - Double ret = new Double(((Long) o1).longValue() / ((Double) o2).doubleValue()); - lda.operandStack.push(ret); - } else if ((o1 instanceof Double) && ((o2 instanceof Long))) { - Double ret = new Double(((Double) o1).doubleValue() / ((Long) o2).longValue()); - lda.operandStack.push(ret); - } else { - throw new RuntimeException("Cannot divide"); - } - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new DivideTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.DivideTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class DivideIns extends InstructionDefinition { + + public DivideIns() { + super(0xa3, "divide", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Object o1 = lda.operandStack.pop(); + Object o2 = lda.operandStack.pop(); + if ((o1 instanceof Long) && ((o2 instanceof Long))) { + Long ret = new Long(((Long) o1).longValue() / ((Long) o2).longValue()); + lda.operandStack.push(ret); + } else if ((o1 instanceof Double) && ((o2 instanceof Double))) { + Double ret = new Double(((Double) o1).doubleValue() / ((Double) o2).doubleValue()); + lda.operandStack.push(ret); + } else if ((o1 instanceof Long) && ((o2 instanceof Double))) { + Double ret = new Double(((Long) o1).longValue() / ((Double) o2).doubleValue()); + lda.operandStack.push(ret); + } else if ((o1 instanceof Double) && ((o2 instanceof Long))) { + Double ret = new Double(((Double) o1).doubleValue() / ((Long) o2).longValue()); + lda.operandStack.push(ret); + } else { + throw new RuntimeException("Cannot divide"); + } + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new DivideTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/IncrementIIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/IncrementIIns.java index 5192f1cbe..64cedcf7d 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/IncrementIIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/IncrementIIns.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.IncrementTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IncrementIIns extends InstructionDefinition { - - public IncrementIIns() { - super(0xc0, "increment_i", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new IncrementTreeItem(ins, (TreeItem) stack.pop())); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.IncrementTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IncrementIIns extends InstructionDefinition { + + public IncrementIIns() { + super(0xc0, "increment_i", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new IncrementTreeItem(ins, (TreeItem) stack.pop())); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/IncrementIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/IncrementIns.java index aebc0b4e6..3c040b33a 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/IncrementIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/IncrementIns.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.IncrementTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IncrementIns extends InstructionDefinition { - - public IncrementIns() { - super(0x91, "increment", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new IncrementTreeItem(ins, (TreeItem) stack.pop())); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.IncrementTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IncrementIns extends InstructionDefinition { + + public IncrementIns() { + super(0x91, "increment", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new IncrementTreeItem(ins, (TreeItem) stack.pop())); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/ModuloIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/ModuloIns.java index f3253b9c8..086af76a0 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/ModuloIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/ModuloIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.ModuloTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class ModuloIns extends InstructionDefinition { - - public ModuloIns() { - super(0xa4, "modulo", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new ModuloTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.ModuloTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class ModuloIns extends InstructionDefinition { + + public ModuloIns() { + super(0xa4, "modulo", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new ModuloTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/MultiplyIIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/MultiplyIIns.java index 6ad5ac346..b37d3811f 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/MultiplyIIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/MultiplyIIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.MultiplyTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class MultiplyIIns extends InstructionDefinition { - - public MultiplyIIns() { - super(0xc7, "multiply_i", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new MultiplyTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.MultiplyTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class MultiplyIIns extends InstructionDefinition { + + public MultiplyIIns() { + super(0xc7, "multiply_i", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new MultiplyTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/MultiplyIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/MultiplyIns.java index 3037173d2..8d3b32532 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/MultiplyIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/MultiplyIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.MultiplyTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class MultiplyIns extends InstructionDefinition { - - public MultiplyIns() { - super(0xa2, "multiply", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new MultiplyTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.MultiplyTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class MultiplyIns extends InstructionDefinition { + + public MultiplyIns() { + super(0xa2, "multiply", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new MultiplyTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/NegateIIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/NegateIIns.java index 179acf43e..361ab1d5b 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/NegateIIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/NegateIIns.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.NegTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class NegateIIns extends InstructionDefinition { - - public NegateIIns() { - super(0xc4, "negate_i", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v = (TreeItem) stack.pop(); - stack.push(new NegTreeItem(ins, v)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.NegTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class NegateIIns extends InstructionDefinition { + + public NegateIIns() { + super(0xc4, "negate_i", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v = (TreeItem) stack.pop(); + stack.push(new NegTreeItem(ins, v)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/NegateIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/NegateIns.java index 6ad4e25ef..f97792524 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/NegateIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/NegateIns.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.NegTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class NegateIns extends InstructionDefinition { - - public NegateIns() { - super(0x90, "negate", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v = (TreeItem) stack.pop(); - stack.push(new NegTreeItem(ins, v)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.NegTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class NegateIns extends InstructionDefinition { + + public NegateIns() { + super(0x90, "negate", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v = (TreeItem) stack.pop(); + stack.push(new NegTreeItem(ins, v)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/NotIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/NotIns.java index 164d26428..bee90a55c 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/NotIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/NotIns.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.NotTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class NotIns extends InstructionDefinition { - - public NotIns() { - super(0x96, "not", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v = (TreeItem) stack.pop(); - stack.push(new NotTreeItem(ins, v)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.NotTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class NotIns extends InstructionDefinition { + + public NotIns() { + super(0x96, "not", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v = (TreeItem) stack.pop(); + stack.push(new NotTreeItem(ins, v)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/SubtractIIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/SubtractIIns.java index 43a7d16bf..6e770f071 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/SubtractIIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/SubtractIIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.SubtractTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class SubtractIIns extends InstructionDefinition { - - public SubtractIIns() { - super(0xc6, "subtract_i", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new SubtractTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.SubtractTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class SubtractIIns extends InstructionDefinition { + + public SubtractIIns() { + super(0xc6, "subtract_i", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new SubtractTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/SubtractIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/SubtractIns.java index d52a0d3e3..7cfafdd11 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/SubtractIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/arithmetic/SubtractIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.arithmetic; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.SubtractTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class SubtractIns extends InstructionDefinition { - - public SubtractIns() { - super(0xa1, "subtract", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new SubtractTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.arithmetic; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.SubtractTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class SubtractIns extends InstructionDefinition { + + public SubtractIns() { + super(0xa1, "subtract", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new SubtractTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitAndIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitAndIns.java index 8fc5e88b6..8e17c4990 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitAndIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitAndIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.bitwise; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.BitAndTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class BitAndIns extends InstructionDefinition { - - public BitAndIns() { - super(0xa8, "bitand", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Long value2 = (Long) lda.operandStack.pop(); - Long value1 = (Long) lda.operandStack.pop(); - Long value3 = value1 & value2; - lda.operandStack.push(value3); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new BitAndTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.bitwise; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.BitAndTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class BitAndIns extends InstructionDefinition { + + public BitAndIns() { + super(0xa8, "bitand", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Long value2 = (Long) lda.operandStack.pop(); + Long value1 = (Long) lda.operandStack.pop(); + Long value3 = value1 & value2; + lda.operandStack.push(value3); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new BitAndTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitNotIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitNotIns.java index 6bdd23517..659e93ffc 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitNotIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitNotIns.java @@ -1,37 +1,51 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.bitwise; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.BitNotTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class BitNotIns extends InstructionDefinition { - - public BitNotIns() { - super(0x97, "bitnot", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Long value = (Long) lda.operandStack.pop(); - Long ret = new Long(-value.longValue()); - lda.operandStack.push(ret); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v = (TreeItem) stack.pop(); - stack.push(new BitNotTreeItem(ins, v)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.bitwise; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.BitNotTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class BitNotIns extends InstructionDefinition { + + public BitNotIns() { + super(0x97, "bitnot", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Long value = (Long) lda.operandStack.pop(); + Long ret = new Long(-value.longValue()); + lda.operandStack.push(ret); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v = (TreeItem) stack.pop(); + stack.push(new BitNotTreeItem(ins, v)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitOrIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitOrIns.java index cfc9162a2..c97578175 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitOrIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitOrIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.bitwise; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.BitOrTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class BitOrIns extends InstructionDefinition { - - public BitOrIns() { - super(0xa9, "bitor", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Long value2 = (Long) lda.operandStack.pop(); - Long value1 = (Long) lda.operandStack.pop(); - Long value3 = value1 | value2; - lda.operandStack.push(value3); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new BitOrTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.bitwise; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.BitOrTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class BitOrIns extends InstructionDefinition { + + public BitOrIns() { + super(0xa9, "bitor", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Long value2 = (Long) lda.operandStack.pop(); + Long value1 = (Long) lda.operandStack.pop(); + Long value3 = value1 | value2; + lda.operandStack.push(value3); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new BitOrTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitXorIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitXorIns.java index 642a3c4cc..c1396d733 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitXorIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/BitXorIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.bitwise; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.BitXorTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class BitXorIns extends InstructionDefinition { - - public BitXorIns() { - super(0xaa, "bitxor", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Long value2 = (Long) lda.operandStack.pop(); - Long value1 = (Long) lda.operandStack.pop(); - Long value3 = value1 ^ value2; - lda.operandStack.push(value3); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new BitXorTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.bitwise; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.BitXorTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class BitXorIns extends InstructionDefinition { + + public BitXorIns() { + super(0xaa, "bitxor", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Long value2 = (Long) lda.operandStack.pop(); + Long value1 = (Long) lda.operandStack.pop(); + Long value3 = value1 ^ value2; + lda.operandStack.push(value3); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new BitXorTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/LShiftIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/LShiftIns.java index 75546b52d..5d7a76d22 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/LShiftIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/LShiftIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.bitwise; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.LShiftTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class LShiftIns extends InstructionDefinition { - - public LShiftIns() { - super(0xa5, "lshift", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new LShiftTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.bitwise; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.LShiftTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class LShiftIns extends InstructionDefinition { + + public LShiftIns() { + super(0xa5, "lshift", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new LShiftTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/RShiftIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/RShiftIns.java index a06dd270d..181d1081b 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/RShiftIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/RShiftIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.bitwise; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.RShiftTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class RShiftIns extends InstructionDefinition { - - public RShiftIns() { - super(0xa6, "rshift", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new RShiftTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.bitwise; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.RShiftTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class RShiftIns extends InstructionDefinition { + + public RShiftIns() { + super(0xa6, "rshift", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new RShiftTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/URShiftIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/URShiftIns.java index a8f7a639e..df98232ec 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/URShiftIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/bitwise/URShiftIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.bitwise; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.URShiftTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class URShiftIns extends InstructionDefinition { - - public URShiftIns() { - super(0xa7, "urshift", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new URShiftTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.bitwise; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.URShiftTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class URShiftIns extends InstructionDefinition { + + public URShiftIns() { + super(0xa7, "urshift", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new URShiftTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/EqualsIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/EqualsIns.java index a8f3e1f1a..8ad1ebfe7 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/EqualsIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/EqualsIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.comparsion; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.EqTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class EqualsIns extends InstructionDefinition { - - public EqualsIns() { - super(0xab, "equals", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Object obj1 = lda.operandStack.pop(); - Object obj2 = lda.operandStack.pop(); - Boolean res = obj1.equals(obj2); - lda.operandStack.push(res); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new EqTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.comparsion; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.EqTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class EqualsIns extends InstructionDefinition { + + public EqualsIns() { + super(0xab, "equals", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Object obj1 = lda.operandStack.pop(); + Object obj2 = lda.operandStack.pop(); + Boolean res = obj1.equals(obj2); + lda.operandStack.push(res); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new EqTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/GreaterEqualsIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/GreaterEqualsIns.java index 5da2c1df2..885cf03ed 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/GreaterEqualsIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/GreaterEqualsIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.comparsion; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class GreaterEqualsIns extends InstructionDefinition { - - public GreaterEqualsIns() { - super(0xb0, "greaterequals", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new GeTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.comparsion; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class GreaterEqualsIns extends InstructionDefinition { + + public GreaterEqualsIns() { + super(0xb0, "greaterequals", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new GeTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/GreaterThanIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/GreaterThanIns.java index a90b33d9f..6cdd9ee9e 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/GreaterThanIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/GreaterThanIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.comparsion; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class GreaterThanIns extends InstructionDefinition { - - public GreaterThanIns() { - super(0xaf, "greaterthan", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new LtTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.comparsion; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class GreaterThanIns extends InstructionDefinition { + + public GreaterThanIns() { + super(0xaf, "greaterthan", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new LtTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/LessEqualsIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/LessEqualsIns.java index 95cb78d6d..3e75b7ec1 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/LessEqualsIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/LessEqualsIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.comparsion; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class LessEqualsIns extends InstructionDefinition { - - public LessEqualsIns() { - super(0xae, "lessequals", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new LeTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.comparsion; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class LessEqualsIns extends InstructionDefinition { + + public LessEqualsIns() { + super(0xae, "lessequals", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new LeTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/LessThanIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/LessThanIns.java index 6a4c7c8a7..09fc202ae 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/LessThanIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/LessThanIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.comparsion; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class LessThanIns extends InstructionDefinition { - - public LessThanIns() { - super(0xad, "lessthan", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new GtTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.comparsion; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class LessThanIns extends InstructionDefinition { + + public LessThanIns() { + super(0xad, "lessthan", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new GtTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/StrictEqualsIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/StrictEqualsIns.java index ed66e035f..e84e871c4 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/StrictEqualsIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/comparsion/StrictEqualsIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.comparsion; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictEqTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class StrictEqualsIns extends InstructionDefinition { - - public StrictEqualsIns() { - super(0xac, "strictequals", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new StrictEqTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.comparsion; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictEqTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class StrictEqualsIns extends InstructionDefinition { + + public StrictEqualsIns() { + super(0xac, "strictequals", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new StrictEqTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/ConstructIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/ConstructIns.java index b0deb7a02..d30d6a98d 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/ConstructIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/ConstructIns.java @@ -1,50 +1,64 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.construction; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.ConstructTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class ConstructIns extends InstructionDefinition { - - public ConstructIns() { - super(0x42, "construct", new int[]{AVM2Code.DAT_ARG_COUNT}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int argCount = (int) ((Long) arguments.get(0)).longValue(); - List passArguments = new ArrayList(); - for (int i = argCount - 1; i >= 0; i--) { - passArguments.set(i, lda.operandStack.pop()); - } - Object obj = lda.operandStack.pop(); - throw new RuntimeException("Cannot call constructor"); - //call construct property of obj - //push new instance - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int argCount = ins.operands[0]; - List args = new ArrayList(); - for (int a = 0; a < argCount; a++) { - args.add(0, (TreeItem) stack.pop()); - } - TreeItem obj = (TreeItem) stack.pop(); - stack.push(new ConstructTreeItem(ins, obj, args)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.construction; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.ConstructTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + + +public class ConstructIns extends InstructionDefinition { + + public ConstructIns() { + super(0x42, "construct", new int[]{AVM2Code.DAT_ARG_COUNT}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int argCount = (int) ((Long) arguments.get(0)).longValue(); + List passArguments = new ArrayList(); + for (int i = argCount - 1; i >= 0; i--) { + passArguments.set(i, lda.operandStack.pop()); + } + Object obj = lda.operandStack.pop(); + throw new RuntimeException("Cannot call constructor"); + //call construct property of obj + //push new instance + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int argCount = ins.operands[0]; + List args = new ArrayList(); + for (int a = 0; a < argCount; a++) { + args.add(0, (TreeItem) stack.pop()); + } + TreeItem obj = (TreeItem) stack.pop(); + stack.push(new ConstructTreeItem(ins, obj, args)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/ConstructPropIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/ConstructPropIns.java index 0dc3eec84..15ff35285 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/ConstructPropIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/ConstructPropIns.java @@ -1,57 +1,71 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.construction; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.ConstructPropTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class ConstructPropIns extends InstructionDefinition { - - public ConstructPropIns() { - super(0x4a, "constructprop", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); - int argCount = (int) ((Long) arguments.get(1)).longValue(); - List passArguments = new ArrayList(); - for (int i = argCount - 1; i >= 0; i--) { - passArguments.set(i, lda.operandStack.pop()); - } - //if multiname[multinameIndex] is runtime - //pop(name) pop(ns) - throw new RuntimeException("Cannot construct property"); - //create property - //push new instance - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - int argCount = ins.operands[1]; - List args = new ArrayList(); - for (int a = 0; a < argCount; a++) { - args.add(0, (TreeItem) stack.pop()); - } - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - TreeItem obj = (TreeItem) stack.pop(); - - - stack.push(new ConstructPropTreeItem(ins, obj, multiname, args)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.construction; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.ConstructPropTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + + +public class ConstructPropIns extends InstructionDefinition { + + public ConstructPropIns() { + super(0x4a, "constructprop", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); + int argCount = (int) ((Long) arguments.get(1)).longValue(); + List passArguments = new ArrayList(); + for (int i = argCount - 1; i >= 0; i--) { + passArguments.set(i, lda.operandStack.pop()); + } + //if multiname[multinameIndex] is runtime + //pop(name) pop(ns) + throw new RuntimeException("Cannot construct property"); + //create property + //push new instance + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + int argCount = ins.operands[1]; + List args = new ArrayList(); + for (int a = 0; a < argCount; a++) { + args.add(0, (TreeItem) stack.pop()); + } + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + TreeItem obj = (TreeItem) stack.pop(); + + + stack.push(new ConstructPropTreeItem(ins, obj, multiname, args)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/ConstructSuperIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/ConstructSuperIns.java index 080120606..316e5861c 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/ConstructSuperIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/ConstructSuperIns.java @@ -1,50 +1,64 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.construction; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.ConstructSuperTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class ConstructSuperIns extends InstructionDefinition { - - public ConstructSuperIns() { - super(0x49, "constructsuper", new int[]{AVM2Code.DAT_ARG_COUNT}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int argCount = (int) ((Long) arguments.get(0)).longValue(); - List passArguments = new ArrayList(); - for (int i = argCount - 1; i >= 0; i--) { - passArguments.set(i, lda.operandStack.pop()); - } - Object obj = lda.operandStack.pop(); - throw new RuntimeException("Cannot call super constructor"); - //call construct property of obj - //do not push anything - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int argCount = ins.operands[0]; - List args = new ArrayList(); - for (int a = 0; a < argCount; a++) { - args.add(0, (TreeItem) stack.pop()); - } - TreeItem obj = (TreeItem) stack.pop(); - output.add(new ConstructSuperTreeItem(ins, obj, args)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.construction; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.ConstructSuperTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + + +public class ConstructSuperIns extends InstructionDefinition { + + public ConstructSuperIns() { + super(0x49, "constructsuper", new int[]{AVM2Code.DAT_ARG_COUNT}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int argCount = (int) ((Long) arguments.get(0)).longValue(); + List passArguments = new ArrayList(); + for (int i = argCount - 1; i >= 0; i--) { + passArguments.set(i, lda.operandStack.pop()); + } + Object obj = lda.operandStack.pop(); + throw new RuntimeException("Cannot call super constructor"); + //call construct property of obj + //do not push anything + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int argCount = ins.operands[0]; + List args = new ArrayList(); + for (int a = 0; a < argCount; a++) { + args.add(0, (TreeItem) stack.pop()); + } + TreeItem obj = (TreeItem) stack.pop(); + output.add(new ConstructSuperTreeItem(ins, obj, args)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewActivationIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewActivationIns.java index b8c0e8afd..7e32a6627 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewActivationIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewActivationIns.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.construction; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class NewActivationIns extends InstructionDefinition { - - public NewActivationIns() { - super(0x57, "newactivation", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new NewActivationTreeItem(ins)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.construction; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class NewActivationIns extends InstructionDefinition { + + public NewActivationIns() { + super(0x57, "newactivation", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new NewActivationTreeItem(ins)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewArrayIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewArrayIns.java index d8f5ceb85..b21cd2ce5 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewArrayIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewArrayIns.java @@ -1,35 +1,49 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.construction; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.NewArrayTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class NewArrayIns extends InstructionDefinition { - - public NewArrayIns() { - super(0x56, "newarray", new int[]{AVM2Code.DAT_ARG_COUNT}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int argCount = ins.operands[0]; - List args = new ArrayList(); - for (int a = 0; a < argCount; a++) { - args.add(0, (TreeItem) stack.pop()); - } - stack.push(new NewArrayTreeItem(ins, args)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.construction; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.NewArrayTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + + +public class NewArrayIns extends InstructionDefinition { + + public NewArrayIns() { + super(0x56, "newarray", new int[]{AVM2Code.DAT_ARG_COUNT}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int argCount = ins.operands[0]; + List args = new ArrayList(); + for (int a = 0; a < argCount; a++) { + args.add(0, (TreeItem) stack.pop()); + } + stack.push(new NewArrayTreeItem(ins, args)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewCatchIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewCatchIns.java index 20f1daf4f..4eb7c8533 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewCatchIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewCatchIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.construction; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.clauses.ExceptionTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class NewCatchIns extends InstructionDefinition { - - public NewCatchIns() { - super(0x5a, "newcatch", new int[]{AVM2Code.DAT_EXCEPTION_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int exInfo = ins.operands[0]; - stack.push(new ExceptionTreeItem(body.exceptions[exInfo])); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.construction; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.clauses.ExceptionTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class NewCatchIns extends InstructionDefinition { + + public NewCatchIns() { + super(0x5a, "newcatch", new int[]{AVM2Code.DAT_EXCEPTION_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int exInfo = ins.operands[0]; + stack.push(new ExceptionTreeItem(body.exceptions[exInfo])); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewClassIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewClassIns.java index 3c4939b38..5746f4195 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewClassIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewClassIns.java @@ -1,31 +1,45 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.construction; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.UnparsedTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class NewClassIns extends InstructionDefinition { - - public NewClassIns() { - super(0x58, "newclass", new int[]{AVM2Code.DAT_CLASS_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int clsIndex = ins.operands[0]; - String baseType = stack.pop().toString(); - stack.push(new UnparsedTreeItem(ins, "new class(" + clsIndex + ") extends " + baseType)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.construction; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.UnparsedTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class NewClassIns extends InstructionDefinition { + + public NewClassIns() { + super(0x58, "newclass", new int[]{AVM2Code.DAT_CLASS_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int clsIndex = ins.operands[0]; + String baseType = stack.pop().toString(); + stack.push(new UnparsedTreeItem(ins, "new class(" + clsIndex + ") extends " + baseType)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewFunctionIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewFunctionIns.java index 002113cfa..fc9a16241 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewFunctionIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewFunctionIns.java @@ -1,36 +1,50 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.construction; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.NewFunctionTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodBody; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class NewFunctionIns extends InstructionDefinition { - - public NewFunctionIns() { - super(0x40, "newfunction", new int[]{AVM2Code.DAT_METHOD_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int methodIndex = ins.operands[0]; - MethodBody mybody = abc.findBody(methodIndex); - String bodyStr = ""; - if (mybody != null) { - bodyStr = mybody.toString(isStatic, classIndex, abc, constants, method_info, false); - } - stack.push(new NewFunctionTreeItem(ins, method_info[methodIndex].getParamStr(constants), method_info[methodIndex].getReturnTypeStr(constants), bodyStr)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.construction; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.NewFunctionTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodBody; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class NewFunctionIns extends InstructionDefinition { + + public NewFunctionIns() { + super(0x40, "newfunction", new int[]{AVM2Code.DAT_METHOD_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int methodIndex = ins.operands[0]; + MethodBody mybody = abc.findBody(methodIndex); + String bodyStr = ""; + if (mybody != null) { + bodyStr = mybody.toString(isStatic, classIndex, abc, constants, method_info, false); + } + stack.push(new NewFunctionTreeItem(ins, method_info[methodIndex].getParamStr(constants), method_info[methodIndex].getReturnTypeStr(constants), bodyStr)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewObjectIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewObjectIns.java index b900e8cd7..ab77edc03 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewObjectIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/construction/NewObjectIns.java @@ -1,38 +1,52 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.construction; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.NameValuePair; -import com.jpexs.asdec.abc.avm2.treemodel.NewObjectTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class NewObjectIns extends InstructionDefinition { - - public NewObjectIns() { - super(0x55, "newobject", new int[]{AVM2Code.DAT_ARG_COUNT}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int argCount = ins.operands[0]; - List args = new ArrayList(); - for (int a = 0; a < argCount; a++) { - TreeItem value = (TreeItem) stack.pop(); - TreeItem name = (TreeItem) stack.pop(); - args.add(0, new NameValuePair(name, value)); - } - stack.push(new NewObjectTreeItem(ins, args)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.construction; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.NameValuePair; +import com.jpexs.asdec.abc.avm2.treemodel.NewObjectTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + + +public class NewObjectIns extends InstructionDefinition { + + public NewObjectIns() { + super(0x55, "newobject", new int[]{AVM2Code.DAT_ARG_COUNT}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int argCount = ins.operands[0]; + List args = new ArrayList(); + for (int a = 0; a < argCount; a++) { + TreeItem value = (TreeItem) stack.pop(); + TreeItem name = (TreeItem) stack.pop(); + args.add(0, new NameValuePair(name, value)); + } + stack.push(new NewObjectTreeItem(ins, args)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/debug/DebugFileIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/debug/DebugFileIns.java index ccb164c6d..3428a6b06 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/debug/DebugFileIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/debug/DebugFileIns.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.debug; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; - - -public class DebugFileIns extends InstructionDefinition { - - public DebugFileIns() { - super(0xf1, "debugfile", new int[]{AVM2Code.DAT_STRING_INDEX}); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.debug; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; + + +public class DebugFileIns extends InstructionDefinition { + + public DebugFileIns() { + super(0xf1, "debugfile", new int[]{AVM2Code.DAT_STRING_INDEX}); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/debug/DebugIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/debug/DebugIns.java index 4be88beb0..06d5204b7 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/debug/DebugIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/debug/DebugIns.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.debug; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; - - -public class DebugIns extends InstructionDefinition { - - public DebugIns() { - super(0xef, "debug", new int[]{AVM2Code.DAT_DEBUG_TYPE, AVM2Code.DAT_STRING_INDEX, AVM2Code.DAT_REGISTER_INDEX, AVM2Code.OPT_U30}); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.debug; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; + + +public class DebugIns extends InstructionDefinition { + + public DebugIns() { + super(0xef, "debug", new int[]{AVM2Code.DAT_DEBUG_TYPE, AVM2Code.DAT_STRING_INDEX, AVM2Code.DAT_REGISTER_INDEX, AVM2Code.OPT_U30}); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/debug/DebugLineIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/debug/DebugLineIns.java index 075d02dc1..b571bfedb 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/debug/DebugLineIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/debug/DebugLineIns.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.debug; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; - - -public class DebugLineIns extends InstructionDefinition { - - public DebugLineIns() { - super(0xf0, "debugline", new int[]{AVM2Code.DAT_LINENUM}); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.debug; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; + + +public class DebugLineIns extends InstructionDefinition { + + public DebugLineIns() { + super(0xf0, "debugline", new int[]{AVM2Code.DAT_LINENUM}); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallIns.java index 40d2b0044..75dfbff94 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallIns.java @@ -1,51 +1,65 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.executing; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.CallTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class CallIns extends InstructionDefinition { - - public CallIns() { - super(0x41, "call", new int[]{AVM2Code.DAT_ARG_COUNT}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int argCount = (int) ((Long) arguments.get(0)).longValue(); - List passArguments = new ArrayList(); - for (int i = argCount - 1; i >= 0; i--) { - passArguments.set(i, lda.operandStack.pop()); - } - Object receiver = lda.operandStack.pop(); - Object function = lda.operandStack.pop(); - throw new RuntimeException("Call to unknown function"); - //push(result) - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int argCount = ins.operands[0]; - List args = new ArrayList(); - for (int a = 0; a < argCount; a++) { - args.add(0, (TreeItem) stack.pop()); - } - TreeItem receiver = (TreeItem) stack.pop(); - TreeItem function = (TreeItem) stack.pop(); - stack.push(new CallTreeItem(ins, receiver, function, args)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.executing; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.CallTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + + +public class CallIns extends InstructionDefinition { + + public CallIns() { + super(0x41, "call", new int[]{AVM2Code.DAT_ARG_COUNT}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int argCount = (int) ((Long) arguments.get(0)).longValue(); + List passArguments = new ArrayList(); + for (int i = argCount - 1; i >= 0; i--) { + passArguments.set(i, lda.operandStack.pop()); + } + Object receiver = lda.operandStack.pop(); + Object function = lda.operandStack.pop(); + throw new RuntimeException("Call to unknown function"); + //push(result) + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int argCount = ins.operands[0]; + List args = new ArrayList(); + for (int a = 0; a < argCount; a++) { + args.add(0, (TreeItem) stack.pop()); + } + TreeItem receiver = (TreeItem) stack.pop(); + TreeItem function = (TreeItem) stack.pop(); + stack.push(new CallTreeItem(ins, receiver, function, args)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallMethodIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallMethodIns.java index 0ff297b48..4f90f3775 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallMethodIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallMethodIns.java @@ -1,52 +1,66 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.executing; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.CallMethodTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class CallMethodIns extends InstructionDefinition { - - public CallMethodIns() { - super(0x43, "callmethod", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of object's method - int argCount = (int) ((Long) arguments.get(1)).longValue(); - List passArguments = new ArrayList(); - for (int i = argCount - 1; i >= 0; i--) { - passArguments.set(i, lda.operandStack.pop()); - } - Object receiver = lda.operandStack.pop(); - throw new RuntimeException("Call to unknown method"); - //push(result) - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int methodIndex = ins.operands[0]; - int argCount = ins.operands[1]; - List args = new ArrayList(); - for (int a = 0; a < argCount; a++) { - args.add(0, (TreeItem) stack.pop()); - } - TreeItem receiver = (TreeItem) stack.pop(); - String methodName = method_info[methodIndex].getName(constants); - stack.push(new CallMethodTreeItem(ins, receiver, methodName, args)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.executing; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.CallMethodTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + + +public class CallMethodIns extends InstructionDefinition { + + public CallMethodIns() { + super(0x43, "callmethod", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of object's method + int argCount = (int) ((Long) arguments.get(1)).longValue(); + List passArguments = new ArrayList(); + for (int i = argCount - 1; i >= 0; i--) { + passArguments.set(i, lda.operandStack.pop()); + } + Object receiver = lda.operandStack.pop(); + throw new RuntimeException("Call to unknown method"); + //push(result) + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int methodIndex = ins.operands[0]; + int argCount = ins.operands[1]; + List args = new ArrayList(); + for (int a = 0; a < argCount; a++) { + args.add(0, (TreeItem) stack.pop()); + } + TreeItem receiver = (TreeItem) stack.pop(); + String methodName = method_info[methodIndex].getName(constants); + stack.push(new CallMethodTreeItem(ins, receiver, methodName, args)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallPropLexIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallPropLexIns.java index 3a0c0934f..5a78f683d 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallPropLexIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallPropLexIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.executing; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.CallPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class CallPropLexIns extends CallPropertyIns { - - public CallPropLexIns() { - instructionName = "callproplex"; - instructionCode = 0x4c; - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - int argCount = ins.operands[1]; - List args = new ArrayList(); - for (int a = 0; a < argCount; a++) { - args.add(0, (TreeItem) stack.pop()); - } - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - TreeItem receiver = (TreeItem) stack.pop(); - - stack.push(new CallPropertyTreeItem(ins, false, receiver, multiname, args)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.executing; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.CallPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + + +public class CallPropLexIns extends CallPropertyIns { + + public CallPropLexIns() { + instructionName = "callproplex"; + instructionCode = 0x4c; + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + int argCount = ins.operands[1]; + List args = new ArrayList(); + for (int a = 0; a < argCount; a++) { + args.add(0, (TreeItem) stack.pop()); + } + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + TreeItem receiver = (TreeItem) stack.pop(); + + stack.push(new CallPropertyTreeItem(ins, false, receiver, multiname, args)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallPropVoidIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallPropVoidIns.java index 87a9c4b85..b522caee8 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallPropVoidIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallPropVoidIns.java @@ -1,59 +1,73 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.executing; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.CallPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class CallPropVoidIns extends InstructionDefinition { - - public CallPropVoidIns() { - super(0x4f, "callpropvoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - //same as callproperty - - int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); - int argCount = (int) ((Long) arguments.get(1)).longValue(); - List passArguments = new ArrayList(); - for (int i = argCount - 1; i >= 0; i--) { - passArguments.set(i, lda.operandStack.pop()); - } - //if multiname[multinameIndex] is runtime - //pop(name) pop(ns) - Object obj = lda.operandStack.pop(); - throw new RuntimeException("Call to unknown property"); - //do not push anything - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - int argCount = ins.operands[1]; - List args = new ArrayList(); - for (int a = 0; a < argCount; a++) { - args.add(0, (TreeItem) stack.pop()); - } - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - - TreeItem receiver = (TreeItem) stack.pop(); - - output.add(new CallPropertyTreeItem(ins, true, receiver, multiname, args)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.executing; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.CallPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + + +public class CallPropVoidIns extends InstructionDefinition { + + public CallPropVoidIns() { + super(0x4f, "callpropvoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + //same as callproperty + + int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); + int argCount = (int) ((Long) arguments.get(1)).longValue(); + List passArguments = new ArrayList(); + for (int i = argCount - 1; i >= 0; i--) { + passArguments.set(i, lda.operandStack.pop()); + } + //if multiname[multinameIndex] is runtime + //pop(name) pop(ns) + Object obj = lda.operandStack.pop(); + throw new RuntimeException("Call to unknown property"); + //do not push anything + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + int argCount = ins.operands[1]; + List args = new ArrayList(); + for (int a = 0; a < argCount; a++) { + args.add(0, (TreeItem) stack.pop()); + } + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + + TreeItem receiver = (TreeItem) stack.pop(); + + output.add(new CallPropertyTreeItem(ins, true, receiver, multiname, args)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallPropertyIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallPropertyIns.java index 02158a55f..6173e1bde 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallPropertyIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallPropertyIns.java @@ -1,57 +1,71 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.executing; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.CallPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class CallPropertyIns extends InstructionDefinition { - - public CallPropertyIns() { - super(0x46, "callproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); - int argCount = (int) ((Long) arguments.get(1)).longValue(); - List passArguments = new ArrayList(); - for (int i = argCount - 1; i >= 0; i--) { - passArguments.set(i, lda.operandStack.pop()); - } - //if multiname[multinameIndex] is runtime - //pop(name) pop(ns) - Object obj = lda.operandStack.pop(); - throw new RuntimeException("Call to unknown property"); - //push(result) - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - int argCount = ins.operands[1]; - List args = new ArrayList(); - for (int a = 0; a < argCount; a++) { - args.add(0, (TreeItem) stack.pop()); - } - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - - TreeItem receiver = (TreeItem) stack.pop(); - - stack.push(new CallPropertyTreeItem(ins, false, receiver, multiname, args)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.executing; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.CallPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + + +public class CallPropertyIns extends InstructionDefinition { + + public CallPropertyIns() { + super(0x46, "callproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); + int argCount = (int) ((Long) arguments.get(1)).longValue(); + List passArguments = new ArrayList(); + for (int i = argCount - 1; i >= 0; i--) { + passArguments.set(i, lda.operandStack.pop()); + } + //if multiname[multinameIndex] is runtime + //pop(name) pop(ns) + Object obj = lda.operandStack.pop(); + throw new RuntimeException("Call to unknown property"); + //push(result) + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + int argCount = ins.operands[1]; + List args = new ArrayList(); + for (int a = 0; a < argCount; a++) { + args.add(0, (TreeItem) stack.pop()); + } + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + + TreeItem receiver = (TreeItem) stack.pop(); + + stack.push(new CallPropertyTreeItem(ins, false, receiver, multiname, args)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallStaticIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallStaticIns.java index 457a7002d..7a96c6331 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallStaticIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallStaticIns.java @@ -1,52 +1,66 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.executing; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.CallStaticTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class CallStaticIns extends InstructionDefinition { - - public CallStaticIns() { - super(0x44, "callstatic", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of method_info - int argCount = (int) ((Long) arguments.get(1)).longValue(); - List passArguments = new ArrayList(); - for (int i = argCount - 1; i >= 0; i--) { - passArguments.set(i, lda.operandStack.pop()); - } - Object receiver = lda.operandStack.pop(); - throw new RuntimeException("Call to unknown static method"); - //push(result) - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int methodIndex = ins.operands[0]; - int argCount = ins.operands[1]; - List args = new ArrayList(); - for (int a = 0; a < argCount; a++) { - args.add(0, (TreeItem) stack.pop()); - } - TreeItem receiver = (TreeItem) stack.pop(); - String methodName = method_info[methodIndex].getName(constants); - stack.push(new CallStaticTreeItem(ins, receiver, methodName, args)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.executing; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.CallStaticTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + + +public class CallStaticIns extends InstructionDefinition { + + public CallStaticIns() { + super(0x44, "callstatic", new int[]{AVM2Code.DAT_METHOD_INDEX, AVM2Code.DAT_ARG_COUNT}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int methodIndex = (int) ((Long) arguments.get(0)).longValue(); //index of method_info + int argCount = (int) ((Long) arguments.get(1)).longValue(); + List passArguments = new ArrayList(); + for (int i = argCount - 1; i >= 0; i--) { + passArguments.set(i, lda.operandStack.pop()); + } + Object receiver = lda.operandStack.pop(); + throw new RuntimeException("Call to unknown static method"); + //push(result) + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int methodIndex = ins.operands[0]; + int argCount = ins.operands[1]; + List args = new ArrayList(); + for (int a = 0; a < argCount; a++) { + args.add(0, (TreeItem) stack.pop()); + } + TreeItem receiver = (TreeItem) stack.pop(); + String methodName = method_info[methodIndex].getName(constants); + stack.push(new CallStaticTreeItem(ins, receiver, methodName, args)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallSuperIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallSuperIns.java index d68eac820..06a6e7463 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallSuperIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallSuperIns.java @@ -1,56 +1,70 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.executing; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.CallSuperTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class CallSuperIns extends InstructionDefinition { - - public CallSuperIns() { - super(0x45, "callsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); - int argCount = (int) ((Long) arguments.get(1)).longValue(); - List passArguments = new ArrayList(); - for (int i = argCount - 1; i >= 0; i--) { - passArguments.set(i, lda.operandStack.pop()); - } - //if multiname[multinameIndex] is runtime - //pop(name) pop(ns) - Object receiver = lda.operandStack.pop(); - throw new RuntimeException("Call to unknown super method"); - //push(result) - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - int argCount = ins.operands[1]; - List args = new ArrayList(); - for (int a = 0; a < argCount; a++) { - args.add(0, (TreeItem) stack.pop()); - } - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - TreeItem receiver = (TreeItem) stack.pop(); - - stack.push(new CallSuperTreeItem(ins, false, receiver, multiname, args)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.executing; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.CallSuperTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + + +public class CallSuperIns extends InstructionDefinition { + + public CallSuperIns() { + super(0x45, "callsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); + int argCount = (int) ((Long) arguments.get(1)).longValue(); + List passArguments = new ArrayList(); + for (int i = argCount - 1; i >= 0; i--) { + passArguments.set(i, lda.operandStack.pop()); + } + //if multiname[multinameIndex] is runtime + //pop(name) pop(ns) + Object receiver = lda.operandStack.pop(); + throw new RuntimeException("Call to unknown super method"); + //push(result) + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + int argCount = ins.operands[1]; + List args = new ArrayList(); + for (int a = 0; a < argCount; a++) { + args.add(0, (TreeItem) stack.pop()); + } + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + TreeItem receiver = (TreeItem) stack.pop(); + + stack.push(new CallSuperTreeItem(ins, false, receiver, multiname, args)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallSuperVoidIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallSuperVoidIns.java index 9954ef838..64438703f 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallSuperVoidIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/executing/CallSuperVoidIns.java @@ -1,57 +1,71 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.executing; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.CallSuperTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class CallSuperVoidIns extends InstructionDefinition { - - public CallSuperVoidIns() { - super(0x4e, "callsupervoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); - int argCount = (int) ((Long) arguments.get(1)).longValue(); - List passArguments = new ArrayList(); - for (int i = argCount - 1; i >= 0; i--) { - passArguments.set(i, lda.operandStack.pop()); - } - //if multiname[multinameIndex] is runtime - //pop(name) pop(ns) - Object receiver = lda.operandStack.pop(); - throw new RuntimeException("Call to unknown super method"); - //do not push anything - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - int argCount = ins.operands[1]; - List args = new ArrayList(); - for (int a = 0; a < argCount; a++) { - args.add((TreeItem) stack.pop()); - } - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - TreeItem receiver = (TreeItem) stack.pop(); - - output.add(new CallSuperTreeItem(ins, true, receiver, multiname, args)); - - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.executing; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.CallSuperTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; + + +public class CallSuperVoidIns extends InstructionDefinition { + + public CallSuperVoidIns() { + super(0x4e, "callsupervoid", new int[]{AVM2Code.DAT_MULTINAME_INDEX, AVM2Code.DAT_ARG_COUNT}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); + int argCount = (int) ((Long) arguments.get(1)).longValue(); + List passArguments = new ArrayList(); + for (int i = argCount - 1; i >= 0; i--) { + passArguments.set(i, lda.operandStack.pop()); + } + //if multiname[multinameIndex] is runtime + //pop(name) pop(ns) + Object receiver = lda.operandStack.pop(); + throw new RuntimeException("Call to unknown super method"); + //do not push anything + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + int argCount = ins.operands[1]; + List args = new ArrayList(); + for (int a = 0; a < argCount; a++) { + args.add((TreeItem) stack.pop()); + } + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + TreeItem receiver = (TreeItem) stack.pop(); + + output.add(new CallSuperTreeItem(ins, true, receiver, multiname, args)); + + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfEqIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfEqIns.java index 1e5914384..30193312c 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfEqIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfEqIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.EqTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.NeqTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IfEqIns extends InstructionDefinition implements IfTypeIns { - - public IfEqIns() { - super(0x13, "ifeq", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new EqTreeItem(ins, v1, v2)); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new NeqTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.EqTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.NeqTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IfEqIns extends InstructionDefinition implements IfTypeIns { + + public IfEqIns() { + super(0x13, "ifeq", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new EqTreeItem(ins, v1, v2)); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new NeqTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfFalseIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfFalseIns.java index 73423ca40..7e8b1184e 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfFalseIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfFalseIns.java @@ -1,36 +1,50 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.NotTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IfFalseIns extends InstructionDefinition implements IfTypeIns { - - public IfFalseIns() { - super(0x12, "iffalse", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new NotTreeItem(ins, v1)); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - //String v1 = stack.pop().toString(); - //stack.push("(" + v1 + ")"); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.NotTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IfFalseIns extends InstructionDefinition implements IfTypeIns { + + public IfFalseIns() { + super(0x12, "iffalse", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new NotTreeItem(ins, v1)); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + //String v1 = stack.pop().toString(); + //stack.push("(" + v1 + ")"); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfGeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfGeIns.java index 6297fb4ae..417af05ed 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfGeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfGeIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IfGeIns extends InstructionDefinition implements IfTypeIns { - - public IfGeIns() { - super(0x18, "ifge", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new GeTreeItem(ins, v1, v2)); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new LtTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IfGeIns extends InstructionDefinition implements IfTypeIns { + + public IfGeIns() { + super(0x18, "ifge", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new GeTreeItem(ins, v1, v2)); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new LtTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfGtIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfGtIns.java index 078834cc1..3be304f3f 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfGtIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfGtIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IfGtIns extends InstructionDefinition implements IfTypeIns { - - public IfGtIns() { - super(0x17, "ifgt", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new GtTreeItem(ins, v1, v2)); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new LeTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IfGtIns extends InstructionDefinition implements IfTypeIns { + + public IfGtIns() { + super(0x17, "ifgt", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new GtTreeItem(ins, v1, v2)); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new LeTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfLeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfLeIns.java index 7d2aa779b..06e0351ca 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfLeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfLeIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IfLeIns extends InstructionDefinition implements IfTypeIns { - - public IfLeIns() { - super(0x16, "ifle", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new LeTreeItem(ins, v1, v2)); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new GtTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IfLeIns extends InstructionDefinition implements IfTypeIns { + + public IfLeIns() { + super(0x16, "ifle", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new LeTreeItem(ins, v1, v2)); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new GtTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfLtIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfLtIns.java index 0bc647593..f36348b82 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfLtIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfLtIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IfLtIns extends InstructionDefinition implements IfTypeIns { - - public IfLtIns() { - super(0x15, "iflt", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new LtTreeItem(ins, v1, v2)); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new GeTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IfLtIns extends InstructionDefinition implements IfTypeIns { + + public IfLtIns() { + super(0x15, "iflt", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new LtTreeItem(ins, v1, v2)); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new GeTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNGeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNGeIns.java index 4a1731701..b5758c2c3 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNGeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNGeIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IfNGeIns extends InstructionDefinition implements IfTypeIns { - - public IfNGeIns() { - super(0x0f, "ifnge", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new LtTreeItem(ins, v1, v2)); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new GeTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IfNGeIns extends InstructionDefinition implements IfTypeIns { + + public IfNGeIns() { + super(0x0f, "ifnge", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new LtTreeItem(ins, v1, v2)); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new GeTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNGtIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNGtIns.java index 81495ce11..971d4c45e 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNGtIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNGtIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IfNGtIns extends InstructionDefinition implements IfTypeIns { - - public IfNGtIns() { - super(0x0e, "ifngt", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new LeTreeItem(ins, v1, v2)); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new GtTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IfNGtIns extends InstructionDefinition implements IfTypeIns { + + public IfNGtIns() { + super(0x0e, "ifngt", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new LeTreeItem(ins, v1, v2)); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new GtTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNLeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNLeIns.java index bafb9c11b..6e6d255ce 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNLeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNLeIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IfNLeIns extends InstructionDefinition implements IfTypeIns { - - public IfNLeIns() { - super(0x0d, "ifnle", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new GtTreeItem(ins, v1, v2)); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new LeTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.GtTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.LeTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IfNLeIns extends InstructionDefinition implements IfTypeIns { + + public IfNLeIns() { + super(0x0d, "ifnle", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new GtTreeItem(ins, v1, v2)); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new LeTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNLtIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNLtIns.java index 208ea73ee..b9b64f674 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNLtIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNLtIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IfNLtIns extends InstructionDefinition implements IfTypeIns { - - public IfNLtIns() { - super(0x0c, "ifnlt", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new GeTreeItem(ins, v1, v2)); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new LtTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.GeTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.LtTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IfNLtIns extends InstructionDefinition implements IfTypeIns { + + public IfNLtIns() { + super(0x0c, "ifnlt", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new GeTreeItem(ins, v1, v2)); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new LtTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNeIns.java index 19372f91e..a79b93cf8 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfNeIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.EqTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.NeqTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IfNeIns extends InstructionDefinition implements IfTypeIns { - - public IfNeIns() { - super(0x14, "ifne", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new NeqTreeItem(ins, v1, v2)); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new EqTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.EqTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.NeqTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IfNeIns extends InstructionDefinition implements IfTypeIns { + + public IfNeIns() { + super(0x14, "ifne", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new NeqTreeItem(ins, v1, v2)); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new EqTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfStrictEqIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfStrictEqIns.java index 141a4ae4c..dd9c8aac9 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfStrictEqIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfStrictEqIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictEqTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictNeqTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IfStrictEqIns extends InstructionDefinition implements IfTypeIns { - - public IfStrictEqIns() { - super(0x19, "ifstricteq", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new StrictEqTreeItem(ins, v1, v2)); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new StrictNeqTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictEqTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictNeqTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IfStrictEqIns extends InstructionDefinition implements IfTypeIns { + + public IfStrictEqIns() { + super(0x19, "ifstricteq", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new StrictEqTreeItem(ins, v1, v2)); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new StrictNeqTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfStrictNeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfStrictNeIns.java index f84c50411..10743ddc5 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfStrictNeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfStrictNeIns.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictEqTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictNeqTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IfStrictNeIns extends InstructionDefinition implements IfTypeIns { - - public IfStrictNeIns() { - super(0x1A, "ifstrictne", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new StrictNeqTreeItem(ins, v1, v2)); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - TreeItem v2 = (TreeItem) stack.pop(); - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new StrictEqTreeItem(ins, v1, v2)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictEqTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.StrictNeqTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IfStrictNeIns extends InstructionDefinition implements IfTypeIns { + + public IfStrictNeIns() { + super(0x1A, "ifstrictne", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new StrictNeqTreeItem(ins, v1, v2)); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + TreeItem v2 = (TreeItem) stack.pop(); + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new StrictEqTreeItem(ins, v1, v2)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfTrueIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfTrueIns.java index b99ff935a..9a4c6304d 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfTrueIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/IfTrueIns.java @@ -1,36 +1,50 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.NotTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IfTrueIns extends InstructionDefinition implements IfTypeIns { - - public IfTrueIns() { - super(0x11, "iftrue", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - //String v1 = stack.pop().toString(); - //stack.push("(" + v1 + ")"); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - TreeItem v1 = (TreeItem) stack.pop(); - stack.push(new NotTreeItem(ins, v1)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.NotTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IfTrueIns extends InstructionDefinition implements IfTypeIns { + + public IfTrueIns() { + super(0x11, "iftrue", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + //String v1 = stack.pop().toString(); + //stack.push("(" + v1 + ")"); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + TreeItem v1 = (TreeItem) stack.pop(); + stack.push(new NotTreeItem(ins, v1)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/JumpIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/JumpIns.java index 1a7655c46..861390d58 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/JumpIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/JumpIns.java @@ -1,34 +1,48 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.BooleanTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class JumpIns extends InstructionDefinition implements IfTypeIns { - - public JumpIns() { - super(0x10, "jump", new int[]{AVM2Code.DAT_OFFSET}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new BooleanTreeItem(ins, Boolean.TRUE));// + ins.operands[0]); - } - - public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { - - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.IfTypeIns; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.BooleanTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class JumpIns extends InstructionDefinition implements IfTypeIns { + + public JumpIns() { + super(0x10, "jump", new int[]{AVM2Code.DAT_OFFSET}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new BooleanTreeItem(ins, Boolean.TRUE));// + ins.operands[0]); + } + + public void translateInverted(java.util.HashMap localRegs, Stack stack, AVM2Instruction ins) { + + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/LookupSwitchIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/LookupSwitchIns.java index c7467427d..643b78a9f 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/LookupSwitchIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/jumps/LookupSwitchIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.jumps; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class LookupSwitchIns extends InstructionDefinition { - - public LookupSwitchIns() { - super(0x1b, "lookupswitch", new int[]{AVM2Code.DAT_CASE_BASEOFFSET, AVM2Code.OPT_CASE_OFFSETS}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int defaultOffset = ins.operands[0]; - int caseCount = ins.operands[1]; - //stack.push("switch(...)"); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.jumps; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class LookupSwitchIns extends InstructionDefinition { + + public LookupSwitchIns() { + super(0x1b, "lookupswitch", new int[]{AVM2Code.DAT_CASE_BASEOFFSET, AVM2Code.OPT_CASE_OFFSETS}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int defaultOffset = ins.operands[0]; + int caseCount = ins.operands[1]; + //stack.push("switch(...)"); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/DecLocalIIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/DecLocalIIns.java index a5c430b90..cdbcc8b79 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/DecLocalIIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/DecLocalIIns.java @@ -1,50 +1,64 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.DecLocalTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class DecLocalIIns extends InstructionDefinition { - - public DecLocalIIns() { - super(0xc3, "declocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int locRegIndex = (int) ((Long) arguments.get(0)).longValue(); - Object obj = lda.localRegisters.get(locRegIndex); - if (obj instanceof Long) { - Long obj2 = ((Long) obj).longValue() - 1; - lda.localRegisters.set(locRegIndex, obj2); - } else if (obj instanceof Double) { - Double obj2 = ((Double) obj).doubleValue() - 1; - lda.localRegisters.set(locRegIndex, obj2); - } - if (obj instanceof String) { - Double obj2 = Double.parseDouble((String) obj) - 1; - lda.localRegisters.set(locRegIndex, obj2); - } else { - throw new RuntimeException("Cannot decrement local register"); - } - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int regIndex = ins.operands[0]; - output.add(new DecLocalTreeItem(ins, regIndex)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.DecLocalTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class DecLocalIIns extends InstructionDefinition { + + public DecLocalIIns() { + super(0xc3, "declocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int locRegIndex = (int) ((Long) arguments.get(0)).longValue(); + Object obj = lda.localRegisters.get(locRegIndex); + if (obj instanceof Long) { + Long obj2 = ((Long) obj).longValue() - 1; + lda.localRegisters.set(locRegIndex, obj2); + } else if (obj instanceof Double) { + Double obj2 = ((Double) obj).doubleValue() - 1; + lda.localRegisters.set(locRegIndex, obj2); + } + if (obj instanceof String) { + Double obj2 = Double.parseDouble((String) obj) - 1; + lda.localRegisters.set(locRegIndex, obj2); + } else { + throw new RuntimeException("Cannot decrement local register"); + } + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int regIndex = ins.operands[0]; + output.add(new DecLocalTreeItem(ins, regIndex)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/DecLocalIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/DecLocalIns.java index 0bb8a3378..eb82b0d92 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/DecLocalIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/DecLocalIns.java @@ -1,51 +1,65 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.DecLocalTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class DecLocalIns extends InstructionDefinition { - - public DecLocalIns() { - super(0x94, "declocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int locRegIndex = (int) ((Long) arguments.get(0)).longValue(); - Object obj = lda.localRegisters.get(locRegIndex); - if (obj instanceof Long) { - Long obj2 = ((Long) obj).longValue() - 1; - lda.localRegisters.set(locRegIndex, obj2); - } else if (obj instanceof Double) { - Double obj2 = ((Double) obj).doubleValue() - 1; - lda.localRegisters.set(locRegIndex, obj2); - } - if (obj instanceof String) { - Double obj2 = Double.parseDouble((String) obj) - 1; - lda.localRegisters.set(locRegIndex, obj2); - } else { - throw new RuntimeException("Cannot decrement local register"); - } - } - - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int regIndex = ins.operands[0]; - output.add(new DecLocalTreeItem(ins, regIndex)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.DecLocalTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class DecLocalIns extends InstructionDefinition { + + public DecLocalIns() { + super(0x94, "declocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int locRegIndex = (int) ((Long) arguments.get(0)).longValue(); + Object obj = lda.localRegisters.get(locRegIndex); + if (obj instanceof Long) { + Long obj2 = ((Long) obj).longValue() - 1; + lda.localRegisters.set(locRegIndex, obj2); + } else if (obj instanceof Double) { + Double obj2 = ((Double) obj).doubleValue() - 1; + lda.localRegisters.set(locRegIndex, obj2); + } + if (obj instanceof String) { + Double obj2 = Double.parseDouble((String) obj) - 1; + lda.localRegisters.set(locRegIndex, obj2); + } else { + throw new RuntimeException("Cannot decrement local register"); + } + } + + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int regIndex = ins.operands[0]; + output.add(new DecLocalTreeItem(ins, regIndex)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal0Ins.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal0Ins.java index 9d92f9c50..1821ad9b8 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal0Ins.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal0Ins.java @@ -1,37 +1,51 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.ClassTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.ThisTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class GetLocal0Ins extends InstructionDefinition implements GetLocalTypeIns { - - public GetLocal0Ins() { - super(0xd0, "getlocal_0", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - if (isStatic) { - stack.push(new ClassTreeItem(abc.instance_info[classIndex].getName(constants).getName(constants))); - } else { - stack.push(new ThisTreeItem()); - } - } - - public int getRegisterId(AVM2Instruction par0) { - return 0; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.ClassTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.ThisTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class GetLocal0Ins extends InstructionDefinition implements GetLocalTypeIns { + + public GetLocal0Ins() { + super(0xd0, "getlocal_0", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + if (isStatic) { + stack.push(new ClassTreeItem(abc.instance_info[classIndex].getName(constants).getName(constants))); + } else { + stack.push(new ThisTreeItem()); + } + } + + public int getRegisterId(AVM2Instruction par0) { + return 0; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal1Ins.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal1Ins.java index c0e9aea2b..6278da758 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal1Ins.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal1Ins.java @@ -1,32 +1,46 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class GetLocal1Ins extends InstructionDefinition implements GetLocalTypeIns { - - public GetLocal1Ins() { - super(0xd1, "getlocal_1", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new LocalRegTreeItem(ins, 1, localRegs.get(1))); - } - - public int getRegisterId(AVM2Instruction par0) { - return 1; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class GetLocal1Ins extends InstructionDefinition implements GetLocalTypeIns { + + public GetLocal1Ins() { + super(0xd1, "getlocal_1", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new LocalRegTreeItem(ins, 1, localRegs.get(1))); + } + + public int getRegisterId(AVM2Instruction par0) { + return 1; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal2Ins.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal2Ins.java index b158ed173..ed5953552 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal2Ins.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal2Ins.java @@ -1,32 +1,46 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class GetLocal2Ins extends InstructionDefinition implements GetLocalTypeIns { - - public GetLocal2Ins() { - super(0xd2, "getlocal_2", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new LocalRegTreeItem(ins, 2, localRegs.get(2))); - } - - public int getRegisterId(AVM2Instruction par0) { - return 2; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class GetLocal2Ins extends InstructionDefinition implements GetLocalTypeIns { + + public GetLocal2Ins() { + super(0xd2, "getlocal_2", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new LocalRegTreeItem(ins, 2, localRegs.get(2))); + } + + public int getRegisterId(AVM2Instruction par0) { + return 2; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal3Ins.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal3Ins.java index 526b3ed3f..4bbe7a7ff 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal3Ins.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocal3Ins.java @@ -1,32 +1,46 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class GetLocal3Ins extends InstructionDefinition implements GetLocalTypeIns { - - public GetLocal3Ins() { - super(0xd3, "getlocal_3", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new LocalRegTreeItem(ins, 3, localRegs.get(3))); - } - - public int getRegisterId(AVM2Instruction par0) { - return 3; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class GetLocal3Ins extends InstructionDefinition implements GetLocalTypeIns { + + public GetLocal3Ins() { + super(0xd3, "getlocal_3", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new LocalRegTreeItem(ins, 3, localRegs.get(3))); + } + + public int getRegisterId(AVM2Instruction par0) { + return 3; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocalIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocalIns.java index 3dc1b3fa9..54ff59dad 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocalIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocalIns.java @@ -1,34 +1,48 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class GetLocalIns extends InstructionDefinition implements GetLocalTypeIns { - - public GetLocalIns() { - super(0x62, "getlocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int regIndex = ins.operands[0]; - stack.push(new LocalRegTreeItem(ins, regIndex, localRegs.get(regIndex))); - } - - public int getRegisterId(AVM2Instruction ins) { - return ins.operands[0]; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class GetLocalIns extends InstructionDefinition implements GetLocalTypeIns { + + public GetLocalIns() { + super(0x62, "getlocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int regIndex = ins.operands[0]; + stack.push(new LocalRegTreeItem(ins, regIndex, localRegs.get(regIndex))); + } + + public int getRegisterId(AVM2Instruction ins) { + return ins.operands[0]; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocalTypeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocalTypeIns.java index c59914f70..78fa99932 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocalTypeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/GetLocalTypeIns.java @@ -1,12 +1,26 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public interface GetLocalTypeIns { - public abstract int getRegisterId(AVM2Instruction ins); -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public interface GetLocalTypeIns { + public abstract int getRegisterId(AVM2Instruction ins); +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/IncLocalIIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/IncLocalIIns.java index acd13bbd5..a49f00a2c 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/IncLocalIIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/IncLocalIIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.IncLocalTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IncLocalIIns extends InstructionDefinition { - - public IncLocalIIns() { - super(0xc2, "inclocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int regIndex = ins.operands[0]; - output.add(new IncLocalTreeItem(ins, regIndex)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.IncLocalTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IncLocalIIns extends InstructionDefinition { + + public IncLocalIIns() { + super(0xc2, "inclocal_i", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int regIndex = ins.operands[0]; + output.add(new IncLocalTreeItem(ins, regIndex)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/IncLocalIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/IncLocalIns.java index 333bb24ac..b55d92ea4 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/IncLocalIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/IncLocalIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.IncLocalTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IncLocalIns extends InstructionDefinition { - - public IncLocalIns() { - super(0x92, "inclocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int regIndex = ins.operands[0]; - output.add(new IncLocalTreeItem(ins, regIndex)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.IncLocalTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IncLocalIns extends InstructionDefinition { + + public IncLocalIns() { + super(0x92, "inclocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int regIndex = ins.operands[0]; + output.add(new IncLocalTreeItem(ins, regIndex)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/KillIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/KillIns.java index fca427d9c..5e8af0df8 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/KillIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/KillIns.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class KillIns extends InstructionDefinition { - - public KillIns() { - super(0x08, "kill", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - //kill local register - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class KillIns extends InstructionDefinition { + + public KillIns() { + super(0x08, "kill", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + //kill local register + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal0Ins.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal0Ins.java index 27325da0e..bba8a60c5 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal0Ins.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal0Ins.java @@ -1,45 +1,59 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; -import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class SetLocal0Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns { - - public SetLocal0Ins() { - super(0xd4, "setlocal_0", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem val = (TreeItem) stack.pop(); - localRegs.put(0, val); - if (val instanceof NewActivationTreeItem) return; - if (val instanceof FindPropertyTreeItem) return; - //if(val.startsWith("catchscope ")) return; - //if(val.startsWith("newactivation()")) return; - output.add(new SetLocalTreeItem(ins, 0, val)); - } - - public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { - return localRegName(0); - } - - public int getRegisterId(AVM2Instruction ins) { - return 0; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; +import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class SetLocal0Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns { + + public SetLocal0Ins() { + super(0xd4, "setlocal_0", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem val = (TreeItem) stack.pop(); + localRegs.put(0, val); + if (val instanceof NewActivationTreeItem) return; + if (val instanceof FindPropertyTreeItem) return; + //if(val.startsWith("catchscope ")) return; + //if(val.startsWith("newactivation()")) return; + output.add(new SetLocalTreeItem(ins, 0, val)); + } + + public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { + return localRegName(0); + } + + public int getRegisterId(AVM2Instruction ins) { + return 0; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal1Ins.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal1Ins.java index 7cd3ed69a..077267174 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal1Ins.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal1Ins.java @@ -1,45 +1,59 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; -import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class SetLocal1Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns { - - public SetLocal1Ins() { - super(0xd5, "setlocal_1", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem val = (TreeItem) stack.pop(); - localRegs.put(1, val); - if (val instanceof NewActivationTreeItem) return; - if (val instanceof FindPropertyTreeItem) return; - //if(val.startsWith("catchscope ")) return; - //if(val.startsWith("newactivation()")) return; - output.add(new SetLocalTreeItem(ins, 1, val)); - } - - public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { - return localRegName(1); - } - - public int getRegisterId(AVM2Instruction ins) { - return 1; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; +import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class SetLocal1Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns { + + public SetLocal1Ins() { + super(0xd5, "setlocal_1", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem val = (TreeItem) stack.pop(); + localRegs.put(1, val); + if (val instanceof NewActivationTreeItem) return; + if (val instanceof FindPropertyTreeItem) return; + //if(val.startsWith("catchscope ")) return; + //if(val.startsWith("newactivation()")) return; + output.add(new SetLocalTreeItem(ins, 1, val)); + } + + public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { + return localRegName(1); + } + + public int getRegisterId(AVM2Instruction ins) { + return 1; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal2Ins.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal2Ins.java index d9b904f03..78f0e06d2 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal2Ins.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal2Ins.java @@ -1,45 +1,59 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; -import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class SetLocal2Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns { - - public SetLocal2Ins() { - super(0xd6, "setlocal_2", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem val = (TreeItem) stack.pop(); - localRegs.put(2, val); - if (val instanceof NewActivationTreeItem) return; - if (val instanceof FindPropertyTreeItem) return; - //if(val.startsWith("catchscope ")) return; - //if(val.startsWith("newactivation()")) return; - output.add(new SetLocalTreeItem(ins, 2, val)); - } - - public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { - return localRegName(2); - } - - public int getRegisterId(AVM2Instruction ins) { - return 2; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; +import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class SetLocal2Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns { + + public SetLocal2Ins() { + super(0xd6, "setlocal_2", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem val = (TreeItem) stack.pop(); + localRegs.put(2, val); + if (val instanceof NewActivationTreeItem) return; + if (val instanceof FindPropertyTreeItem) return; + //if(val.startsWith("catchscope ")) return; + //if(val.startsWith("newactivation()")) return; + output.add(new SetLocalTreeItem(ins, 2, val)); + } + + public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { + return localRegName(2); + } + + public int getRegisterId(AVM2Instruction ins) { + return 2; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal3Ins.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal3Ins.java index c729c4e4f..b363970eb 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal3Ins.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocal3Ins.java @@ -1,45 +1,59 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; -import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class SetLocal3Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns { - - public SetLocal3Ins() { - super(0xd7, "setlocal_3", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem val = (TreeItem) stack.pop(); - localRegs.put(3, val); - if (val instanceof NewActivationTreeItem) return; - if (val instanceof FindPropertyTreeItem) return; - //if(val.startsWith("catchscope ")) return; - //if(val.startsWith("newactivation()")) return; - output.add(new SetLocalTreeItem(ins, 3, val)); - } - - public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { - return localRegName(3); - } - - public int getRegisterId(AVM2Instruction ins) { - return 3; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; +import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class SetLocal3Ins extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns { + + public SetLocal3Ins() { + super(0xd7, "setlocal_3", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem val = (TreeItem) stack.pop(); + localRegs.put(3, val); + if (val instanceof NewActivationTreeItem) return; + if (val instanceof FindPropertyTreeItem) return; + //if(val.startsWith("catchscope ")) return; + //if(val.startsWith("newactivation()")) return; + output.add(new SetLocalTreeItem(ins, 3, val)); + } + + public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { + return localRegName(3); + } + + public int getRegisterId(AVM2Instruction ins) { + return 3; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocalIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocalIns.java index c48fdf2fd..3648622fa 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocalIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocalIns.java @@ -1,46 +1,60 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; -import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class SetLocalIns extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns { - - public SetLocalIns() { - super(0x63, "setlocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem val = (TreeItem) stack.pop(); - localRegs.put(ins.operands[0], val); - if (val instanceof NewActivationTreeItem) return; - if (val instanceof FindPropertyTreeItem) return; - //if(val.startsWith("catchscope ")) return; - //if(val.startsWith("newactivation()")) return; - output.add(new SetLocalTreeItem(ins, ins.operands[0], val)); - } - - public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { - return localRegName(ins.operands[0]); - } - - public int getRegisterId(AVM2Instruction ins) { - return ins.operands[0]; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; +import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.NewActivationTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.SetLocalTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class SetLocalIns extends InstructionDefinition implements SetTypeIns, SetLocalTypeIns { + + public SetLocalIns() { + super(0x63, "setlocal", new int[]{AVM2Code.DAT_LOCAL_REG_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem val = (TreeItem) stack.pop(); + localRegs.put(ins.operands[0], val); + if (val instanceof NewActivationTreeItem) return; + if (val instanceof FindPropertyTreeItem) return; + //if(val.startsWith("catchscope ")) return; + //if(val.startsWith("newactivation()")) return; + output.add(new SetLocalTreeItem(ins, ins.operands[0], val)); + } + + public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { + return localRegName(ins.operands[0]); + } + + public int getRegisterId(AVM2Instruction ins) { + return ins.operands[0]; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocalTypeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocalTypeIns.java index a2871c412..1c8947c72 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocalTypeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/localregs/SetLocalTypeIns.java @@ -1,12 +1,26 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.localregs; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public interface SetLocalTypeIns { - public abstract int getRegisterId(AVM2Instruction ins); -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.localregs; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public interface SetLocalTypeIns { + public abstract int getRegisterId(AVM2Instruction ins); +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/DeletePropertyIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/DeletePropertyIns.java index 129ef6848..9f7031b81 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/DeletePropertyIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/DeletePropertyIns.java @@ -1,47 +1,61 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.BooleanTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.DeletePropertyTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class DeletePropertyIns extends InstructionDefinition { - - public DeletePropertyIns() { - super(0x6a, "deleteproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int multiIndex = (int) ((Long) arguments.get(0)).longValue(); - //if multiname[multinameIndex] is runtime - //pop(name) pop(ns) - Object obj = lda.operandStack.pop(); - //push true if removed - throw new RuntimeException("Cannot remove property"); - - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - TreeItem obj = (TreeItem) stack.pop(); - stack.add(new BooleanTreeItem(ins, Boolean.TRUE));//property successfully deleted - output.add(new DeletePropertyTreeItem(ins, obj, multiname)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.BooleanTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.DeletePropertyTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class DeletePropertyIns extends InstructionDefinition { + + public DeletePropertyIns() { + super(0x6a, "deleteproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int multiIndex = (int) ((Long) arguments.get(0)).longValue(); + //if multiname[multinameIndex] is runtime + //pop(name) pop(ns) + Object obj = lda.operandStack.pop(); + //push true if removed + throw new RuntimeException("Cannot remove property"); + + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + TreeItem obj = (TreeItem) stack.pop(); + stack.add(new BooleanTreeItem(ins, Boolean.TRUE));//property successfully deleted + output.add(new DeletePropertyTreeItem(ins, obj, multiname)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/FindPropertyIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/FindPropertyIns.java index c507c0468..c5f29ed94 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/FindPropertyIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/FindPropertyIns.java @@ -1,42 +1,56 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class FindPropertyIns extends InstructionDefinition { - - public FindPropertyIns() { - super(0x5e, "findproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int multiIndex = (int) ((Long) arguments.get(0)).longValue(); - //if is runtime - //pop(name), pop(ns) - throw new RuntimeException("Cannot find property"); - - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - stack.push(new FindPropertyTreeItem(ins, multiname)); //resolve right object - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class FindPropertyIns extends InstructionDefinition { + + public FindPropertyIns() { + super(0x5e, "findproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int multiIndex = (int) ((Long) arguments.get(0)).longValue(); + //if is runtime + //pop(name), pop(ns) + throw new RuntimeException("Cannot find property"); + + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + stack.push(new FindPropertyTreeItem(ins, multiname)); //resolve right object + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/FindPropertyStrictIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/FindPropertyStrictIns.java index 3688dba3b..a4b82a0a8 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/FindPropertyStrictIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/FindPropertyStrictIns.java @@ -1,41 +1,55 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class FindPropertyStrictIns extends InstructionDefinition { - - public FindPropertyStrictIns() { - super(0x5d, "findpropstrict", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int multiIndex = (int) ((Long) arguments.get(0)).longValue(); - //if is runtime - //pop(name), pop(ns) - throw new RuntimeException("Cannot find property"); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - stack.push(new FindPropertyTreeItem(ins, multiname)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.FindPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class FindPropertyStrictIns extends InstructionDefinition { + + public FindPropertyStrictIns() { + super(0x5d, "findpropstrict", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int multiIndex = (int) ((Long) arguments.get(0)).longValue(); + //if is runtime + //pop(name), pop(ns) + throw new RuntimeException("Cannot find property"); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + stack.push(new FindPropertyTreeItem(ins, multiname)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetDescendantsIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetDescendantsIns.java index 5b8bbc77e..4c0fc2075 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetDescendantsIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetDescendantsIns.java @@ -1,43 +1,57 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.GetDescendantsTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class GetDescendantsIns extends InstructionDefinition { - - public GetDescendantsIns() { - super(0x59, "getdescentants", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int multiIndex = (int) ((Long) arguments.get(0)).longValue(); - //if is runtime - //pop(name), pop(ns) - Object obj = lda.operandStack.pop(); - throw new RuntimeException("getdescentants not working"); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - TreeItem obj = (TreeItem) stack.pop(); - stack.push(new GetDescendantsTreeItem(ins, obj, multiname)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.GetDescendantsTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class GetDescendantsIns extends InstructionDefinition { + + public GetDescendantsIns() { + super(0x59, "getdescentants", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int multiIndex = (int) ((Long) arguments.get(0)).longValue(); + //if is runtime + //pop(name), pop(ns) + Object obj = lda.operandStack.pop(); + throw new RuntimeException("getdescentants not working"); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + TreeItem obj = (TreeItem) stack.pop(); + stack.push(new GetDescendantsTreeItem(ins, obj, multiname)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetGlobalScopeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetGlobalScopeIns.java index 92c0f75bf..f847b6016 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetGlobalScopeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetGlobalScopeIns.java @@ -1,33 +1,47 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class GetGlobalScopeIns extends InstructionDefinition { - - public GetGlobalScopeIns() { - super(0x64, "getglobalscope", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - throw new RuntimeException("getglobalscope not working"); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(scopeStack.get(0)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class GetGlobalScopeIns extends InstructionDefinition { + + public GetGlobalScopeIns() { + super(0x64, "getglobalscope", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + throw new RuntimeException("getglobalscope not working"); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(scopeStack.get(0)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetGlobalSlotIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetGlobalSlotIns.java index 86deb7119..fa9207311 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetGlobalSlotIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetGlobalSlotIns.java @@ -1,48 +1,62 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.GetSlotTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.clauses.ExceptionTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; -import com.jpexs.asdec.abc.types.Multiname; -import com.jpexs.asdec.abc.types.traits.TraitSlotConst; - -import java.util.List; -import java.util.Stack; - - -public class GetGlobalSlotIns extends InstructionDefinition { - - public GetGlobalSlotIns() { - super(0x6e, "getglobalslot", new int[]{AVM2Code.DAT_SLOT_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int slotIndex = ins.operands[0]; - TreeItem obj = (TreeItem) scopeStack.get(0); //scope - Multiname slotname = null; - if (obj instanceof ExceptionTreeItem) { - slotname = constants.constant_multiname[((ExceptionTreeItem) obj).exception.name_index]; - } else { - - for (int t = 0; t < body.traits.traits.length; t++) { - if (body.traits.traits[t] instanceof TraitSlotConst) { - if (((TraitSlotConst) body.traits.traits[t]).slot_id == slotIndex) { - slotname = body.traits.traits[t].getMultiName(constants); - } - } - - } - } - stack.push(new GetSlotTreeItem(ins, obj, slotname)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.GetSlotTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.clauses.ExceptionTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; +import com.jpexs.asdec.abc.types.Multiname; +import com.jpexs.asdec.abc.types.traits.TraitSlotConst; + +import java.util.List; +import java.util.Stack; + + +public class GetGlobalSlotIns extends InstructionDefinition { + + public GetGlobalSlotIns() { + super(0x6e, "getglobalslot", new int[]{AVM2Code.DAT_SLOT_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int slotIndex = ins.operands[0]; + TreeItem obj = (TreeItem) scopeStack.get(0); //scope + Multiname slotname = null; + if (obj instanceof ExceptionTreeItem) { + slotname = constants.constant_multiname[((ExceptionTreeItem) obj).exception.name_index]; + } else { + + for (int t = 0; t < body.traits.traits.length; t++) { + if (body.traits.traits[t] instanceof TraitSlotConst) { + if (((TraitSlotConst) body.traits.traits[t]).slot_id == slotIndex) { + slotname = body.traits.traits[t].getMultiName(constants); + } + } + + } + } + stack.push(new GetSlotTreeItem(ins, obj, slotname)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetLexIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetLexIns.java index bf90a88f0..c06081fbb 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetLexIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetLexIns.java @@ -1,32 +1,46 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.GetLexTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; -import com.jpexs.asdec.abc.types.Multiname; - -import java.util.List; -import java.util.Stack; - - -public class GetLexIns extends InstructionDefinition { - - public GetLexIns() { - super(0x60, "getlex", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - Multiname multiname = constants.constant_multiname[multinameIndex]; - stack.push(new GetLexTreeItem(ins, multiname)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.GetLexTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; +import com.jpexs.asdec.abc.types.Multiname; + +import java.util.List; +import java.util.Stack; + + +public class GetLexIns extends InstructionDefinition { + + public GetLexIns() { + super(0x60, "getlex", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + Multiname multiname = constants.constant_multiname[multinameIndex]; + stack.push(new GetLexTreeItem(ins, multiname)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetPropertyIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetPropertyIns.java index f2240f52a..644b3dcfa 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetPropertyIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetPropertyIns.java @@ -1,33 +1,47 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.GetPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class GetPropertyIns extends InstructionDefinition { - - public GetPropertyIns() { - super(0x66, "getproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - TreeItem obj = (TreeItem) stack.pop(); - stack.push(new GetPropertyTreeItem(ins, obj, multiname)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.GetPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class GetPropertyIns extends InstructionDefinition { + + public GetPropertyIns() { + super(0x66, "getproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + TreeItem obj = (TreeItem) stack.pop(); + stack.push(new GetPropertyTreeItem(ins, obj, multiname)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetScopeObjectIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetScopeObjectIns.java index 35964e164..79b6af83c 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetScopeObjectIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetScopeObjectIns.java @@ -1,34 +1,48 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class GetScopeObjectIns extends InstructionDefinition { - - - public GetScopeObjectIns() { - super(0x65, "getscopeobject", new int[]{AVM2Code.DAT_SLOT_SCOPE_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int index = ins.operands[0]; - /* System.out.println("Getting scope object"+index+":"); - for(TreeItem ti:scopeStack){ - System.out.println(ti.toString(constants)); - }*/ - stack.push(scopeStack.get(index)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class GetScopeObjectIns extends InstructionDefinition { + + + public GetScopeObjectIns() { + super(0x65, "getscopeobject", new int[]{AVM2Code.DAT_SLOT_SCOPE_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int index = ins.operands[0]; + /* System.out.println("Getting scope object"+index+":"); + for(TreeItem ti:scopeStack){ + System.out.println(ti.toString(constants)); + }*/ + stack.push(scopeStack.get(index)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetSlotIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetSlotIns.java index f65e90ee5..d0d821e34 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetSlotIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetSlotIns.java @@ -1,48 +1,62 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.GetSlotTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.clauses.ExceptionTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; -import com.jpexs.asdec.abc.types.Multiname; -import com.jpexs.asdec.abc.types.traits.TraitSlotConst; - -import java.util.List; -import java.util.Stack; - - -public class GetSlotIns extends InstructionDefinition { - - public GetSlotIns() { - super(0x6c, "getslot", new int[]{AVM2Code.DAT_SLOT_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int slotIndex = ins.operands[0]; - TreeItem obj = (TreeItem) stack.pop(); //scope - Multiname slotname = null; - if (obj instanceof ExceptionTreeItem) { - slotname = constants.constant_multiname[((ExceptionTreeItem) obj).exception.name_index]; - } else { - - for (int t = 0; t < body.traits.traits.length; t++) { - if (body.traits.traits[t] instanceof TraitSlotConst) { - if (((TraitSlotConst) body.traits.traits[t]).slot_id == slotIndex) { - slotname = body.traits.traits[t].getMultiName(constants); - } - } - - } - } - stack.push(new GetSlotTreeItem(ins, obj, slotname)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.GetSlotTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.clauses.ExceptionTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; +import com.jpexs.asdec.abc.types.Multiname; +import com.jpexs.asdec.abc.types.traits.TraitSlotConst; + +import java.util.List; +import java.util.Stack; + + +public class GetSlotIns extends InstructionDefinition { + + public GetSlotIns() { + super(0x6c, "getslot", new int[]{AVM2Code.DAT_SLOT_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int slotIndex = ins.operands[0]; + TreeItem obj = (TreeItem) stack.pop(); //scope + Multiname slotname = null; + if (obj instanceof ExceptionTreeItem) { + slotname = constants.constant_multiname[((ExceptionTreeItem) obj).exception.name_index]; + } else { + + for (int t = 0; t < body.traits.traits.length; t++) { + if (body.traits.traits[t] instanceof TraitSlotConst) { + if (((TraitSlotConst) body.traits.traits[t]).slot_id == slotIndex) { + slotname = body.traits.traits[t].getMultiName(constants); + } + } + + } + } + stack.push(new GetSlotTreeItem(ins, obj, slotname)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetSuperIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetSuperIns.java index 68e03e13f..186ac609d 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetSuperIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/GetSuperIns.java @@ -1,33 +1,47 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.GetSuperTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class GetSuperIns extends InstructionDefinition { - - public GetSuperIns() { - super(0x04, "getsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - TreeItem obj = (TreeItem) stack.pop(); - stack.push(new GetSuperTreeItem(ins, obj, multiname)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.GetSuperTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class GetSuperIns extends InstructionDefinition { + + public GetSuperIns() { + super(0x04, "getsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + TreeItem obj = (TreeItem) stack.pop(); + stack.push(new GetSuperTreeItem(ins, obj, multiname)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/HasNext2Ins.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/HasNext2Ins.java index 5daf7139b..9d7b7478f 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/HasNext2Ins.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/HasNext2Ins.java @@ -1,33 +1,47 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.EachTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class HasNext2Ins extends InstructionDefinition { - - public HasNext2Ins() { - super(0x32, "hasnext2", new int[]{AVM2Code.OPT_U8, AVM2Code.OPT_U8}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int objectReg = ins.operands[0]; - int indexReg = ins.operands[1]; - //stack.push("_loc_" + objectReg + ".hasNext(cnt=_loc_" + indexReg + ")"); - stack.push(new EachTreeItem(ins, new LocalRegTreeItem(ins, indexReg, localRegs.get(indexReg)), new LocalRegTreeItem(ins, objectReg, localRegs.get(objectReg)))); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.EachTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.LocalRegTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class HasNext2Ins extends InstructionDefinition { + + public HasNext2Ins() { + super(0x32, "hasnext2", new int[]{AVM2Code.OPT_U8, AVM2Code.OPT_U8}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int objectReg = ins.operands[0]; + int indexReg = ins.operands[1]; + //stack.push("_loc_" + objectReg + ".hasNext(cnt=_loc_" + indexReg + ")"); + stack.push(new EachTreeItem(ins, new LocalRegTreeItem(ins, indexReg, localRegs.get(indexReg)), new LocalRegTreeItem(ins, objectReg, localRegs.get(objectReg)))); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/HasNextIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/HasNextIns.java index 7289a155c..e7e049503 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/HasNextIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/HasNextIns.java @@ -1,31 +1,45 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.EachTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class HasNextIns extends InstructionDefinition { - - public HasNextIns() { - super(0x1f, "hasnext", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem curIndex = (TreeItem) stack.pop(); - TreeItem obj = (TreeItem) stack.pop(); - stack.push(new EachTreeItem(ins, curIndex, obj)); - - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.EachTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class HasNextIns extends InstructionDefinition { + + public HasNextIns() { + super(0x1f, "hasnext", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem curIndex = (TreeItem) stack.pop(); + TreeItem obj = (TreeItem) stack.pop(); + stack.push(new EachTreeItem(ins, curIndex, obj)); + + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/InIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/InIns.java index 69a6fcccb..b75bce364 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/InIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/InIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.InTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class InIns extends InstructionDefinition { - - public InIns() { - super(0xb4, "in", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem obj = (TreeItem) stack.pop(); - TreeItem name = (TreeItem) stack.pop(); - stack.push(new InTreeItem(ins, name, obj)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.InTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class InIns extends InstructionDefinition { + + public InIns() { + super(0xb4, "in", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem obj = (TreeItem) stack.pop(); + TreeItem name = (TreeItem) stack.pop(); + stack.push(new InTreeItem(ins, name, obj)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/InitPropertyIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/InitPropertyIns.java index 33fbc9e7f..165a8c3ea 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/InitPropertyIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/InitPropertyIns.java @@ -1,35 +1,49 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.InitPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class InitPropertyIns extends InstructionDefinition { - - public InitPropertyIns() { - super(0x68, "initproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - - TreeItem val = (TreeItem) stack.pop(); - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - TreeItem obj = (TreeItem) stack.pop(); - output.add(new InitPropertyTreeItem(ins, obj, multiname, val)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.InitPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class InitPropertyIns extends InstructionDefinition { + + public InitPropertyIns() { + super(0x68, "initproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + + TreeItem val = (TreeItem) stack.pop(); + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + TreeItem obj = (TreeItem) stack.pop(); + output.add(new InitPropertyTreeItem(ins, obj, multiname, val)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/LabelIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/LabelIns.java index b77542adc..f610ceb28 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/LabelIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/LabelIns.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; - - -public class LabelIns extends InstructionDefinition { -//this can be target of branch - - public LabelIns() { - super(0x09, "label", new int[]{}); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; + + +public class LabelIns extends InstructionDefinition { +//this can be target of branch + + public LabelIns() { + super(0x09, "label", new int[]{}); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/NextNameIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/NextNameIns.java index 7f19c5bc6..526546387 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/NextNameIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/NextNameIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class NextNameIns extends InstructionDefinition { - - public NextNameIns() { - super(0x1e, "nextname", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem index = stack.pop(); - TreeItem obj = stack.pop(); - //stack.push(obj + ".nextName(" + index + ")"); - stack.push(index); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class NextNameIns extends InstructionDefinition { + + public NextNameIns() { + super(0x1e, "nextname", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem index = stack.pop(); + TreeItem obj = stack.pop(); + //stack.push(obj + ".nextName(" + index + ")"); + stack.push(index); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/NextValueIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/NextValueIns.java index c7bb5d23d..5d926deee 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/NextValueIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/NextValueIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class NextValueIns extends InstructionDefinition { - - public NextValueIns() { - super(0x23, "nextvalue", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem index = stack.pop(); - TreeItem obj = stack.pop(); - //stack.push(obj + ".nextValue(" + index + ")"); - stack.push(index); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class NextValueIns extends InstructionDefinition { + + public NextValueIns() { + super(0x23, "nextvalue", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem index = stack.pop(); + TreeItem obj = stack.pop(); + //stack.push(obj + ".nextValue(" + index + ")"); + stack.push(index); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/NopIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/NopIns.java index 12c1196ea..711c335b2 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/NopIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/NopIns.java @@ -1,16 +1,30 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; - - -public class NopIns extends InstructionDefinition { - - public NopIns() { - super(0x02, "nop", new int[]{}); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; + + +public class NopIns extends InstructionDefinition { + + public NopIns() { + super(0x02, "nop", new int[]{}); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/ReturnValueIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/ReturnValueIns.java index 3ea6a3936..8f74b1682 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/ReturnValueIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/ReturnValueIns.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.ReturnValueTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class ReturnValueIns extends InstructionDefinition { - - public ReturnValueIns() { - super(0x48, "returnvalue", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - output.add(new ReturnValueTreeItem(ins, (TreeItem) stack.pop())); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.ReturnValueTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class ReturnValueIns extends InstructionDefinition { + + public ReturnValueIns() { + super(0x48, "returnvalue", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + output.add(new ReturnValueTreeItem(ins, (TreeItem) stack.pop())); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/ReturnVoidIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/ReturnVoidIns.java index 0dda65fc4..2247bbfb1 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/ReturnVoidIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/ReturnVoidIns.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.ReturnVoidTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class ReturnVoidIns extends InstructionDefinition { - - public ReturnVoidIns() { - super(0x47, "returnvoid", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - output.add(new ReturnVoidTreeItem(ins)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.ReturnVoidTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class ReturnVoidIns extends InstructionDefinition { + + public ReturnVoidIns() { + super(0x47, "returnvoid", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + output.add(new ReturnVoidTreeItem(ins)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetGlobalSlotIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetGlobalSlotIns.java index 27d5ee8ea..bb398c2b0 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetGlobalSlotIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetGlobalSlotIns.java @@ -1,34 +1,48 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; -import com.jpexs.asdec.abc.avm2.treemodel.SetGlobalSlotTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class SetGlobalSlotIns extends InstructionDefinition implements SetTypeIns { - - public SetGlobalSlotIns() { - super(0x6f, "setglobalslot", new int[]{AVM2Code.DAT_SLOT_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - output.add(new SetGlobalSlotTreeItem(ins, ins.operands[0], (TreeItem) stack.pop())); - } - - public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { - return "globalslot" + ins.operands[0]; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; +import com.jpexs.asdec.abc.avm2.treemodel.SetGlobalSlotTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class SetGlobalSlotIns extends InstructionDefinition implements SetTypeIns { + + public SetGlobalSlotIns() { + super(0x6f, "setglobalslot", new int[]{AVM2Code.DAT_SLOT_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + output.add(new SetGlobalSlotTreeItem(ins, ins.operands[0], (TreeItem) stack.pop())); + } + + public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { + return "globalslot" + ins.operands[0]; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetPropertyIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetPropertyIns.java index ccce9a88d..0a91e10d1 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetPropertyIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetPropertyIns.java @@ -1,43 +1,57 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.SetPropertyTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class SetPropertyIns extends InstructionDefinition implements SetTypeIns { - - public SetPropertyIns() { - super(0x61, "setproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - TreeItem value = (TreeItem) stack.pop(); - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - TreeItem obj = (TreeItem) stack.pop(); - output.add(new SetPropertyTreeItem(ins, obj, multiname, value)); - } - - public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { - int multinameIndex = ins.operands[0]; - String multiname = resolveMultinameNoPop(0, stack, constants, multinameIndex, ins); - TreeItem obj = stack.get(1 + resolvedCount(constants, multinameIndex)); //pod vrcholem - if ((!obj.toString().equals(""))) multiname = "." + multiname; - return obj + multiname; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.SetPropertyTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class SetPropertyIns extends InstructionDefinition implements SetTypeIns { + + public SetPropertyIns() { + super(0x61, "setproperty", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + TreeItem value = (TreeItem) stack.pop(); + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + TreeItem obj = (TreeItem) stack.pop(); + output.add(new SetPropertyTreeItem(ins, obj, multiname, value)); + } + + public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { + int multinameIndex = ins.operands[0]; + String multiname = resolveMultinameNoPop(0, stack, constants, multinameIndex, ins); + TreeItem obj = stack.get(1 + resolvedCount(constants, multinameIndex)); //pod vrcholem + if ((!obj.toString().equals(""))) multiname = "." + multiname; + return obj + multiname; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetSlotIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetSlotIns.java index 56f9f4d7d..9f2f7f32d 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetSlotIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetSlotIns.java @@ -1,65 +1,79 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; -import com.jpexs.asdec.abc.avm2.treemodel.SetSlotTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.clauses.ExceptionTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; -import com.jpexs.asdec.abc.types.Multiname; -import com.jpexs.asdec.abc.types.traits.TraitSlotConst; - -import java.util.List; -import java.util.Stack; - - -public class SetSlotIns extends InstructionDefinition implements SetTypeIns { - - public SetSlotIns() { - super(0x6d, "setslot", new int[]{AVM2Code.DAT_SLOT_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int slotIndex = ins.operands[0]; - TreeItem value = (TreeItem) stack.pop(); - TreeItem obj = (TreeItem) stack.pop(); //scopeId - - if (obj instanceof ExceptionTreeItem) { - return; - } - //if(value.startsWith("catched ")) return; - Multiname slotname = null; - for (int t = 0; t < body.traits.traits.length; t++) { - if (body.traits.traits[t] instanceof TraitSlotConst) { - if (((TraitSlotConst) body.traits.traits[t]).slot_id == slotIndex) { - slotname = body.traits.traits[t].getMultiName(constants); - } - } - - } - output.add(new SetSlotTreeItem(ins, obj, slotname, value)); - } - - public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { - int slotIndex = ins.operands[0]; - ////String obj = stack.get(1); - String slotname = ""; - for (int t = 0; t < body.traits.traits.length; t++) { - if (body.traits.traits[t] instanceof TraitSlotConst) { - if (((TraitSlotConst) body.traits.traits[t]).slot_id == slotIndex) { - slotname = body.traits.traits[t].getMultiName(constants).getName(constants); - } - } - - } - return slotname; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; +import com.jpexs.asdec.abc.avm2.treemodel.SetSlotTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.clauses.ExceptionTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; +import com.jpexs.asdec.abc.types.Multiname; +import com.jpexs.asdec.abc.types.traits.TraitSlotConst; + +import java.util.List; +import java.util.Stack; + + +public class SetSlotIns extends InstructionDefinition implements SetTypeIns { + + public SetSlotIns() { + super(0x6d, "setslot", new int[]{AVM2Code.DAT_SLOT_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int slotIndex = ins.operands[0]; + TreeItem value = (TreeItem) stack.pop(); + TreeItem obj = (TreeItem) stack.pop(); //scopeId + + if (obj instanceof ExceptionTreeItem) { + return; + } + //if(value.startsWith("catched ")) return; + Multiname slotname = null; + for (int t = 0; t < body.traits.traits.length; t++) { + if (body.traits.traits[t] instanceof TraitSlotConst) { + if (((TraitSlotConst) body.traits.traits[t]).slot_id == slotIndex) { + slotname = body.traits.traits[t].getMultiName(constants); + } + } + + } + output.add(new SetSlotTreeItem(ins, obj, slotname, value)); + } + + public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { + int slotIndex = ins.operands[0]; + ////String obj = stack.get(1); + String slotname = ""; + for (int t = 0; t < body.traits.traits.length; t++) { + if (body.traits.traits[t] instanceof TraitSlotConst) { + if (((TraitSlotConst) body.traits.traits[t]).slot_id == slotIndex) { + slotname = body.traits.traits[t].getMultiName(constants).getName(constants); + } + } + + } + return slotname; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetSuperIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetSuperIns.java index a53c644b5..b37a7dd4e 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetSuperIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/SetSuperIns.java @@ -1,43 +1,57 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.SetSuperTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class SetSuperIns extends InstructionDefinition implements SetTypeIns { - - public SetSuperIns() { - super(0x05, "setsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - - TreeItem value = (TreeItem) stack.pop(); - FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); - TreeItem obj = (TreeItem) stack.pop(); - output.add(new SetSuperTreeItem(ins, value, obj, multiname)); - } - - public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { - int multinameIndex = ins.operands[0]; - String multiname = resolveMultinameNoPop(1, stack, constants, multinameIndex, ins); - String obj = stack.get(1 + resolvedCount(constants, multinameIndex)).toString(constants); - return obj + ".super." + multiname; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.instructions.SetTypeIns; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.SetSuperTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class SetSuperIns extends InstructionDefinition implements SetTypeIns { + + public SetSuperIns() { + super(0x05, "setsuper", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + + TreeItem value = (TreeItem) stack.pop(); + FullMultinameTreeItem multiname = resolveMultiname(stack, constants, multinameIndex, ins); + TreeItem obj = (TreeItem) stack.pop(); + output.add(new SetSuperTreeItem(ins, value, obj, multiname)); + } + + public String getObject(Stack stack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body) { + int multinameIndex = ins.operands[0]; + String multiname = resolveMultinameNoPop(1, stack, constants, multinameIndex, ins); + String obj = stack.get(1 + resolvedCount(constants, multinameIndex)).toString(constants); + return obj + ".super." + multiname; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/ThrowIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/ThrowIns.java index 941ee90d9..d9a630eff 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/ThrowIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/other/ThrowIns.java @@ -1,32 +1,46 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.other; - -import com.jpexs.asdec.abc.ABC; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.ThrowTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodBody; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class ThrowIns extends InstructionDefinition { - - public ThrowIns() { - super(0x03, "throw", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc) { - output.add(new ThrowTreeItem(ins, (TreeItem) stack.pop())); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.other; + +import com.jpexs.asdec.abc.ABC; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.ThrowTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodBody; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class ThrowIns extends InstructionDefinition { + + public ThrowIns() { + super(0x03, "throw", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc) { + output.add(new ThrowTreeItem(ins, (TreeItem) stack.pop())); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/DupIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/DupIns.java index fb095bbaa..300e0b58d 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/DupIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/DupIns.java @@ -1,38 +1,52 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class DupIns extends InstructionDefinition { - - public DupIns() { - super(0x2a, "dup", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Object obj = lda.operandStack.pop(); - lda.operandStack.push(obj); - lda.operandStack.push(obj); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem v = (TreeItem) stack.pop(); - stack.push(v); - stack.push(v); - - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class DupIns extends InstructionDefinition { + + public DupIns() { + super(0x2a, "dup", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Object obj = lda.operandStack.pop(); + lda.operandStack.push(obj); + lda.operandStack.push(obj); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem v = (TreeItem) stack.pop(); + stack.push(v); + stack.push(v); + + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PopIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PopIns.java index abaecbcfd..daa7bd3bc 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PopIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PopIns.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class PopIns extends InstructionDefinition { - - public PopIns() { - super(0x29, "pop", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - if (stack.size() > 0) - stack.pop(); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PopIns extends InstructionDefinition { + + public PopIns() { + super(0x29, "pop", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + if (stack.size() > 0) + stack.pop(); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PopScopeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PopScopeIns.java index 12ed08daa..95e7610ca 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PopScopeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PopScopeIns.java @@ -1,53 +1,67 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.ABC; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.WithTreeItem; -import com.jpexs.asdec.abc.types.MethodBody; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - - -public class PopScopeIns extends InstructionDefinition { - - public PopScopeIns() { - super(0x1d, "popscope", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc) { - TreeItem scope = (TreeItem) scopeStack.pop(); - for (int i = output.size() - 1; i >= 0; i--) { - if (output.get(i) instanceof WithTreeItem) { - WithTreeItem wti = (WithTreeItem) output.get(i); - if (wti.scope == scope) { - wti.items = new ArrayList(); - for (int k = i + 1; k < output.size(); k++) { - //output.subList(i+1, output.size()); - wti.items.add(output.get(k)); - } - while (output.size() > i + 1) { - output.remove(i + 1); - } - /*int count=output.size()-1-(i+1); - for(int c=0;c localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc) { + TreeItem scope = (TreeItem) scopeStack.pop(); + for (int i = output.size() - 1; i >= 0; i--) { + if (output.get(i) instanceof WithTreeItem) { + WithTreeItem wti = (WithTreeItem) output.get(i); + if (wti.scope == scope) { + wti.items = new ArrayList(); + for (int k = i + 1; k < output.size(); k++) { + //output.subList(i+1, output.size()); + wti.items.add(output.get(k)); + } + while (output.size() > i + 1) { + output.remove(i + 1); + } + /*int count=output.size()-1-(i+1); + for(int c=0;c localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new IntegerValueTreeItem(ins, new Long(ins.operands[0]))); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.IntegerValueTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PushByteIns extends InstructionDefinition { + + public PushByteIns() { + super(0x24, "pushbyte", new int[]{AVM2Code.OPT_BYTE}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new IntegerValueTreeItem(ins, new Long(ins.operands[0]))); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushDoubleIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushDoubleIns.java index 63bd8d43a..0d4c62c99 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushDoubleIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushDoubleIns.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.FloatValueTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class PushDoubleIns extends InstructionDefinition { - - public PushDoubleIns() { - super(0x2f, "pushdouble", new int[]{AVM2Code.DAT_DOUBLE_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new FloatValueTreeItem(ins, constants.constant_double[ins.operands[0]])); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.FloatValueTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PushDoubleIns extends InstructionDefinition { + + public PushDoubleIns() { + super(0x2f, "pushdouble", new int[]{AVM2Code.DAT_DOUBLE_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new FloatValueTreeItem(ins, constants.constant_double[ins.operands[0]])); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushFalseIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushFalseIns.java index ed73b4621..50c3aa868 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushFalseIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushFalseIns.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.BooleanTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class PushFalseIns extends InstructionDefinition { - - public PushFalseIns() { - super(0x27, "pushfalse", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new BooleanTreeItem(ins, Boolean.FALSE)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.BooleanTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PushFalseIns extends InstructionDefinition { + + public PushFalseIns() { + super(0x27, "pushfalse", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new BooleanTreeItem(ins, Boolean.FALSE)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushIntIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushIntIns.java index 5da1ca584..1249f0e46 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushIntIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushIntIns.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.IntegerValueTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class PushIntIns extends InstructionDefinition { - - public PushIntIns() { - super(0x2d, "pushint", new int[]{AVM2Code.DAT_INT_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new IntegerValueTreeItem(ins, constants.constant_int[ins.operands[0]])); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.IntegerValueTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PushIntIns extends InstructionDefinition { + + public PushIntIns() { + super(0x2d, "pushint", new int[]{AVM2Code.DAT_INT_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new IntegerValueTreeItem(ins, constants.constant_int[ins.operands[0]])); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushNamespaceIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushNamespaceIns.java index e5b81100d..9ed6f797f 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushNamespaceIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushNamespaceIns.java @@ -1,33 +1,47 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.ABC; -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.NameSpaceTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodBody; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class PushNamespaceIns extends InstructionDefinition { - - public PushNamespaceIns() { - super(0x31, "pushnamespace", new int[]{AVM2Code.OPT_U30}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc) { - stack.push(new NameSpaceTreeItem(ins, ins.operands[0])); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.ABC; +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.NameSpaceTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodBody; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PushNamespaceIns extends InstructionDefinition { + + public PushNamespaceIns() { + super(0x31, "pushnamespace", new int[]{AVM2Code.OPT_U30}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc) { + stack.push(new NameSpaceTreeItem(ins, ins.operands[0])); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushNanIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushNanIns.java index b39d602c5..b996aff06 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushNanIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushNanIns.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.NanTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class PushNanIns extends InstructionDefinition { - - public PushNanIns() { - super(0x28, "pushnan", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new NanTreeItem(ins)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.NanTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PushNanIns extends InstructionDefinition { + + public PushNanIns() { + super(0x28, "pushnan", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new NanTreeItem(ins)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushNullIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushNullIns.java index 7681a417a..b65a03c3b 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushNullIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushNullIns.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.NullTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class PushNullIns extends InstructionDefinition { - - public PushNullIns() { - super(0x20, "pushnull", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new NullTreeItem(ins)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.NullTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PushNullIns extends InstructionDefinition { + + public PushNullIns() { + super(0x20, "pushnull", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new NullTreeItem(ins)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushScopeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushScopeIns.java index 3107b1f92..0ff693a10 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushScopeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushScopeIns.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class PushScopeIns extends InstructionDefinition { - - public PushScopeIns() { - super(0x30, "pushscope", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - scopeStack.push(stack.pop()); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PushScopeIns extends InstructionDefinition { + + public PushScopeIns() { + super(0x30, "pushscope", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + scopeStack.push(stack.pop()); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushShortIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushShortIns.java index 6cbef6a44..7d3b2969f 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushShortIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushShortIns.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.IntegerValueTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class PushShortIns extends InstructionDefinition { - - public PushShortIns() { - super(0x25, "pushshort", new int[]{AVM2Code.OPT_U30}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new IntegerValueTreeItem(ins, new Long(ins.operands[0]))); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.IntegerValueTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PushShortIns extends InstructionDefinition { + + public PushShortIns() { + super(0x25, "pushshort", new int[]{AVM2Code.OPT_U30}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new IntegerValueTreeItem(ins, new Long(ins.operands[0]))); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushStringIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushStringIns.java index 8de55f793..90e626d57 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushStringIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushStringIns.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.StringTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class PushStringIns extends InstructionDefinition { - - public PushStringIns() { - super(0x2c, "pushstring", new int[]{AVM2Code.DAT_STRING_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new StringTreeItem(ins, constants.constant_string[ins.operands[0]])); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.StringTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PushStringIns extends InstructionDefinition { + + public PushStringIns() { + super(0x2c, "pushstring", new int[]{AVM2Code.DAT_STRING_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new StringTreeItem(ins, constants.constant_string[ins.operands[0]])); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushTrueIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushTrueIns.java index 3970ca4ac..2ff313ab8 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushTrueIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushTrueIns.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.BooleanTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class PushTrueIns extends InstructionDefinition { - - public PushTrueIns() { - super(0x26, "pushtrue", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new BooleanTreeItem(ins, Boolean.TRUE)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.BooleanTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PushTrueIns extends InstructionDefinition { + + public PushTrueIns() { + super(0x26, "pushtrue", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new BooleanTreeItem(ins, Boolean.TRUE)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushUIntIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushUIntIns.java index 43a1d5ca3..cb72e39e4 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushUIntIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushUIntIns.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.IntegerValueTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class PushUIntIns extends InstructionDefinition { - - public PushUIntIns() { - super(0x2e, "pushuint", new int[]{AVM2Code.DAT_UINT_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new IntegerValueTreeItem(ins, constants.constant_uint[ins.operands[0]])); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.IntegerValueTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PushUIntIns extends InstructionDefinition { + + public PushUIntIns() { + super(0x2e, "pushuint", new int[]{AVM2Code.DAT_UINT_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new IntegerValueTreeItem(ins, constants.constant_uint[ins.operands[0]])); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushUndefinedIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushUndefinedIns.java index 6e112342e..0637656ee 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushUndefinedIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushUndefinedIns.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.UndefinedTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class PushUndefinedIns extends InstructionDefinition { - - public PushUndefinedIns() { - super(0x21, "pushundefined", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new UndefinedTreeItem(ins)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.UndefinedTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PushUndefinedIns extends InstructionDefinition { + + public PushUndefinedIns() { + super(0x21, "pushundefined", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new UndefinedTreeItem(ins)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushWithIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushWithIns.java index 906b2fcd6..ef287763f 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushWithIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/PushWithIns.java @@ -1,34 +1,48 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.ABC; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.WithTreeItem; -import com.jpexs.asdec.abc.types.MethodBody; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class PushWithIns extends InstructionDefinition { - - public PushWithIns() { - super(0x1c, "pushwith", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc) { - TreeItem w = (TreeItem) stack.pop(); - scopeStack.push(w); - output.add(new WithTreeItem(ins, w)); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.ABC; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.WithTreeItem; +import com.jpexs.asdec.abc.types.MethodBody; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class PushWithIns extends InstructionDefinition { + + public PushWithIns() { + super(0x1c, "pushwith", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc) { + TreeItem w = (TreeItem) stack.pop(); + scopeStack.push(w); + output.add(new WithTreeItem(ins, w)); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/SwapIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/SwapIns.java index 37e111653..5e6db387b 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/SwapIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/stack/SwapIns.java @@ -1,36 +1,50 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.stack; - -import com.jpexs.asdec.abc.ABC; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodBody; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class SwapIns extends InstructionDefinition { - - public SwapIns() { - super(0x2b, "swap", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc) { - - TreeItem o1 = stack.pop(); - TreeItem o2 = stack.pop(); - stack.push(o1); - stack.push(o2); - - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.stack; + +import com.jpexs.asdec.abc.ABC; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodBody; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class SwapIns extends InstructionDefinition { + + public SwapIns() { + super(0x2b, "swap", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, MethodBody body, ABC abc) { + + TreeItem o1 = stack.pop(); + TreeItem o2 = stack.pop(); + stack.push(o1); + stack.push(o2); + + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/AsTypeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/AsTypeIns.java index 38dc6892b..957b48db0 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/AsTypeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/AsTypeIns.java @@ -1,43 +1,57 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.AsTypeTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class AsTypeIns extends InstructionDefinition { - - public AsTypeIns() { - super(0x86, "astype", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Long typeIndex = (Long) arguments.get(0); - Object obj = lda.operandStack.pop(); - //if multiname[typeIndex]==obj - lda.operandStack.push(obj); - //else push null - - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem val = (TreeItem) stack.pop(); - - stack.push(new AsTypeTreeItem(ins, val, new FullMultinameTreeItem(ins, ins.operands[0]))); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.AsTypeTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class AsTypeIns extends InstructionDefinition { + + public AsTypeIns() { + super(0x86, "astype", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Long typeIndex = (Long) arguments.get(0); + Object obj = lda.operandStack.pop(); + //if multiname[typeIndex]==obj + lda.operandStack.push(obj); + //else push null + + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem val = (TreeItem) stack.pop(); + + stack.push(new AsTypeTreeItem(ins, val, new FullMultinameTreeItem(ins, ins.operands[0]))); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/AsTypeLateIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/AsTypeLateIns.java index 4d8b16ba2..f7f9de85d 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/AsTypeLateIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/AsTypeLateIns.java @@ -1,40 +1,54 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.AsTypeTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class AsTypeLateIns extends InstructionDefinition { - - public AsTypeLateIns() { - super(0x87, "astypelate", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Object objClass = lda.operandStack.pop(); - Object obj = lda.operandStack.pop(); - //if obj.class=objClass - lda.operandStack.push(obj); - //else push null - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem cls = (TreeItem) stack.pop(); - TreeItem val = (TreeItem) stack.pop(); - stack.push(new AsTypeTreeItem(ins, val, cls)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.AsTypeTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class AsTypeLateIns extends InstructionDefinition { + + public AsTypeLateIns() { + super(0x87, "astypelate", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Object objClass = lda.operandStack.pop(); + Object obj = lda.operandStack.pop(); + //if obj.class=objClass + lda.operandStack.push(obj); + //else push null + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem cls = (TreeItem) stack.pop(); + TreeItem val = (TreeItem) stack.pop(); + stack.push(new AsTypeTreeItem(ins, val, cls)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/CoerceAIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/CoerceAIns.java index 49c83d265..2d86c267e 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/CoerceAIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/CoerceAIns.java @@ -1,35 +1,49 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.CoerceTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class CoerceAIns extends InstructionDefinition { - - public CoerceAIns() { - super(0x82, "coerce_a", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - //coerce any type - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new CoerceTreeItem(ins, (TreeItem) stack.pop(), "*")); - - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.CoerceTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class CoerceAIns extends InstructionDefinition { + + public CoerceAIns() { + super(0x82, "coerce_a", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + //coerce any type + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new CoerceTreeItem(ins, (TreeItem) stack.pop(), "*")); + + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/CoerceIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/CoerceIns.java index 7f6b48eee..515b12077 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/CoerceIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/CoerceIns.java @@ -1,37 +1,51 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.CoerceTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class CoerceIns extends InstructionDefinition { - - public CoerceIns() { - super(0x80, "coerce", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); - //push and pop coerced value to specified type - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - stack.push(new CoerceTreeItem(ins, (TreeItem) stack.pop(), constants.constant_multiname[multinameIndex].getName(constants))); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.CoerceTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class CoerceIns extends InstructionDefinition { + + public CoerceIns() { + super(0x80, "coerce", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int multinameIndex = (int) ((Long) arguments.get(0)).longValue(); + //push and pop coerced value to specified type + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + stack.push(new CoerceTreeItem(ins, (TreeItem) stack.pop(), constants.constant_multiname[multinameIndex].getName(constants))); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/CoerceSIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/CoerceSIns.java index 2c632baf6..65aef1d24 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/CoerceSIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/CoerceSIns.java @@ -1,36 +1,50 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.CoerceTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class CoerceSIns extends InstructionDefinition { - - public CoerceSIns() { - super(0x85, "coerce_s", new int[]{}); - } - - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Object obj = lda.operandStack.pop(); - lda.operandStack.push(obj.toString()); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new CoerceTreeItem(ins, (TreeItem) stack.pop(), "string")); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.CoerceTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class CoerceSIns extends InstructionDefinition { + + public CoerceSIns() { + super(0x85, "coerce_s", new int[]{}); + } + + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Object obj = lda.operandStack.pop(); + lda.operandStack.push(obj.toString()); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new CoerceTreeItem(ins, (TreeItem) stack.pop(), "string")); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertBIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertBIns.java index 3a46889c2..4c593948e 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertBIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertBIns.java @@ -1,45 +1,59 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.ConvertTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class ConvertBIns extends InstructionDefinition { - - public ConvertBIns() { - super(0x76, "convert_b", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Object value = lda.operandStack.pop(); - boolean bval = false; - if (value instanceof Boolean) { - bval = (Boolean) value; - } else if (value instanceof Long) { - bval = ((Long) value).longValue() != 0; - } else if (value instanceof String) { - bval = !((String) value).equals(""); - } else { - bval = true; - } - lda.operandStack.push(new Boolean(bval)); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), "boolean")); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.ConvertTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class ConvertBIns extends InstructionDefinition { + + public ConvertBIns() { + super(0x76, "convert_b", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Object value = lda.operandStack.pop(); + boolean bval = false; + if (value instanceof Boolean) { + bval = (Boolean) value; + } else if (value instanceof Long) { + bval = ((Long) value).longValue() != 0; + } else if (value instanceof String) { + bval = !((String) value).equals(""); + } else { + bval = true; + } + lda.operandStack.push(new Boolean(bval)); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), "boolean")); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertDIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertDIns.java index 306a9823b..4d579e2aa 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertDIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertDIns.java @@ -1,53 +1,67 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.ConvertTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class ConvertDIns extends InstructionDefinition { - - public ConvertDIns() { - super(0x75, "convert_d", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Object value = lda.operandStack.pop(); - double ret = 0; - if (value == null) { - ret = 0; - } else if (value instanceof Boolean) { - if (((Boolean) value).booleanValue()) { - ret = 1; - } else { - ret = 0; - } - } else if (value instanceof Long) { - ret = ((Long) value).longValue(); - } else if (value instanceof Double) { - ret = ((Double) value).doubleValue(); - } else if (value instanceof String) { - ret = Double.parseDouble((String) value); - } else { - ret = 1; //must call toPrimitive - } - lda.operandStack.push(new Double(ret)); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), "double")); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.ConvertTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class ConvertDIns extends InstructionDefinition { + + public ConvertDIns() { + super(0x75, "convert_d", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Object value = lda.operandStack.pop(); + double ret = 0; + if (value == null) { + ret = 0; + } else if (value instanceof Boolean) { + if (((Boolean) value).booleanValue()) { + ret = 1; + } else { + ret = 0; + } + } else if (value instanceof Long) { + ret = ((Long) value).longValue(); + } else if (value instanceof Double) { + ret = ((Double) value).doubleValue(); + } else if (value instanceof String) { + ret = Double.parseDouble((String) value); + } else { + ret = 1; //must call toPrimitive + } + lda.operandStack.push(new Double(ret)); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), "double")); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertIIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertIIns.java index 46f916475..b1ef7a7be 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertIIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertIIns.java @@ -1,51 +1,65 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.ConvertTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class ConvertIIns extends InstructionDefinition { - - public ConvertIIns() { - super(0x73, "convert_i", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Object value = lda.operandStack.pop(); - long ret = 0; - if (value == null) { - ret = 0; - } else if (value instanceof Boolean) { - if (((Boolean) value).booleanValue()) { - ret = 1; - } else { - ret = 0; - } - } else if (value instanceof Long) { - ret = ((Long) value).longValue(); - } else if (value instanceof String) { - ret = Long.parseLong((String) value); - } else { - ret = 1; //must call toPrimitive - } - lda.operandStack.push(new Long(ret)); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), "int")); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.ConvertTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class ConvertIIns extends InstructionDefinition { + + public ConvertIIns() { + super(0x73, "convert_i", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Object value = lda.operandStack.pop(); + long ret = 0; + if (value == null) { + ret = 0; + } else if (value instanceof Boolean) { + if (((Boolean) value).booleanValue()) { + ret = 1; + } else { + ret = 0; + } + } else if (value instanceof Long) { + ret = ((Long) value).longValue(); + } else if (value instanceof String) { + ret = Long.parseLong((String) value); + } else { + ret = 1; //must call toPrimitive + } + lda.operandStack.push(new Long(ret)); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), "int")); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertOIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertOIns.java index 1fc873cd8..de65125f6 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertOIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertOIns.java @@ -1,34 +1,48 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.ConvertTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class ConvertOIns extends InstructionDefinition { - - public ConvertOIns() { - super(0x77, "convert_o", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - //throw if pop is not object - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), "Object")); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.ConvertTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class ConvertOIns extends InstructionDefinition { + + public ConvertOIns() { + super(0x77, "convert_o", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + //throw if pop is not object + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), "Object")); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertSIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertSIns.java index fb4ccc6d5..ee0a8f1ec 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertSIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertSIns.java @@ -1,35 +1,49 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.ConvertTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class ConvertSIns extends InstructionDefinition { - - public ConvertSIns() { - super(0x70, "convert_s", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - Object obj = lda.operandStack.pop(); - lda.operandStack.push(obj.toString()); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), "string")); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.ConvertTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class ConvertSIns extends InstructionDefinition { + + public ConvertSIns() { + super(0x70, "convert_s", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + Object obj = lda.operandStack.pop(); + lda.operandStack.push(obj.toString()); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), "string")); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertUIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertUIns.java index 4e368a92a..eb0d10298 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertUIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/ConvertUIns.java @@ -1,34 +1,48 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.ConvertTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class ConvertUIns extends InstructionDefinition { - - public ConvertUIns() { - super(0x74, "convert_u", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - throw new UnsupportedOperationException("Cannot convert to uint "); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), "uint")); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.ConvertTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class ConvertUIns extends InstructionDefinition { + + public ConvertUIns() { + super(0x74, "convert_u", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + throw new UnsupportedOperationException("Cannot convert to uint "); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new ConvertTreeItem(ins, (TreeItem) stack.pop(), "uint")); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/InstanceOfIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/InstanceOfIns.java index 8b035c971..f656a443c 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/InstanceOfIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/InstanceOfIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.InstanceOfTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class InstanceOfIns extends InstructionDefinition { - - public InstanceOfIns() { - super(0xb1, "instanceof", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem type = (TreeItem) stack.pop(); - TreeItem value = (TreeItem) stack.pop(); - stack.push(new InstanceOfTreeItem(ins, value, type)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.InstanceOfTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class InstanceOfIns extends InstructionDefinition { + + public InstanceOfIns() { + super(0xb1, "instanceof", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem type = (TreeItem) stack.pop(); + TreeItem value = (TreeItem) stack.pop(); + stack.push(new InstanceOfTreeItem(ins, value, type)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/IsTypeIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/IsTypeIns.java index d676f103c..049eb7348 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/IsTypeIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/IsTypeIns.java @@ -1,32 +1,46 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.IsTypeTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IsTypeIns extends InstructionDefinition { - - public IsTypeIns() { - super(0xb2, "istype", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - int multinameIndex = ins.operands[0]; - TreeItem value = (TreeItem) stack.pop(); - stack.push(new IsTypeTreeItem(ins, value, new FullMultinameTreeItem(ins, multinameIndex))); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.IsTypeTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IsTypeIns extends InstructionDefinition { + + public IsTypeIns() { + super(0xb2, "istype", new int[]{AVM2Code.DAT_MULTINAME_INDEX}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + int multinameIndex = ins.operands[0]; + TreeItem value = (TreeItem) stack.pop(); + stack.push(new IsTypeTreeItem(ins, value, new FullMultinameTreeItem(ins, multinameIndex))); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/IsTypeLateIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/IsTypeLateIns.java index 3ea630b4b..062aada16 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/IsTypeLateIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/IsTypeLateIns.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.IsTypeTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class IsTypeLateIns extends InstructionDefinition { - - public IsTypeLateIns() { - super(0xb3, "istypelate", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem type = (TreeItem) stack.pop(); - TreeItem value = (TreeItem) stack.pop(); - stack.push(new IsTypeTreeItem(ins, value, type)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.IsTypeTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class IsTypeLateIns extends InstructionDefinition { + + public IsTypeLateIns() { + super(0xb3, "istypelate", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem type = (TreeItem) stack.pop(); + TreeItem value = (TreeItem) stack.pop(); + stack.push(new IsTypeTreeItem(ins, value, type)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/TypeOfIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/TypeOfIns.java index 705461ea9..0e433b443 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/TypeOfIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/types/TypeOfIns.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.operations.TypeOfTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class TypeOfIns extends InstructionDefinition { - - public TypeOfIns() { - super(0x95, "typeof", new int[]{}); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new TypeOfTreeItem(ins, (TreeItem) stack.pop())); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.operations.TypeOfTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class TypeOfIns extends InstructionDefinition { + + public TypeOfIns() { + super(0x95, "typeof", new int[]{}); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new TypeOfTreeItem(ins, (TreeItem) stack.pop())); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/CheckFilterIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/CheckFilterIns.java index 9bdbbaf36..efc97c6c7 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/CheckFilterIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/CheckFilterIns.java @@ -1,35 +1,49 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.xml; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class CheckFilterIns extends InstructionDefinition { - - public CheckFilterIns() { - super(0x78, "checkfilter", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - //if pop() is not XML|XMLList throw - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.xml; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class CheckFilterIns extends InstructionDefinition { + + public CheckFilterIns() { + super(0x78, "checkfilter", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + //if pop() is not XML|XMLList throw + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/DXNSIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/DXNSIns.java index c29613072..f1a2b14eb 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/DXNSIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/DXNSIns.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.xml; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; - -import java.util.List; - - -public class DXNSIns extends InstructionDefinition { - - public DXNSIns() { - super(0x06, "dxns", new int[]{AVM2Code.DAT_STRING_INDEX}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - int strIndex = (int) ((Long) arguments.get(0)).longValue(); - String s = constants.constant_string[strIndex]; - System.out.println("Set default XML space " + s); - - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.xml; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; + +import java.util.List; + + +public class DXNSIns extends InstructionDefinition { + + public DXNSIns() { + super(0x06, "dxns", new int[]{AVM2Code.DAT_STRING_INDEX}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + int strIndex = (int) ((Long) arguments.get(0)).longValue(); + String s = constants.constant_string[strIndex]; + System.out.println("Set default XML space " + s); + + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/DXNSLateIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/DXNSLateIns.java index b6534b1ca..d80490fca 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/DXNSLateIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/DXNSLateIns.java @@ -1,36 +1,50 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.xml; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.UnparsedTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class DXNSLateIns extends InstructionDefinition { - - public DXNSLateIns() { - super(0x07, "dxnslate", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - String s = lda.operandStack.pop().toString(); - System.out.println("Set default XML space " + s); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - TreeItem xmlns = stack.pop(); - stack.push(new UnparsedTreeItem(ins, "XMLNS:" + xmlns.toString(constants))); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.xml; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.UnparsedTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class DXNSLateIns extends InstructionDefinition { + + public DXNSLateIns() { + super(0x07, "dxnslate", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + String s = lda.operandStack.pop().toString(); + System.out.println("Set default XML space " + s); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + TreeItem xmlns = stack.pop(); + stack.push(new UnparsedTreeItem(ins, "XMLNS:" + xmlns.toString(constants))); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/EscXAttrIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/EscXAttrIns.java index 3a0d59f43..8bded8056 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/EscXAttrIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/EscXAttrIns.java @@ -1,36 +1,50 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.xml; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.UnparsedTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class EscXAttrIns extends InstructionDefinition { - - public EscXAttrIns() { - super(0x72, "esc_xattr", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - String s = lda.operandStack.pop().toString(); - //escape - lda.operandStack.push(s); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new UnparsedTreeItem(ins, "esc_xattr(" + stack.pop().toString(constants) + ")")); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.xml; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.UnparsedTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class EscXAttrIns extends InstructionDefinition { + + public EscXAttrIns() { + super(0x72, "esc_xattr", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + String s = lda.operandStack.pop().toString(); + //escape + lda.operandStack.push(s); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new UnparsedTreeItem(ins, "esc_xattr(" + stack.pop().toString(constants) + ")")); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/EscXElemIns.java b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/EscXElemIns.java index c5b9eae34..7863dcf0f 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/EscXElemIns.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/instructions/xml/EscXElemIns.java @@ -1,36 +1,50 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.instructions.xml; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.LocalDataArea; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.UnparsedTreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; - -import java.util.List; -import java.util.Stack; - - -public class EscXElemIns extends InstructionDefinition { - - public EscXElemIns() { - super(0x71, "esc_xelem", new int[]{}); - } - - @Override - public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { - String s = lda.operandStack.pop().toString(); - //escape - lda.operandStack.push(s); - } - - @Override - public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { - stack.push(new UnparsedTreeItem(ins, "esc_xelem(" + stack.pop().toString(constants) + ")")); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.instructions.xml; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.LocalDataArea; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.UnparsedTreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; + +import java.util.List; +import java.util.Stack; + + +public class EscXElemIns extends InstructionDefinition { + + public EscXElemIns() { + super(0x71, "esc_xelem", new int[]{}); + } + + @Override + public void execute(LocalDataArea lda, ConstantPool constants, List arguments) { + String s = lda.operandStack.pop().toString(); + //escape + lda.operandStack.push(s); + } + + @Override + public void translate(boolean isStatic, int classIndex, java.util.HashMap localRegs, Stack stack, java.util.Stack scopeStack, ConstantPool constants, AVM2Instruction ins, MethodInfo[] method_info, List output, com.jpexs.asdec.abc.types.MethodBody body, com.jpexs.asdec.abc.ABC abc) { + stack.push(new UnparsedTreeItem(ins, "esc_xelem(" + stack.pop().toString(constants) + ")")); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/parser/ASM3Parser.java b/trunk/src/com/jpexs/asdec/abc/avm2/parser/ASM3Parser.java index dfc8c7a7b..5a28bcb16 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/parser/ASM3Parser.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/parser/ASM3Parser.java @@ -1,443 +1,457 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.parser; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - - -public class ASM3Parser { - - private static class OffsetItem { - - public String label = ""; - public long insPosition; - public int insOperandIndex; - - public OffsetItem(String label, long insOffset, int insOperandIndex) { - this.label = label; - this.insPosition = insOffset; - this.insOperandIndex = insOperandIndex; - } - } - - private static class CaseOffsetItem extends OffsetItem { - - public CaseOffsetItem(String label, long insOffset, int insOperandIndex) { - super(label, insOffset, insOperandIndex); - } - } - - private static class LabelItem { - - public String label = ""; - public int offset; - - public LabelItem(String label, int offset) { - this.label = label; - this.offset = offset; - } - } - - public static AVM2Code parse(InputStream is, ConstantPool constants) throws IOException, ParseException { - return parse(is, constants, null); - } - - public static AVM2Code parse(InputStream is, ConstantPool constants, MissingSymbolHandler missingHandler) throws IOException, ParseException { - AVM2Code code = new AVM2Code(); - - List offsetItems = new ArrayList(); - List labelItems = new ArrayList(); - int offset = 0; - - Flasm3Lexer lexer = new Flasm3Lexer(is); - - ParsedSymbol symb; - AVM2Instruction lastIns = null; - do { - symb = lexer.yylex(); - if (symb.type == ParsedSymbol.TYPE_EOF) break; - if (symb.type == ParsedSymbol.TYPE_COMMENT) { - if (lastIns != null) { - lastIns.comment = (String) symb.value; - } - continue; - } - if (symb.type == ParsedSymbol.TYPE_INSTRUCTION_NAME) { - boolean insFound = false; - for (InstructionDefinition def : AVM2Code.instructionSet) { - if (def.instructionName.equals((String) symb.value)) { - insFound = true; - List operandsList = new ArrayList(); - - for (int i = 0; i < def.operands.length; i++) { - ParsedSymbol parsedOperand = lexer.yylex(); - switch (def.operands[i]) { - case AVM2Code.DAT_MULTINAME_INDEX: - if (parsedOperand.type == ParsedSymbol.TYPE_MULTINAME) { - operandsList.add((int) (long) (Long) parsedOperand.value); - } else { - throw new ParseException("Multiname expected", lexer.yyline()); - } - break; - case AVM2Code.DAT_STRING_INDEX: - if (parsedOperand.type == ParsedSymbol.TYPE_STRING) { - int sid = constants.getStringId((String) parsedOperand.value); - if (sid == 0) { - if ((missingHandler != null) && (missingHandler.missingString((String) parsedOperand.value))) { - sid = constants.addString((String) parsedOperand.value); - } else { - throw new ParseException("Unknown String", lexer.yyline()); - } - } - operandsList.add(sid); - } else { - throw new ParseException("String expected", lexer.yyline()); - } - break; - case AVM2Code.DAT_INT_INDEX: - - if (parsedOperand.type == ParsedSymbol.TYPE_INTEGER) { - long intVal = (Long) parsedOperand.value; - int iid = constants.getIntId(intVal); - if (iid == 0) { - if ((missingHandler != null) && (missingHandler.missingInt(intVal))) { - iid = constants.addInt(intVal); - } else { - throw new ParseException("Unknown int", lexer.yyline()); - } - } - operandsList.add(iid); - } else { - throw new ParseException("Integer expected", lexer.yyline()); - } - break; - case AVM2Code.DAT_UINT_INDEX: - if (parsedOperand.type == ParsedSymbol.TYPE_INTEGER) { - long intVal = (Long) parsedOperand.value; - int iid = constants.getUIntId(intVal); - if (iid == 0) { - if ((missingHandler != null) && (missingHandler.missingUInt(intVal))) { - iid = constants.addUInt(intVal); - } else { - throw new ParseException("Unknown uint", lexer.yyline()); - } - } - operandsList.add(iid); - } else { - throw new ParseException("Integer expected", lexer.yyline()); - } - break; - case AVM2Code.DAT_DOUBLE_INDEX: - if ((parsedOperand.type == ParsedSymbol.TYPE_INTEGER) || (parsedOperand.type == ParsedSymbol.TYPE_FLOAT)) { - - double doubleVal = 0; - if (parsedOperand.type == ParsedSymbol.TYPE_INTEGER) - doubleVal = (Long) parsedOperand.value; - if (parsedOperand.type == ParsedSymbol.TYPE_FLOAT) - doubleVal = (Double) parsedOperand.value; - int did = constants.getDoubleId(doubleVal); - if (did == 0) { - if ((missingHandler != null) && (missingHandler.missingDouble(doubleVal))) { - did = constants.addDouble(doubleVal); - } else { - throw new ParseException("Unknown double", lexer.yyline()); - } - } - operandsList.add(did); - } else { - throw new ParseException("Float value expected", lexer.yyline()); - } - break; - case AVM2Code.DAT_OFFSET: - if (parsedOperand.type == ParsedSymbol.TYPE_IDENTIFIER) { - offsetItems.add(new OffsetItem((String) parsedOperand.value, code.code.size(), i)); - operandsList.add(0); - } else { - throw new ParseException("Offset expected", lexer.yyline()); - } - break; - case AVM2Code.DAT_CASE_BASEOFFSET: - if (parsedOperand.type == ParsedSymbol.TYPE_IDENTIFIER) { - offsetItems.add(new CaseOffsetItem((String) parsedOperand.value, code.code.size(), i)); - operandsList.add(0); - } else { - throw new ParseException("Offset expected", lexer.yyline()); - } - break; - case AVM2Code.OPT_CASE_OFFSETS: - - if (parsedOperand.type == ParsedSymbol.TYPE_INTEGER) { - int patCount = (int) (long) (Long) parsedOperand.value; - operandsList.add(patCount); - - for (int c = 0; c <= patCount; c++) { - parsedOperand = lexer.yylex(); - if (parsedOperand.type == ParsedSymbol.TYPE_IDENTIFIER) { - offsetItems.add(new CaseOffsetItem((String) parsedOperand.value, code.code.size(), i + (c + 1))); - operandsList.add(0); - } else { - throw new ParseException("Offset expected", lexer.yyline()); - } - } - } else { - throw new ParseException("Case count expected", lexer.yyline()); - } - break; - default: - if (parsedOperand.type == ParsedSymbol.TYPE_INTEGER) { - operandsList.add((int) (long) (Long) parsedOperand.value); - } else { - throw new ParseException("Integer expected", lexer.yyline()); - } - } - } - - int operands[] = new int[operandsList.size()]; - for (int i = 0; i < operandsList.size(); i++) { - operands[i] = operandsList.get(i); - } - lastIns = new AVM2Instruction(offset, def, operands, new byte[0]); - code.code.add(lastIns); - offset += lastIns.getBytes().length; - break; - } - } - if (!insFound) { - throw new ParseException("Invalid instruction name:" + (String) symb.value, lexer.yyline()); - } - } else if (symb.type == ParsedSymbol.TYPE_LABEL) { - labelItems.add(new LabelItem((String) symb.value, offset)); - - } else { - throw new ParseException("Unexpected symbol", lexer.yyline()); - } - } while (symb.type != ParsedSymbol.TYPE_EOF); - - for (OffsetItem oi : offsetItems) { - for (LabelItem li : labelItems) { - if (oi.label.equals(li.label)) { - AVM2Instruction ins = code.code.get((int) oi.insPosition); - int relOffset = 0; - if (oi instanceof CaseOffsetItem) { - relOffset = li.offset - (int) ins.offset; - } else { - relOffset = li.offset - ((int) ins.offset + ins.getBytes().length); - } - ins.operands[oi.insOperandIndex] = relOffset; - } - } - } - - /* BufferedReader br = new BufferedReader(new InputStreamReader(is)); - String s = ""; - Pattern patInsName = Pattern.compile("^([a-z0-9_]+) "); - Pattern patLabelName = Pattern.compile("^([a-zA-Z_0-9]+): "); - Pattern patInt = Pattern.compile("^([+-]?[0-9]+) "); - Pattern patDouble = Pattern.compile("^([+-]?[0-9e.]+) "); - Pattern patMultiname = Pattern.compile("^m\\[([0-9]+)\\]\"[^\"]*\" "); - Pattern patString = Pattern.compile("\"([^\"]*)\" "); - Pattern patofs = Pattern.compile("^([a-zA-Z_0-9]+) "); - - - long line = 0; - - while ((s = br.readLine()) != null) { - line++; - s += " "; - Matcher m = patInsName.matcher(s); - if (m.find()) { - String insName = m.group(1); - boolean insFound = false; - for (InstructionDefinition def : AVM2Code.instructionSet) { - if (def.instructionName.equals(insName)) { - insFound = true; - s = s.substring(insName.length() + 1); - List operandsList = new ArrayList(); - - for (int i = 0; i < def.operands.length; i++) { - switch (def.operands[i]) { - case AVM2Code.DAT_MULTINAME_INDEX: - m = patMultiname.matcher(s); - if (m.find()) { - operandsList.add(Integer.parseInt(m.group(1))); - s = s.substring(m.group(0).length()); - } else { - throw new ParseException("Invalid multiname", line); - } - break; - case AVM2Code.DAT_STRING_INDEX: - m = patString.matcher(s); - if (m.find()) { - String str = m.group(1); - int sid = constants.getStringId(str); - if (sid == 0) { - if((missingHandler!=null)&&(missingHandler.missingString(str))){ - sid=constants.addString(str); - }else{ - throw new ParseException("Unknown String", line); - } - } - operandsList.add(sid); - s = s.substring(m.group(0).length()); - } else { - throw new ParseException("Invalid String", line); - } - break; - case AVM2Code.DAT_INT_INDEX: - m = patInt.matcher(s); - if (m.find()) { - long intVal=Integer.parseInt(m.group(1)); - int iid = constants.getIntId(intVal); - if (iid == 0) { - if((missingHandler!=null)&&(missingHandler.missingInt(intVal))){ - iid=constants.addInt(intVal); - }else{ - throw new ParseException("Unknown int", line); - } - } - operandsList.add(iid); - s = s.substring(m.group(0).length()); - } else { - throw new ParseException("Invalid int value", line); - } - break; - case AVM2Code.DAT_UINT_INDEX: - m = patInt.matcher(s); - if (m.find()) { - long intVal=Integer.parseInt(m.group(1)); - int iid = constants.getUIntId(intVal); - if (iid == 0) { - if((missingHandler!=null)&&(missingHandler.missingUInt(intVal))){ - iid=constants.addUInt(intVal); - }else{ - throw new ParseException("Unknown uint", line); - } - } - operandsList.add(iid); - s = s.substring(m.group(0).length()); - } else { - throw new ParseException("Invalid uint value", line); - } - break; - case AVM2Code.DAT_DOUBLE_INDEX: - m = patDouble.matcher(s); - if (m.find()) { - double doubleVal=Double.parseDouble(m.group(1)); - int did = constants.getDoubleId(doubleVal); - if (did == 0) { - if((missingHandler!=null)&&(missingHandler.missingDouble(doubleVal))){ - did=constants.addDouble(doubleVal); - }else{ - throw new ParseException("Unknown double", line); - } - } - operandsList.add(did); - s = s.substring(m.group(0).length()); - } else { - throw new ParseException("Invalid double value", line); - } - break; - case AVM2Code.DAT_OFFSET: - m = patofs.matcher(s); - if (m.find()) { - offsetItems.add(new OffsetItem(m.group(1), code.code.size(), i)); - operandsList.add(0); - s = s.substring(m.group(0).length()); - } else { - throw new ParseException("Invalid offset value", line); - } - break; - case AVM2Code.DAT_CASE_BASEOFFSET: - m = patofs.matcher(s); - if (m.find()) { - offsetItems.add(new CaseOffsetItem(m.group(1), code.code.size(), i)); - operandsList.add(0); - s = s.substring(m.group(0).length()); - } else { - throw new ParseException("Invalid offset value", line); - } - break; - case AVM2Code.OPT_CASE_OFFSETS: - m = patInt.matcher(s); - if (m.find()) { - int patCount = Integer.parseInt(m.group(1)); - operandsList.add(patCount); - s = s.substring(m.group(0).length()); - m = patofs.matcher(s); - int k = 1; - for (int c = 0; c <= patCount; c++) { - if (m.find()) { - offsetItems.add(new CaseOffsetItem(m.group(1), code.code.size(), i + k)); - operandsList.add(0); - s = s.substring(m.group(0).length()); - m = patofs.matcher(s); - k++; - } else { - throw new ParseException("Invalid case count", line); - } - } - } else { - throw new ParseException("Invalid case count", line); - } - break; - default: - m = patInt.matcher(s); - if (m.find()) { - operandsList.add(Integer.parseInt(m.group(1))); - s = s.substring(m.group(0).length()); - } else { - throw new ParseException("Invalid value", line); - } - } - } - - int operands[] = new int[operandsList.size()]; - for (int i = 0; i < operandsList.size(); i++) { - operands[i] = operandsList.get(i); - } - AVM2Instruction ins = new AVM2Instruction(offset, def, operands, new byte[0]); - code.code.add(ins); - offset += ins.getBytes().length; - break; - } - } - if (!insFound) { - throw new ParseException("Invalid instruction name:" + insName, line); - } - } else { - m = patLabelName.matcher(s); - if (m.find()) { - labelItems.add(new LabelItem(m.group(1), offset)); - } else { - throw new ParseException("Invalid instruction name", line); - } - } - } - - for (OffsetItem oi : offsetItems) { - for (LabelItem li : labelItems) { - if (oi.label.equals(li.label)) { - AVM2Instruction ins = code.code.get((int) oi.insPosition); - int relOffset = 0; - if (oi instanceof CaseOffsetItem) { - relOffset = li.offset - (int) ins.offset; - } else { - relOffset = li.offset - ((int) ins.offset + ins.getBytes().length); - } - ins.operands[oi.insOperandIndex] = relOffset; - } - } - }*/ - return code; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.parser; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + + +public class ASM3Parser { + + private static class OffsetItem { + + public String label = ""; + public long insPosition; + public int insOperandIndex; + + public OffsetItem(String label, long insOffset, int insOperandIndex) { + this.label = label; + this.insPosition = insOffset; + this.insOperandIndex = insOperandIndex; + } + } + + private static class CaseOffsetItem extends OffsetItem { + + public CaseOffsetItem(String label, long insOffset, int insOperandIndex) { + super(label, insOffset, insOperandIndex); + } + } + + private static class LabelItem { + + public String label = ""; + public int offset; + + public LabelItem(String label, int offset) { + this.label = label; + this.offset = offset; + } + } + + public static AVM2Code parse(InputStream is, ConstantPool constants) throws IOException, ParseException { + return parse(is, constants, null); + } + + public static AVM2Code parse(InputStream is, ConstantPool constants, MissingSymbolHandler missingHandler) throws IOException, ParseException { + AVM2Code code = new AVM2Code(); + + List offsetItems = new ArrayList(); + List labelItems = new ArrayList(); + int offset = 0; + + Flasm3Lexer lexer = new Flasm3Lexer(is); + + ParsedSymbol symb; + AVM2Instruction lastIns = null; + do { + symb = lexer.yylex(); + if (symb.type == ParsedSymbol.TYPE_EOF) break; + if (symb.type == ParsedSymbol.TYPE_COMMENT) { + if (lastIns != null) { + lastIns.comment = (String) symb.value; + } + continue; + } + if (symb.type == ParsedSymbol.TYPE_INSTRUCTION_NAME) { + boolean insFound = false; + for (InstructionDefinition def : AVM2Code.instructionSet) { + if (def.instructionName.equals((String) symb.value)) { + insFound = true; + List operandsList = new ArrayList(); + + for (int i = 0; i < def.operands.length; i++) { + ParsedSymbol parsedOperand = lexer.yylex(); + switch (def.operands[i]) { + case AVM2Code.DAT_MULTINAME_INDEX: + if (parsedOperand.type == ParsedSymbol.TYPE_MULTINAME) { + operandsList.add((int) (long) (Long) parsedOperand.value); + } else { + throw new ParseException("Multiname expected", lexer.yyline()); + } + break; + case AVM2Code.DAT_STRING_INDEX: + if (parsedOperand.type == ParsedSymbol.TYPE_STRING) { + int sid = constants.getStringId((String) parsedOperand.value); + if (sid == 0) { + if ((missingHandler != null) && (missingHandler.missingString((String) parsedOperand.value))) { + sid = constants.addString((String) parsedOperand.value); + } else { + throw new ParseException("Unknown String", lexer.yyline()); + } + } + operandsList.add(sid); + } else { + throw new ParseException("String expected", lexer.yyline()); + } + break; + case AVM2Code.DAT_INT_INDEX: + + if (parsedOperand.type == ParsedSymbol.TYPE_INTEGER) { + long intVal = (Long) parsedOperand.value; + int iid = constants.getIntId(intVal); + if (iid == 0) { + if ((missingHandler != null) && (missingHandler.missingInt(intVal))) { + iid = constants.addInt(intVal); + } else { + throw new ParseException("Unknown int", lexer.yyline()); + } + } + operandsList.add(iid); + } else { + throw new ParseException("Integer expected", lexer.yyline()); + } + break; + case AVM2Code.DAT_UINT_INDEX: + if (parsedOperand.type == ParsedSymbol.TYPE_INTEGER) { + long intVal = (Long) parsedOperand.value; + int iid = constants.getUIntId(intVal); + if (iid == 0) { + if ((missingHandler != null) && (missingHandler.missingUInt(intVal))) { + iid = constants.addUInt(intVal); + } else { + throw new ParseException("Unknown uint", lexer.yyline()); + } + } + operandsList.add(iid); + } else { + throw new ParseException("Integer expected", lexer.yyline()); + } + break; + case AVM2Code.DAT_DOUBLE_INDEX: + if ((parsedOperand.type == ParsedSymbol.TYPE_INTEGER) || (parsedOperand.type == ParsedSymbol.TYPE_FLOAT)) { + + double doubleVal = 0; + if (parsedOperand.type == ParsedSymbol.TYPE_INTEGER) + doubleVal = (Long) parsedOperand.value; + if (parsedOperand.type == ParsedSymbol.TYPE_FLOAT) + doubleVal = (Double) parsedOperand.value; + int did = constants.getDoubleId(doubleVal); + if (did == 0) { + if ((missingHandler != null) && (missingHandler.missingDouble(doubleVal))) { + did = constants.addDouble(doubleVal); + } else { + throw new ParseException("Unknown double", lexer.yyline()); + } + } + operandsList.add(did); + } else { + throw new ParseException("Float value expected", lexer.yyline()); + } + break; + case AVM2Code.DAT_OFFSET: + if (parsedOperand.type == ParsedSymbol.TYPE_IDENTIFIER) { + offsetItems.add(new OffsetItem((String) parsedOperand.value, code.code.size(), i)); + operandsList.add(0); + } else { + throw new ParseException("Offset expected", lexer.yyline()); + } + break; + case AVM2Code.DAT_CASE_BASEOFFSET: + if (parsedOperand.type == ParsedSymbol.TYPE_IDENTIFIER) { + offsetItems.add(new CaseOffsetItem((String) parsedOperand.value, code.code.size(), i)); + operandsList.add(0); + } else { + throw new ParseException("Offset expected", lexer.yyline()); + } + break; + case AVM2Code.OPT_CASE_OFFSETS: + + if (parsedOperand.type == ParsedSymbol.TYPE_INTEGER) { + int patCount = (int) (long) (Long) parsedOperand.value; + operandsList.add(patCount); + + for (int c = 0; c <= patCount; c++) { + parsedOperand = lexer.yylex(); + if (parsedOperand.type == ParsedSymbol.TYPE_IDENTIFIER) { + offsetItems.add(new CaseOffsetItem((String) parsedOperand.value, code.code.size(), i + (c + 1))); + operandsList.add(0); + } else { + throw new ParseException("Offset expected", lexer.yyline()); + } + } + } else { + throw new ParseException("Case count expected", lexer.yyline()); + } + break; + default: + if (parsedOperand.type == ParsedSymbol.TYPE_INTEGER) { + operandsList.add((int) (long) (Long) parsedOperand.value); + } else { + throw new ParseException("Integer expected", lexer.yyline()); + } + } + } + + int operands[] = new int[operandsList.size()]; + for (int i = 0; i < operandsList.size(); i++) { + operands[i] = operandsList.get(i); + } + lastIns = new AVM2Instruction(offset, def, operands, new byte[0]); + code.code.add(lastIns); + offset += lastIns.getBytes().length; + break; + } + } + if (!insFound) { + throw new ParseException("Invalid instruction name:" + (String) symb.value, lexer.yyline()); + } + } else if (symb.type == ParsedSymbol.TYPE_LABEL) { + labelItems.add(new LabelItem((String) symb.value, offset)); + + } else { + throw new ParseException("Unexpected symbol", lexer.yyline()); + } + } while (symb.type != ParsedSymbol.TYPE_EOF); + + for (OffsetItem oi : offsetItems) { + for (LabelItem li : labelItems) { + if (oi.label.equals(li.label)) { + AVM2Instruction ins = code.code.get((int) oi.insPosition); + int relOffset = 0; + if (oi instanceof CaseOffsetItem) { + relOffset = li.offset - (int) ins.offset; + } else { + relOffset = li.offset - ((int) ins.offset + ins.getBytes().length); + } + ins.operands[oi.insOperandIndex] = relOffset; + } + } + } + + /* BufferedReader br = new BufferedReader(new InputStreamReader(is)); + String s = ""; + Pattern patInsName = Pattern.compile("^([a-z0-9_]+) "); + Pattern patLabelName = Pattern.compile("^([a-zA-Z_0-9]+): "); + Pattern patInt = Pattern.compile("^([+-]?[0-9]+) "); + Pattern patDouble = Pattern.compile("^([+-]?[0-9e.]+) "); + Pattern patMultiname = Pattern.compile("^m\\[([0-9]+)\\]\"[^\"]*\" "); + Pattern patString = Pattern.compile("\"([^\"]*)\" "); + Pattern patofs = Pattern.compile("^([a-zA-Z_0-9]+) "); + + + long line = 0; + + while ((s = br.readLine()) != null) { + line++; + s += " "; + Matcher m = patInsName.matcher(s); + if (m.find()) { + String insName = m.group(1); + boolean insFound = false; + for (InstructionDefinition def : AVM2Code.instructionSet) { + if (def.instructionName.equals(insName)) { + insFound = true; + s = s.substring(insName.length() + 1); + List operandsList = new ArrayList(); + + for (int i = 0; i < def.operands.length; i++) { + switch (def.operands[i]) { + case AVM2Code.DAT_MULTINAME_INDEX: + m = patMultiname.matcher(s); + if (m.find()) { + operandsList.add(Integer.parseInt(m.group(1))); + s = s.substring(m.group(0).length()); + } else { + throw new ParseException("Invalid multiname", line); + } + break; + case AVM2Code.DAT_STRING_INDEX: + m = patString.matcher(s); + if (m.find()) { + String str = m.group(1); + int sid = constants.getStringId(str); + if (sid == 0) { + if((missingHandler!=null)&&(missingHandler.missingString(str))){ + sid=constants.addString(str); + }else{ + throw new ParseException("Unknown String", line); + } + } + operandsList.add(sid); + s = s.substring(m.group(0).length()); + } else { + throw new ParseException("Invalid String", line); + } + break; + case AVM2Code.DAT_INT_INDEX: + m = patInt.matcher(s); + if (m.find()) { + long intVal=Integer.parseInt(m.group(1)); + int iid = constants.getIntId(intVal); + if (iid == 0) { + if((missingHandler!=null)&&(missingHandler.missingInt(intVal))){ + iid=constants.addInt(intVal); + }else{ + throw new ParseException("Unknown int", line); + } + } + operandsList.add(iid); + s = s.substring(m.group(0).length()); + } else { + throw new ParseException("Invalid int value", line); + } + break; + case AVM2Code.DAT_UINT_INDEX: + m = patInt.matcher(s); + if (m.find()) { + long intVal=Integer.parseInt(m.group(1)); + int iid = constants.getUIntId(intVal); + if (iid == 0) { + if((missingHandler!=null)&&(missingHandler.missingUInt(intVal))){ + iid=constants.addUInt(intVal); + }else{ + throw new ParseException("Unknown uint", line); + } + } + operandsList.add(iid); + s = s.substring(m.group(0).length()); + } else { + throw new ParseException("Invalid uint value", line); + } + break; + case AVM2Code.DAT_DOUBLE_INDEX: + m = patDouble.matcher(s); + if (m.find()) { + double doubleVal=Double.parseDouble(m.group(1)); + int did = constants.getDoubleId(doubleVal); + if (did == 0) { + if((missingHandler!=null)&&(missingHandler.missingDouble(doubleVal))){ + did=constants.addDouble(doubleVal); + }else{ + throw new ParseException("Unknown double", line); + } + } + operandsList.add(did); + s = s.substring(m.group(0).length()); + } else { + throw new ParseException("Invalid double value", line); + } + break; + case AVM2Code.DAT_OFFSET: + m = patofs.matcher(s); + if (m.find()) { + offsetItems.add(new OffsetItem(m.group(1), code.code.size(), i)); + operandsList.add(0); + s = s.substring(m.group(0).length()); + } else { + throw new ParseException("Invalid offset value", line); + } + break; + case AVM2Code.DAT_CASE_BASEOFFSET: + m = patofs.matcher(s); + if (m.find()) { + offsetItems.add(new CaseOffsetItem(m.group(1), code.code.size(), i)); + operandsList.add(0); + s = s.substring(m.group(0).length()); + } else { + throw new ParseException("Invalid offset value", line); + } + break; + case AVM2Code.OPT_CASE_OFFSETS: + m = patInt.matcher(s); + if (m.find()) { + int patCount = Integer.parseInt(m.group(1)); + operandsList.add(patCount); + s = s.substring(m.group(0).length()); + m = patofs.matcher(s); + int k = 1; + for (int c = 0; c <= patCount; c++) { + if (m.find()) { + offsetItems.add(new CaseOffsetItem(m.group(1), code.code.size(), i + k)); + operandsList.add(0); + s = s.substring(m.group(0).length()); + m = patofs.matcher(s); + k++; + } else { + throw new ParseException("Invalid case count", line); + } + } + } else { + throw new ParseException("Invalid case count", line); + } + break; + default: + m = patInt.matcher(s); + if (m.find()) { + operandsList.add(Integer.parseInt(m.group(1))); + s = s.substring(m.group(0).length()); + } else { + throw new ParseException("Invalid value", line); + } + } + } + + int operands[] = new int[operandsList.size()]; + for (int i = 0; i < operandsList.size(); i++) { + operands[i] = operandsList.get(i); + } + AVM2Instruction ins = new AVM2Instruction(offset, def, operands, new byte[0]); + code.code.add(ins); + offset += ins.getBytes().length; + break; + } + } + if (!insFound) { + throw new ParseException("Invalid instruction name:" + insName, line); + } + } else { + m = patLabelName.matcher(s); + if (m.find()) { + labelItems.add(new LabelItem(m.group(1), offset)); + } else { + throw new ParseException("Invalid instruction name", line); + } + } + } + + for (OffsetItem oi : offsetItems) { + for (LabelItem li : labelItems) { + if (oi.label.equals(li.label)) { + AVM2Instruction ins = code.code.get((int) oi.insPosition); + int relOffset = 0; + if (oi instanceof CaseOffsetItem) { + relOffset = li.offset - (int) ins.offset; + } else { + relOffset = li.offset - ((int) ins.offset + ins.getBytes().length); + } + ins.operands[oi.insOperandIndex] = relOffset; + } + } + }*/ + return code; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/parser/Flasm3Lexer.java b/trunk/src/com/jpexs/asdec/abc/avm2/parser/Flasm3Lexer.java index 26cec68fd..89f2459e0 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/parser/Flasm3Lexer.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/parser/Flasm3Lexer.java @@ -1,6 +1,20 @@ -/* The following code was generated by JFlex 1.4.3 on 18.8.10 12:17 */ - -/* Flash assembler language lexer specification */ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ package com.jpexs.asdec.abc.avm2.parser; diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/parser/MissingSymbolHandler.java b/trunk/src/com/jpexs/asdec/abc/avm2/parser/MissingSymbolHandler.java index 96924d0e6..a371e7daa 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/parser/MissingSymbolHandler.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/parser/MissingSymbolHandler.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.parser; - - -public interface MissingSymbolHandler { - public boolean missingString(String value); - - public boolean missingInt(long value); - - public boolean missingUInt(long value); - - public boolean missingDouble(double value); - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.parser; + + +public interface MissingSymbolHandler { + public boolean missingString(String value); + + public boolean missingInt(long value); + + public boolean missingUInt(long value); + + public boolean missingDouble(double value); + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/parser/ParseException.java b/trunk/src/com/jpexs/asdec/abc/avm2/parser/ParseException.java index cb910267a..7ab025c09 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/parser/ParseException.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/parser/ParseException.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.parser; - - -public class ParseException extends Exception { - public long line; - public String text; - - public ParseException(String text, long line) { - super("ParseException:" + text + " on line " + line); - this.line = line; - this.text = text; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.parser; + + +public class ParseException extends Exception { + public long line; + public String text; + + public ParseException(String text, long line) { + super("ParseException:" + text + " on line " + line); + this.line = line; + this.text = text; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/parser/ParsedSymbol.java b/trunk/src/com/jpexs/asdec/abc/avm2/parser/ParsedSymbol.java index 88f98a0fa..a3a9679f0 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/parser/ParsedSymbol.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/parser/ParsedSymbol.java @@ -1,31 +1,45 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.parser; - - -public class ParsedSymbol { - public int type; - public Object value; - - public static final int TYPE_STRING = 1; - public static final int TYPE_MULTINAME = 2; - public static final int TYPE_INSTRUCTION_NAME = 3; - public static final int TYPE_INTEGER = 4; - public static final int TYPE_FLOAT = 5; - public static final int TYPE_IDENTIFIER = 6; - public static final int TYPE_EOF = 7; - public static final int TYPE_LABEL = 8; - public static final int TYPE_COMMENT = 9; - - public ParsedSymbol(int type, Object value) { - this.type = type; - this.value = value; - } - - public ParsedSymbol(int type) { - this.type = type; - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.parser; + + +public class ParsedSymbol { + public int type; + public Object value; + + public static final int TYPE_STRING = 1; + public static final int TYPE_MULTINAME = 2; + public static final int TYPE_INSTRUCTION_NAME = 3; + public static final int TYPE_INTEGER = 4; + public static final int TYPE_FLOAT = 5; + public static final int TYPE_IDENTIFIER = 6; + public static final int TYPE_EOF = 7; + public static final int TYPE_LABEL = 8; + public static final int TYPE_COMMENT = 9; + + public ParsedSymbol(int type, Object value) { + this.type = type; + this.value = value; + } + + public ParsedSymbol(int type) { + this.type = type; + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/BooleanTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/BooleanTreeItem.java index 4d128db46..4e3af23a7 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/BooleanTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/BooleanTreeItem.java @@ -1,36 +1,50 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class BooleanTreeItem extends TreeItem { - - public Boolean value; - - public BooleanTreeItem(AVM2Instruction instruction, Boolean value) { - super(instruction, PRECEDENCE_PRIMARY); - this.value = value; - } - - @Override - public String toString(ConstantPool constants) { - return value.toString(); - } - - @Override - public boolean isFalse() { - return value == false; - } - - @Override - public boolean isTrue() { - return value == true; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class BooleanTreeItem extends TreeItem { + + public Boolean value; + + public BooleanTreeItem(AVM2Instruction instruction, Boolean value) { + super(instruction, PRECEDENCE_PRIMARY); + this.value = value; + } + + @Override + public String toString(ConstantPool constants) { + return value.toString(); + } + + @Override + public boolean isFalse() { + return value == false; + } + + @Override + public boolean isTrue() { + return value == true; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/BreakTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/BreakTreeItem.java index df55fcd93..11181960a 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/BreakTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/BreakTreeItem.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class BreakTreeItem extends TreeItem { - public int loopPos; - public boolean isKnown; - - public BreakTreeItem(AVM2Instruction instruction, int loopPos) { - this(instruction, loopPos, true); - } - - public BreakTreeItem(AVM2Instruction instruction, int loopPos, boolean isKnown) { - super(instruction, NOPRECEDENCE); - this.loopPos = loopPos; - this.isKnown = isKnown; - } - - @Override - public String toString(ConstantPool constants) { - return hilight("break") + " loop" + loopPos + ";"; - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class BreakTreeItem extends TreeItem { + public int loopPos; + public boolean isKnown; + + public BreakTreeItem(AVM2Instruction instruction, int loopPos) { + this(instruction, loopPos, true); + } + + public BreakTreeItem(AVM2Instruction instruction, int loopPos, boolean isKnown) { + super(instruction, NOPRECEDENCE); + this.loopPos = loopPos; + this.isKnown = isKnown; + } + + @Override + public String toString(ConstantPool constants) { + return hilight("break") + " loop" + loopPos + ";"; + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallMethodTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallMethodTreeItem.java index d71978180..620baab2b 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallMethodTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallMethodTreeItem.java @@ -1,38 +1,52 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - -import java.util.List; - - -public class CallMethodTreeItem extends TreeItem { - public TreeItem receiver; - public String methodName; - public List arguments; - - public CallMethodTreeItem(AVM2Instruction instruction, TreeItem receiver, String methodName, List arguments) { - super(instruction, PRECEDENCE_PRIMARY); - this.receiver = receiver; - this.methodName = methodName; - this.arguments = arguments; - } - - @Override - public String toString(ConstantPool constants) { - String args = ""; - for (int a = 0; a < arguments.size(); a++) { - if (a > 0) { - args = args + ","; - } - args = args + arguments.get(a).toString(constants); - } - return receiver.toString(constants) + "." + methodName + hilight("(") + args + hilight(")"); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + +import java.util.List; + + +public class CallMethodTreeItem extends TreeItem { + public TreeItem receiver; + public String methodName; + public List arguments; + + public CallMethodTreeItem(AVM2Instruction instruction, TreeItem receiver, String methodName, List arguments) { + super(instruction, PRECEDENCE_PRIMARY); + this.receiver = receiver; + this.methodName = methodName; + this.arguments = arguments; + } + + @Override + public String toString(ConstantPool constants) { + String args = ""; + for (int a = 0; a < arguments.size(); a++) { + if (a > 0) { + args = args + ","; + } + args = args + arguments.get(a).toString(constants); + } + return receiver.toString(constants) + "." + methodName + hilight("(") + args + hilight(")"); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallPropertyTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallPropertyTreeItem.java index 5b0b1cd71..0d5000f39 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallPropertyTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallPropertyTreeItem.java @@ -1,40 +1,54 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - -import java.util.List; - - -public class CallPropertyTreeItem extends TreeItem { - public TreeItem receiver; - public FullMultinameTreeItem propertyName; - public List arguments; - public boolean isVoid; - - public CallPropertyTreeItem(AVM2Instruction instruction, boolean isVoid, TreeItem receiver, FullMultinameTreeItem propertyName, List arguments) { - super(instruction, PRECEDENCE_PRIMARY); - this.receiver = receiver; - this.propertyName = propertyName; - this.arguments = arguments; - this.isVoid = isVoid; - } - - @Override - public String toString(ConstantPool constants) { - String args = ""; - for (int a = 0; a < arguments.size(); a++) { - if (a > 0) { - args = args + ","; - } - args = args + arguments.get(a).toString(constants); - } - return formatProperty(constants, receiver, propertyName) + "(" + args + ")" + (isVoid ? ";" : ""); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + +import java.util.List; + + +public class CallPropertyTreeItem extends TreeItem { + public TreeItem receiver; + public FullMultinameTreeItem propertyName; + public List arguments; + public boolean isVoid; + + public CallPropertyTreeItem(AVM2Instruction instruction, boolean isVoid, TreeItem receiver, FullMultinameTreeItem propertyName, List arguments) { + super(instruction, PRECEDENCE_PRIMARY); + this.receiver = receiver; + this.propertyName = propertyName; + this.arguments = arguments; + this.isVoid = isVoid; + } + + @Override + public String toString(ConstantPool constants) { + String args = ""; + for (int a = 0; a < arguments.size(); a++) { + if (a > 0) { + args = args + ","; + } + args = args + arguments.get(a).toString(constants); + } + return formatProperty(constants, receiver, propertyName) + "(" + args + ")" + (isVoid ? ";" : ""); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallStaticTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallStaticTreeItem.java index 3ddfb78b9..5329fbdf9 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallStaticTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallStaticTreeItem.java @@ -1,38 +1,52 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - -import java.util.List; - - -public class CallStaticTreeItem extends TreeItem { - public TreeItem receiver; - public String methodName; - public List arguments; - - public CallStaticTreeItem(AVM2Instruction instruction, TreeItem receiver, String methodName, List arguments) { - super(instruction, PRECEDENCE_PRIMARY); - this.receiver = receiver; - this.methodName = methodName; - this.arguments = arguments; - } - - @Override - public String toString(ConstantPool constants) { - String args = ""; - for (int a = 0; a < arguments.size(); a++) { - if (a > 0) { - args = args + ","; - } - args = args + arguments.get(a).toString(constants); - } - return receiver.toString(constants) + hilight(".") + methodName + hilight("(") + args + hilight(")"); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + +import java.util.List; + + +public class CallStaticTreeItem extends TreeItem { + public TreeItem receiver; + public String methodName; + public List arguments; + + public CallStaticTreeItem(AVM2Instruction instruction, TreeItem receiver, String methodName, List arguments) { + super(instruction, PRECEDENCE_PRIMARY); + this.receiver = receiver; + this.methodName = methodName; + this.arguments = arguments; + } + + @Override + public String toString(ConstantPool constants) { + String args = ""; + for (int a = 0; a < arguments.size(); a++) { + if (a > 0) { + args = args + ","; + } + args = args + arguments.get(a).toString(constants); + } + return receiver.toString(constants) + hilight(".") + methodName + hilight("(") + args + hilight(")"); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallSuperTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallSuperTreeItem.java index b9e8517e4..b71e7f32a 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallSuperTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallSuperTreeItem.java @@ -1,43 +1,57 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.helpers.Highlighting; - -import java.util.List; - - -public class CallSuperTreeItem extends TreeItem { - public TreeItem receiver; - public FullMultinameTreeItem multiname; - public List arguments; - public boolean isVoid; - - public CallSuperTreeItem(AVM2Instruction instruction, boolean isVoid, TreeItem receiver, FullMultinameTreeItem multiname, List arguments) { - super(instruction, PRECEDENCE_PRIMARY); - this.receiver = receiver; - this.multiname = multiname; - this.arguments = arguments; - this.isVoid = isVoid; - } - - @Override - public String toString(ConstantPool constants) { - String args = ""; - for (int a = 0; a < arguments.size(); a++) { - if (a > 0) { - args = args + ","; - } - args = args + arguments.get(a).toString(constants); - } - String calee = receiver.toString(constants) + "."; - if (Highlighting.stripHilights(calee).equals("this.")) calee = ""; - return calee + hilight("super.") + multiname.toString(constants) + hilight("(") + args + hilight(")") + (isVoid ? ";" : ""); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.helpers.Highlighting; + +import java.util.List; + + +public class CallSuperTreeItem extends TreeItem { + public TreeItem receiver; + public FullMultinameTreeItem multiname; + public List arguments; + public boolean isVoid; + + public CallSuperTreeItem(AVM2Instruction instruction, boolean isVoid, TreeItem receiver, FullMultinameTreeItem multiname, List arguments) { + super(instruction, PRECEDENCE_PRIMARY); + this.receiver = receiver; + this.multiname = multiname; + this.arguments = arguments; + this.isVoid = isVoid; + } + + @Override + public String toString(ConstantPool constants) { + String args = ""; + for (int a = 0; a < arguments.size(); a++) { + if (a > 0) { + args = args + ","; + } + args = args + arguments.get(a).toString(constants); + } + String calee = receiver.toString(constants) + "."; + if (Highlighting.stripHilights(calee).equals("this.")) calee = ""; + return calee + hilight("super.") + multiname.toString(constants) + hilight("(") + args + hilight(")") + (isVoid ? ";" : ""); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallTreeItem.java index b5f37890c..203da2302 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CallTreeItem.java @@ -1,38 +1,52 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - -import java.util.List; - - -public class CallTreeItem extends TreeItem { - public TreeItem receiver; - public TreeItem function; - public List arguments; - - public CallTreeItem(AVM2Instruction instruction, TreeItem receiver, TreeItem function, List arguments) { - super(instruction, PRECEDENCE_PRIMARY); - this.receiver = receiver; - this.function = function; - this.arguments = arguments; - } - - @Override - public String toString(ConstantPool constants) { - String args = ""; - for (int a = 0; a < arguments.size(); a++) { - if (a > 0) { - args = args + ","; - } - args = args + arguments.get(a).toString(constants); - } - return receiver.toString(constants) + hilight(".") + function.toString(constants) + hilight("(") + args + hilight(")"); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + +import java.util.List; + + +public class CallTreeItem extends TreeItem { + public TreeItem receiver; + public TreeItem function; + public List arguments; + + public CallTreeItem(AVM2Instruction instruction, TreeItem receiver, TreeItem function, List arguments) { + super(instruction, PRECEDENCE_PRIMARY); + this.receiver = receiver; + this.function = function; + this.arguments = arguments; + } + + @Override + public String toString(ConstantPool constants) { + String args = ""; + for (int a = 0; a < arguments.size(); a++) { + if (a > 0) { + args = args + ","; + } + args = args + arguments.get(a).toString(constants); + } + return receiver.toString(constants) + hilight(".") + function.toString(constants) + hilight("(") + args + hilight(")"); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ClassTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ClassTreeItem.java index 151f028bb..3d3675fff 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ClassTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ClassTreeItem.java @@ -1,24 +1,38 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; - - -public class ClassTreeItem extends TreeItem { - public String className; - - public ClassTreeItem(String className) { - super(null, PRECEDENCE_PRIMARY); - this.className = className; - } - - @Override - public String toString(ConstantPool constants) { - return className; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; + + +public class ClassTreeItem extends TreeItem { + public String className; + + public ClassTreeItem(String className) { + super(null, PRECEDENCE_PRIMARY); + this.className = className; + } + + @Override + public String toString(ConstantPool constants) { + return className; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CoerceTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CoerceTreeItem.java index dca757630..7d2f40776 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CoerceTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/CoerceTreeItem.java @@ -1,27 +1,41 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class CoerceTreeItem extends TreeItem { - public TreeItem value; - public String type; - - public CoerceTreeItem(AVM2Instruction instruction, TreeItem value, String type) { - super(instruction, NOPRECEDENCE); - this.value = value; - this.type = type; - } - - @Override - public String toString(ConstantPool constants) { - //return hilight("("+type+")")+ - return value.toString(constants); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class CoerceTreeItem extends TreeItem { + public TreeItem value; + public String type; + + public CoerceTreeItem(AVM2Instruction instruction, TreeItem value, String type) { + super(instruction, NOPRECEDENCE); + this.value = value; + this.type = type; + } + + @Override + public String toString(ConstantPool constants) { + //return hilight("("+type+")")+ + return value.toString(constants); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructPropTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructPropTreeItem.java index 5fb27269a..dd8af8015 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructPropTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructPropTreeItem.java @@ -1,41 +1,55 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - -import java.util.List; - - -public class ConstructPropTreeItem extends TreeItem { - public TreeItem object; - public FullMultinameTreeItem propertyName; - public List args; - - public ConstructPropTreeItem(AVM2Instruction instruction, TreeItem object, FullMultinameTreeItem propertyName, List args) { - super(instruction, PRECEDENCE_PRIMARY); - this.object = object; - this.propertyName = propertyName; - this.args = args; - } - - @Override - public String toString(ConstantPool constants) { - String argStr = ""; - for (int a = 0; a < args.size(); a++) { - if (a > 0) { - argStr = argStr + ","; - } - argStr = argStr + args.get(a).toString(constants); - } - String objstr = object.toString(constants); - if (!objstr.equals("")) objstr += "."; - return hilight("new ") + objstr + propertyName.toString(constants) + hilight("(") + argStr + hilight(")"); - - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + +import java.util.List; + + +public class ConstructPropTreeItem extends TreeItem { + public TreeItem object; + public FullMultinameTreeItem propertyName; + public List args; + + public ConstructPropTreeItem(AVM2Instruction instruction, TreeItem object, FullMultinameTreeItem propertyName, List args) { + super(instruction, PRECEDENCE_PRIMARY); + this.object = object; + this.propertyName = propertyName; + this.args = args; + } + + @Override + public String toString(ConstantPool constants) { + String argStr = ""; + for (int a = 0; a < args.size(); a++) { + if (a > 0) { + argStr = argStr + ","; + } + argStr = argStr + args.get(a).toString(constants); + } + String objstr = object.toString(constants); + if (!objstr.equals("")) objstr += "."; + return hilight("new ") + objstr + propertyName.toString(constants) + hilight("(") + argStr + hilight(")"); + + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructSuperTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructSuperTreeItem.java index b1c84df7d..704c80064 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructSuperTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructSuperTreeItem.java @@ -1,40 +1,54 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.helpers.Highlighting; - -import java.util.List; - - -public class ConstructSuperTreeItem extends TreeItem { - public TreeItem object; - public List args; - - public ConstructSuperTreeItem(AVM2Instruction instruction, TreeItem object, List args) { - super(instruction, PRECEDENCE_PRIMARY); - this.object = object; - this.args = args; - } - - @Override - public String toString(ConstantPool constants) { - String argStr = ""; - for (int a = 0; a < args.size(); a++) { - if (a > 0) { - argStr = argStr + ","; - } - argStr = argStr + args.get(a).toString(constants); - } - String calee = object.toString(constants) + "."; - if (Highlighting.stripHilights(calee).equals("this.")) calee = ""; - return calee + hilight("super(") + argStr + hilight(")"); - - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.helpers.Highlighting; + +import java.util.List; + + +public class ConstructSuperTreeItem extends TreeItem { + public TreeItem object; + public List args; + + public ConstructSuperTreeItem(AVM2Instruction instruction, TreeItem object, List args) { + super(instruction, PRECEDENCE_PRIMARY); + this.object = object; + this.args = args; + } + + @Override + public String toString(ConstantPool constants) { + String argStr = ""; + for (int a = 0; a < args.size(); a++) { + if (a > 0) { + argStr = argStr + ","; + } + argStr = argStr + args.get(a).toString(constants); + } + String calee = object.toString(constants) + "."; + if (Highlighting.stripHilights(calee).equals("this.")) calee = ""; + return calee + hilight("super(") + argStr + hilight(")"); + + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructTreeItem.java index 841c91bbd..6e6589826 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConstructTreeItem.java @@ -1,40 +1,54 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - -import java.util.List; - - -public class ConstructTreeItem extends TreeItem { - public TreeItem object; - public List args; - - public ConstructTreeItem(AVM2Instruction instruction, TreeItem object, List args) { - super(instruction, PRECEDENCE_PRIMARY); - this.object = object; - this.args = args; - } - - @Override - public String toString(ConstantPool constants) { - String argStr = ""; - for (int a = 0; a < args.size(); a++) { - if (a > 0) { - argStr = argStr + ","; - } - argStr = argStr + args.get(a).toString(constants); - } - if (object instanceof NewFunctionTreeItem) { - return object.toString(constants); - } - return hilight("new ") + object.toString(constants) + hilight("(") + argStr + hilight(")"); - - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + +import java.util.List; + + +public class ConstructTreeItem extends TreeItem { + public TreeItem object; + public List args; + + public ConstructTreeItem(AVM2Instruction instruction, TreeItem object, List args) { + super(instruction, PRECEDENCE_PRIMARY); + this.object = object; + this.args = args; + } + + @Override + public String toString(ConstantPool constants) { + String argStr = ""; + for (int a = 0; a < args.size(); a++) { + if (a > 0) { + argStr = argStr + ","; + } + argStr = argStr + args.get(a).toString(constants); + } + if (object instanceof NewFunctionTreeItem) { + return object.toString(constants); + } + return hilight("new ") + object.toString(constants) + hilight("(") + argStr + hilight(")"); + + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ContinueTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ContinueTreeItem.java index c935b3c52..46f4c0255 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ContinueTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ContinueTreeItem.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class ContinueTreeItem extends TreeItem { - public int loopPos; - public boolean isKnown; - - public ContinueTreeItem(AVM2Instruction instruction, int loopPos) { - this(instruction, loopPos, true); - } - - public ContinueTreeItem(AVM2Instruction instruction, int loopPos, boolean isKnown) { - super(instruction, NOPRECEDENCE); - this.loopPos = loopPos; - this.isKnown = isKnown; - } - - @Override - public String toString(ConstantPool constants) { - return hilight("continue") + " " + (isKnown ? "loop" : "unk") + loopPos + ";"; - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class ContinueTreeItem extends TreeItem { + public int loopPos; + public boolean isKnown; + + public ContinueTreeItem(AVM2Instruction instruction, int loopPos) { + this(instruction, loopPos, true); + } + + public ContinueTreeItem(AVM2Instruction instruction, int loopPos, boolean isKnown) { + super(instruction, NOPRECEDENCE); + this.loopPos = loopPos; + this.isKnown = isKnown; + } + + @Override + public String toString(ConstantPool constants) { + return hilight("continue") + " " + (isKnown ? "loop" : "unk") + loopPos + ";"; + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConvertTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConvertTreeItem.java index 345b7e5a7..7d916c069 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConvertTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ConvertTreeItem.java @@ -1,27 +1,41 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class ConvertTreeItem extends TreeItem { - public TreeItem value; - public String type; - - public ConvertTreeItem(AVM2Instruction instruction, TreeItem value, String type) { - super(instruction, NOPRECEDENCE); - this.value = value; - this.type = type; - } - - @Override - public String toString(ConstantPool constants) { - //return hilight("("+type+")")+ - return value.toString(constants); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class ConvertTreeItem extends TreeItem { + public TreeItem value; + public String type; + + public ConvertTreeItem(AVM2Instruction instruction, TreeItem value, String type) { + super(instruction, NOPRECEDENCE); + this.value = value; + this.type = type; + } + + @Override + public String toString(ConstantPool constants) { + //return hilight("("+type+")")+ + return value.toString(constants); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/DecLocalTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/DecLocalTreeItem.java index cf0a35132..c2f7616dc 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/DecLocalTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/DecLocalTreeItem.java @@ -1,26 +1,40 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; - - -public class DecLocalTreeItem extends TreeItem { - public int regIndex; - - public DecLocalTreeItem(AVM2Instruction instruction, int regIndex) { - super(instruction, PRECEDENCE_POSTFIX); - this.regIndex = regIndex; - } - - @Override - public String toString(ConstantPool constants) { - return InstructionDefinition.localRegName(regIndex) + hilight("--") + ";"; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; + + +public class DecLocalTreeItem extends TreeItem { + public int regIndex; + + public DecLocalTreeItem(AVM2Instruction instruction, int regIndex) { + super(instruction, PRECEDENCE_POSTFIX); + this.regIndex = regIndex; + } + + @Override + public String toString(ConstantPool constants) { + return InstructionDefinition.localRegName(regIndex) + hilight("--") + ";"; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/DecrementTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/DecrementTreeItem.java index 64e4c1775..1706399d9 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/DecrementTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/DecrementTreeItem.java @@ -1,25 +1,39 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class DecrementTreeItem extends TreeItem { - public TreeItem object; - - public DecrementTreeItem(AVM2Instruction instruction, TreeItem object) { - super(instruction, PRECEDENCE_ADDITIVE); - this.object = object; - } - - @Override - public String toString(ConstantPool constants) { - return object.toString(constants) + hilight("-1"); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class DecrementTreeItem extends TreeItem { + public TreeItem object; + + public DecrementTreeItem(AVM2Instruction instruction, TreeItem object) { + super(instruction, PRECEDENCE_ADDITIVE); + this.object = object; + } + + @Override + public String toString(ConstantPool constants) { + return object.toString(constants) + hilight("-1"); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/EachTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/EachTreeItem.java index a61125957..a97d6f66c 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/EachTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/EachTreeItem.java @@ -1,27 +1,41 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class EachTreeItem extends TreeItem { - public TreeItem object; - public TreeItem collection; - - public EachTreeItem(AVM2Instruction instruction, TreeItem object, TreeItem collection) { - super(instruction, NOPRECEDENCE); - this.object = object; - this.collection = collection; - } - - @Override - public String toString(ConstantPool constants) { - return hilight("each (") + object.toString(constants) + hilight(" in ") + collection.toString(constants) + ")"; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class EachTreeItem extends TreeItem { + public TreeItem object; + public TreeItem collection; + + public EachTreeItem(AVM2Instruction instruction, TreeItem object, TreeItem collection) { + super(instruction, NOPRECEDENCE); + this.object = object; + this.collection = collection; + } + + @Override + public String toString(ConstantPool constants) { + return hilight("each (") + object.toString(constants) + hilight(" in ") + collection.toString(constants) + ")"; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/FindPropertyTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/FindPropertyTreeItem.java index 6a9716a23..5f9645caf 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/FindPropertyTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/FindPropertyTreeItem.java @@ -1,25 +1,39 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class FindPropertyTreeItem extends TreeItem { - public FullMultinameTreeItem propertyName; - - public FindPropertyTreeItem(AVM2Instruction instruction, FullMultinameTreeItem propertyName) { - super(instruction, PRECEDENCE_PRIMARY); - this.propertyName = propertyName; - } - - @Override - public String toString(ConstantPool constants) { - return ""; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class FindPropertyTreeItem extends TreeItem { + public FullMultinameTreeItem propertyName; + + public FindPropertyTreeItem(AVM2Instruction instruction, FullMultinameTreeItem propertyName) { + super(instruction, PRECEDENCE_PRIMARY); + this.propertyName = propertyName; + } + + @Override + public String toString(ConstantPool constants) { + return ""; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/FloatValueTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/FloatValueTreeItem.java index 9963bbe60..8d267c8ae 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/FloatValueTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/FloatValueTreeItem.java @@ -1,25 +1,39 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class FloatValueTreeItem extends NumberValueTreeItem { - public Double value; - - public FloatValueTreeItem(AVM2Instruction instruction, Double value) { - super(instruction); - this.value = value; - } - - @Override - public String toString(ConstantPool constants) { - return hilight("" + value); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class FloatValueTreeItem extends NumberValueTreeItem { + public Double value; + + public FloatValueTreeItem(AVM2Instruction instruction, Double value) { + super(instruction); + this.value = value; + } + + @Override + public String toString(ConstantPool constants) { + return hilight("" + value); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/FullMultinameTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/FullMultinameTreeItem.java index 3a51bebfe..880efc539 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/FullMultinameTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/FullMultinameTreeItem.java @@ -1,66 +1,80 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.types.Namespace; - - -public class FullMultinameTreeItem extends TreeItem { - public int multinameIndex; - public TreeItem name; - public TreeItem namespace; - - public FullMultinameTreeItem(AVM2Instruction instruction, int multinameIndex, TreeItem name) { - super(instruction, PRECEDENCE_PRIMARY); - this.multinameIndex = multinameIndex; - this.name = name; - this.namespace = null; - } - - public FullMultinameTreeItem(AVM2Instruction instruction, int multinameIndex) { - super(instruction, PRECEDENCE_PRIMARY); - this.multinameIndex = multinameIndex; - this.name = null; - this.namespace = null; - } - - public FullMultinameTreeItem(AVM2Instruction instruction, int multinameIndex, TreeItem name, TreeItem namespace) { - super(instruction, PRECEDENCE_PRIMARY); - this.multinameIndex = multinameIndex; - this.name = name; - this.namespace = namespace; - } - - public boolean isRuntime() { - return (name != null) || (namespace != null); - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - if (name != null) { - ret = name.toString(constants); - } else { - ret = constants.constant_multiname[multinameIndex].getName(constants); - } - if (namespace != null) { - ret = ret + "[" + namespace.toString(constants) + "]"; - } else { - Namespace ns = constants.constant_multiname[multinameIndex].getNamespace(constants); - if (ns != null) { - ret = ret + "[" + ns.getName(constants) + "]"; - } - } - - if ((name == null) && (namespace == null)) { - ret = hilight(constants.constant_multiname[multinameIndex].getName(constants)); - } - return ret; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.types.Namespace; + + +public class FullMultinameTreeItem extends TreeItem { + public int multinameIndex; + public TreeItem name; + public TreeItem namespace; + + public FullMultinameTreeItem(AVM2Instruction instruction, int multinameIndex, TreeItem name) { + super(instruction, PRECEDENCE_PRIMARY); + this.multinameIndex = multinameIndex; + this.name = name; + this.namespace = null; + } + + public FullMultinameTreeItem(AVM2Instruction instruction, int multinameIndex) { + super(instruction, PRECEDENCE_PRIMARY); + this.multinameIndex = multinameIndex; + this.name = null; + this.namespace = null; + } + + public FullMultinameTreeItem(AVM2Instruction instruction, int multinameIndex, TreeItem name, TreeItem namespace) { + super(instruction, PRECEDENCE_PRIMARY); + this.multinameIndex = multinameIndex; + this.name = name; + this.namespace = namespace; + } + + public boolean isRuntime() { + return (name != null) || (namespace != null); + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + if (name != null) { + ret = name.toString(constants); + } else { + ret = constants.constant_multiname[multinameIndex].getName(constants); + } + if (namespace != null) { + ret = ret + "[" + namespace.toString(constants) + "]"; + } else { + Namespace ns = constants.constant_multiname[multinameIndex].getNamespace(constants); + if (ns != null) { + ret = ret + "[" + ns.getName(constants) + "]"; + } + } + + if ((name == null) && (namespace == null)) { + ret = hilight(constants.constant_multiname[multinameIndex].getName(constants)); + } + return ret; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetDescendantsTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetDescendantsTreeItem.java index 1d20a9e27..93daa9490 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetDescendantsTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetDescendantsTreeItem.java @@ -1,27 +1,41 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class GetDescendantsTreeItem extends TreeItem { - public TreeItem object; - public FullMultinameTreeItem multiname; - - public GetDescendantsTreeItem(AVM2Instruction instruction, TreeItem object, FullMultinameTreeItem multiname) { - super(instruction, PRECEDENCE_PRIMARY); - this.object = object; - this.multiname = multiname; - } - - @Override - public String toString(ConstantPool constants) { - return object.toString(constants) + hilight("..") + multiname.toString(constants); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class GetDescendantsTreeItem extends TreeItem { + public TreeItem object; + public FullMultinameTreeItem multiname; + + public GetDescendantsTreeItem(AVM2Instruction instruction, TreeItem object, FullMultinameTreeItem multiname) { + super(instruction, PRECEDENCE_PRIMARY); + this.object = object; + this.multiname = multiname; + } + + @Override + public String toString(ConstantPool constants) { + return object.toString(constants) + hilight("..") + multiname.toString(constants); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetLexTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetLexTreeItem.java index 8af3c9a14..a7ecb3ccd 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetLexTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetLexTreeItem.java @@ -1,26 +1,40 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.types.Multiname; - - -public class GetLexTreeItem extends TreeItem { - public Multiname propertyName; - - public GetLexTreeItem(AVM2Instruction instruction, Multiname propertyName) { - super(instruction, PRECEDENCE_PRIMARY); - this.propertyName = propertyName; - } - - @Override - public String toString(ConstantPool constants) { - return hilight(propertyName.getName(constants)); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.types.Multiname; + + +public class GetLexTreeItem extends TreeItem { + public Multiname propertyName; + + public GetLexTreeItem(AVM2Instruction instruction, Multiname propertyName) { + super(instruction, PRECEDENCE_PRIMARY); + this.propertyName = propertyName; + } + + @Override + public String toString(ConstantPool constants) { + return hilight(propertyName.getName(constants)); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetPropertyTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetPropertyTreeItem.java index b1e67b548..0ae2239f5 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetPropertyTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetPropertyTreeItem.java @@ -1,27 +1,41 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class GetPropertyTreeItem extends TreeItem { - public TreeItem object; - public FullMultinameTreeItem propertyName; - - public GetPropertyTreeItem(AVM2Instruction instruction, TreeItem object, FullMultinameTreeItem propertyName) { - super(instruction, PRECEDENCE_PRIMARY); - this.object = object; - this.propertyName = propertyName; - } - - @Override - public String toString(ConstantPool constants) { - return formatProperty(constants, object, propertyName); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class GetPropertyTreeItem extends TreeItem { + public TreeItem object; + public FullMultinameTreeItem propertyName; + + public GetPropertyTreeItem(AVM2Instruction instruction, TreeItem object, FullMultinameTreeItem propertyName) { + super(instruction, PRECEDENCE_PRIMARY); + this.object = object; + this.propertyName = propertyName; + } + + @Override + public String toString(ConstantPool constants) { + return formatProperty(constants, object, propertyName); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetSlotTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetSlotTreeItem.java index 462dba51f..0967407ee 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetSlotTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetSlotTreeItem.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.types.Multiname; - - -public class GetSlotTreeItem extends TreeItem { - public Multiname slotName; - public TreeItem scope; - - public GetSlotTreeItem(AVM2Instruction instruction, TreeItem scope, Multiname slotName) { - super(instruction, PRECEDENCE_PRIMARY); - this.slotName = slotName; - this.scope = scope; - } - - @Override - public String toString(ConstantPool constants) { - //scope.toString(constants)+"." - return hilight(slotName.getName(constants)); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.types.Multiname; + + +public class GetSlotTreeItem extends TreeItem { + public Multiname slotName; + public TreeItem scope; + + public GetSlotTreeItem(AVM2Instruction instruction, TreeItem scope, Multiname slotName) { + super(instruction, PRECEDENCE_PRIMARY); + this.slotName = slotName; + this.scope = scope; + } + + @Override + public String toString(ConstantPool constants) { + //scope.toString(constants)+"." + return hilight(slotName.getName(constants)); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetSuperTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetSuperTreeItem.java index 03f2563f5..e9af437ce 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetSuperTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/GetSuperTreeItem.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.helpers.Highlighting; - - -public class GetSuperTreeItem extends TreeItem { - public TreeItem object; - public FullMultinameTreeItem propertyName; - - public GetSuperTreeItem(AVM2Instruction instruction, TreeItem object, FullMultinameTreeItem propertyName) { - super(instruction, PRECEDENCE_PRIMARY); - this.object = object; - this.propertyName = propertyName; - } - - @Override - public String toString(ConstantPool constants) { - String calee = object.toString(constants) + "."; - if (Highlighting.stripHilights(calee).equals("this.")) calee = ""; - return calee + hilight("super.") + propertyName.toString(constants); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.helpers.Highlighting; + + +public class GetSuperTreeItem extends TreeItem { + public TreeItem object; + public FullMultinameTreeItem propertyName; + + public GetSuperTreeItem(AVM2Instruction instruction, TreeItem object, FullMultinameTreeItem propertyName) { + super(instruction, PRECEDENCE_PRIMARY); + this.object = object; + this.propertyName = propertyName; + } + + @Override + public String toString(ConstantPool constants) { + String calee = object.toString(constants) + "."; + if (Highlighting.stripHilights(calee).equals("this.")) calee = ""; + return calee + hilight("super.") + propertyName.toString(constants); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/IncLocalTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/IncLocalTreeItem.java index 69eede5a0..cb05be7c3 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/IncLocalTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/IncLocalTreeItem.java @@ -1,26 +1,40 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; - - -public class IncLocalTreeItem extends TreeItem { - public int regIndex; - - public IncLocalTreeItem(AVM2Instruction instruction, int regIndex) { - super(instruction, PRECEDENCE_POSTFIX); - this.regIndex = regIndex; - } - - @Override - public String toString(ConstantPool constants) { - return InstructionDefinition.localRegName(regIndex) + hilight("++") + ";"; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; + + +public class IncLocalTreeItem extends TreeItem { + public int regIndex; + + public IncLocalTreeItem(AVM2Instruction instruction, int regIndex) { + super(instruction, PRECEDENCE_POSTFIX); + this.regIndex = regIndex; + } + + @Override + public String toString(ConstantPool constants) { + return InstructionDefinition.localRegName(regIndex) + hilight("++") + ";"; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/IncrementTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/IncrementTreeItem.java index 5e7bece75..3f554dfe6 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/IncrementTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/IncrementTreeItem.java @@ -1,25 +1,39 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class IncrementTreeItem extends TreeItem { - public TreeItem object; - - public IncrementTreeItem(AVM2Instruction instruction, TreeItem object) { - super(instruction, PRECEDENCE_ADDITIVE); - this.object = object; - } - - @Override - public String toString(ConstantPool constants) { - return object.toString(constants) + hilight("+1"); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class IncrementTreeItem extends TreeItem { + public TreeItem object; + + public IncrementTreeItem(AVM2Instruction instruction, TreeItem object) { + super(instruction, PRECEDENCE_ADDITIVE); + this.object = object; + } + + @Override + public String toString(ConstantPool constants) { + return object.toString(constants) + hilight("+1"); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/InitPropertyTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/InitPropertyTreeItem.java index 5b279fa3f..268dd6a24 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/InitPropertyTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/InitPropertyTreeItem.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class InitPropertyTreeItem extends TreeItem { - public TreeItem object; - public FullMultinameTreeItem propertyName; - public TreeItem value; - - public InitPropertyTreeItem(AVM2Instruction instruction, TreeItem object, FullMultinameTreeItem propertyName, TreeItem value) { - super(instruction, PRECEDENCE_ASSIGMENT); - this.object = object; - this.propertyName = propertyName; - this.value = value; - } - - @Override - public String toString(ConstantPool constants) { - return formatProperty(constants, object, propertyName) + hilight("=") + value.toString(constants) + ";"; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class InitPropertyTreeItem extends TreeItem { + public TreeItem object; + public FullMultinameTreeItem propertyName; + public TreeItem value; + + public InitPropertyTreeItem(AVM2Instruction instruction, TreeItem object, FullMultinameTreeItem propertyName, TreeItem value) { + super(instruction, PRECEDENCE_ASSIGMENT); + this.object = object; + this.propertyName = propertyName; + this.value = value; + } + + @Override + public String toString(ConstantPool constants) { + return formatProperty(constants, object, propertyName) + hilight("=") + value.toString(constants) + ";"; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/IntegerValueTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/IntegerValueTreeItem.java index d8802f4b3..20ca5eb7b 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/IntegerValueTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/IntegerValueTreeItem.java @@ -1,25 +1,39 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class IntegerValueTreeItem extends NumberValueTreeItem { - public Long value; - - public IntegerValueTreeItem(AVM2Instruction instruction, Long value) { - super(instruction); - this.value = value; - } - - @Override - public String toString(ConstantPool constants) { - return hilight("" + value); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class IntegerValueTreeItem extends NumberValueTreeItem { + public Long value; + + public IntegerValueTreeItem(AVM2Instruction instruction, Long value) { + super(instruction); + this.value = value; + } + + @Override + public String toString(ConstantPool constants) { + return hilight("" + value); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/LocalRegTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/LocalRegTreeItem.java index 4ef9e67d7..d65f5b299 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/LocalRegTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/LocalRegTreeItem.java @@ -1,41 +1,55 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; - - -public class LocalRegTreeItem extends TreeItem { - public int regIndex; - public TreeItem computedValue; - - public LocalRegTreeItem(AVM2Instruction instruction, int regIndex, TreeItem computedValue) { - super(instruction, PRECEDENCE_PRIMARY); - this.regIndex = regIndex; - if (computedValue == null) { - computedValue = new UndefinedTreeItem(instruction); - } - this.computedValue = computedValue; - } - - @Override - public String toString(ConstantPool constants) { - return hilight(InstructionDefinition.localRegName(regIndex)); - } - - @Override - public boolean isFalse() { - return computedValue.isFalse(); - } - - @Override - public boolean isTrue() { - return computedValue.isTrue(); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; + + +public class LocalRegTreeItem extends TreeItem { + public int regIndex; + public TreeItem computedValue; + + public LocalRegTreeItem(AVM2Instruction instruction, int regIndex, TreeItem computedValue) { + super(instruction, PRECEDENCE_PRIMARY); + this.regIndex = regIndex; + if (computedValue == null) { + computedValue = new UndefinedTreeItem(instruction); + } + this.computedValue = computedValue; + } + + @Override + public String toString(ConstantPool constants) { + return hilight(InstructionDefinition.localRegName(regIndex)); + } + + @Override + public boolean isFalse() { + return computedValue.isFalse(); + } + + @Override + public boolean isTrue() { + return computedValue.isTrue(); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NameSpaceTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NameSpaceTreeItem.java index 09f4054b3..099ab9251 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NameSpaceTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NameSpaceTreeItem.java @@ -1,23 +1,37 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class NameSpaceTreeItem extends TreeItem { - public int namespaceIndex; - - public NameSpaceTreeItem(AVM2Instruction instruction, int namespaceIndex) { - super(instruction, NOPRECEDENCE); - this.namespaceIndex = namespaceIndex; - } - - public String toString(ConstantPool constants) { - if (namespaceIndex == 0) return "*"; - return hilight(constants.constant_namespace[namespaceIndex].toString(constants)); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class NameSpaceTreeItem extends TreeItem { + public int namespaceIndex; + + public NameSpaceTreeItem(AVM2Instruction instruction, int namespaceIndex) { + super(instruction, NOPRECEDENCE); + this.namespaceIndex = namespaceIndex; + } + + public String toString(ConstantPool constants) { + if (namespaceIndex == 0) return "*"; + return hilight(constants.constant_namespace[namespaceIndex].toString(constants)); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NameValuePair.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NameValuePair.java index a93afcf0a..1d8600d1e 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NameValuePair.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NameValuePair.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; - - -public class NameValuePair extends TreeItem { - public TreeItem name; - public TreeItem value; - - public NameValuePair(TreeItem name, TreeItem value) { - super(name.instruction, NOPRECEDENCE); - this.name = name; - this.value = value; - } - - @Override - public String toString(ConstantPool constants) { - if (name instanceof StringTreeItem) { - return ((StringTreeItem) name).value + ":" + value.toString(constants); - } - return name.toString(constants) + ":" + value.toString(constants); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; + + +public class NameValuePair extends TreeItem { + public TreeItem name; + public TreeItem value; + + public NameValuePair(TreeItem name, TreeItem value) { + super(name.instruction, NOPRECEDENCE); + this.name = name; + this.value = value; + } + + @Override + public String toString(ConstantPool constants) { + if (name instanceof StringTreeItem) { + return ((StringTreeItem) name).value + ":" + value.toString(constants); + } + return name.toString(constants) + ":" + value.toString(constants); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NanTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NanTreeItem.java index fc5d2d63f..207da9ba3 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NanTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NanTreeItem.java @@ -1,23 +1,37 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class NanTreeItem extends TreeItem { - - public NanTreeItem(AVM2Instruction instruction) { - super(instruction, NOPRECEDENCE); - } - - - @Override - public String toString(ConstantPool constants) { - return hilight("NaN"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class NanTreeItem extends TreeItem { + + public NanTreeItem(AVM2Instruction instruction) { + super(instruction, NOPRECEDENCE); + } + + + @Override + public String toString(ConstantPool constants) { + return hilight("NaN"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewActivationTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewActivationTreeItem.java index 352635aaa..3f92031e3 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewActivationTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewActivationTreeItem.java @@ -1,23 +1,37 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class NewActivationTreeItem extends TreeItem { - - public NewActivationTreeItem(AVM2Instruction instruction) { - super(instruction, NOPRECEDENCE); - } - - - @Override - public String toString(ConstantPool constants) { - return hilight("newactivation()"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class NewActivationTreeItem extends TreeItem { + + public NewActivationTreeItem(AVM2Instruction instruction) { + super(instruction, NOPRECEDENCE); + } + + + @Override + public String toString(ConstantPool constants) { + return hilight("newactivation()"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewArrayTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewArrayTreeItem.java index 17809560f..486aac773 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewArrayTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewArrayTreeItem.java @@ -1,34 +1,48 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - -import java.util.List; - - -public class NewArrayTreeItem extends TreeItem { - public List values; - - public NewArrayTreeItem(AVM2Instruction instruction, List values) { - super(instruction, PRECEDENCE_PRIMARY); - this.values = values; - } - - @Override - public String toString(ConstantPool constants) { - String args = ""; - for (int a = 0; a < values.size(); a++) { - if (a > 0) { - args = args + ","; - } - args = args + values.get(a).toString(constants); - } - return hilight("[") + args + hilight("]"); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + +import java.util.List; + + +public class NewArrayTreeItem extends TreeItem { + public List values; + + public NewArrayTreeItem(AVM2Instruction instruction, List values) { + super(instruction, PRECEDENCE_PRIMARY); + this.values = values; + } + + @Override + public String toString(ConstantPool constants) { + String args = ""; + for (int a = 0; a < values.size(); a++) { + if (a > 0) { + args = args + ","; + } + args = args + values.get(a).toString(constants); + } + return hilight("[") + args + hilight("]"); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewFunctionTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewFunctionTreeItem.java index d5b47d231..8ffd739a6 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewFunctionTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewFunctionTreeItem.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class NewFunctionTreeItem extends TreeItem { - public String paramStr; - public String returnStr; - public String functionBody; - - public NewFunctionTreeItem(AVM2Instruction instruction, String paramStr, String returnStr, String functionBody) { - super(instruction, PRECEDENCE_PRIMARY); - this.paramStr = paramStr; - this.returnStr = returnStr; - this.functionBody = functionBody; - } - - @Override - public String toString(ConstantPool constants) { - return hilight("new function(" + paramStr + "):" + returnStr + "\r\n{\r\n" + functionBody + "}\r\n"); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class NewFunctionTreeItem extends TreeItem { + public String paramStr; + public String returnStr; + public String functionBody; + + public NewFunctionTreeItem(AVM2Instruction instruction, String paramStr, String returnStr, String functionBody) { + super(instruction, PRECEDENCE_PRIMARY); + this.paramStr = paramStr; + this.returnStr = returnStr; + this.functionBody = functionBody; + } + + @Override + public String toString(ConstantPool constants) { + return hilight("new function(" + paramStr + "):" + returnStr + "\r\n{\r\n" + functionBody + "}\r\n"); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewObjectTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewObjectTreeItem.java index e873df97c..5abfe556b 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewObjectTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NewObjectTreeItem.java @@ -1,32 +1,46 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - -import java.util.List; - - -public class NewObjectTreeItem extends TreeItem { - public List pairs; - - public NewObjectTreeItem(AVM2Instruction instruction, List pairs) { - super(instruction, PRECEDENCE_PRIMARY); - this.pairs = pairs; - } - - @Override - public String toString(ConstantPool constants) { - String params = ""; - for (int n = 0; n < pairs.size(); n++) { - if (n > 0) params += ",\r\n"; - params += pairs.get(n).toString(constants); - } - return hilight("{") + params + hilight("}"); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + +import java.util.List; + + +public class NewObjectTreeItem extends TreeItem { + public List pairs; + + public NewObjectTreeItem(AVM2Instruction instruction, List pairs) { + super(instruction, PRECEDENCE_PRIMARY); + this.pairs = pairs; + } + + @Override + public String toString(ConstantPool constants) { + String params = ""; + for (int n = 0; n < pairs.size(); n++) { + if (n > 0) params += ",\r\n"; + params += pairs.get(n).toString(constants); + } + return hilight("{") + params + hilight("}"); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NullTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NullTreeItem.java index 916043644..12b125d7d 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NullTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NullTreeItem.java @@ -1,23 +1,37 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class NullTreeItem extends TreeItem { - - public NullTreeItem(AVM2Instruction instruction) { - super(instruction, PRECEDENCE_PRIMARY); - } - - - @Override - public String toString(ConstantPool constants) { - return hilight("null"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class NullTreeItem extends TreeItem { + + public NullTreeItem(AVM2Instruction instruction) { + super(instruction, PRECEDENCE_PRIMARY); + } + + + @Override + public String toString(ConstantPool constants) { + return hilight("null"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NumberValueTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NumberValueTreeItem.java index efa648220..a68798f9b 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NumberValueTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/NumberValueTreeItem.java @@ -1,16 +1,30 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public abstract class NumberValueTreeItem extends TreeItem { - - public NumberValueTreeItem(AVM2Instruction instruction) { - super(instruction, PRECEDENCE_PRIMARY); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public abstract class NumberValueTreeItem extends TreeItem { + + public NumberValueTreeItem(AVM2Instruction instruction) { + super(instruction, PRECEDENCE_PRIMARY); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/PostDecrementTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/PostDecrementTreeItem.java index ecdb52449..3f336daab 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/PostDecrementTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/PostDecrementTreeItem.java @@ -1,25 +1,39 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class PostDecrementTreeItem extends TreeItem { - public TreeItem object; - - public PostDecrementTreeItem(AVM2Instruction instruction, TreeItem object) { - super(instruction, PRECEDENCE_POSTFIX); - this.object = object; - } - - @Override - public String toString(ConstantPool constants) { - return object.toString(constants) + hilight("--"); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class PostDecrementTreeItem extends TreeItem { + public TreeItem object; + + public PostDecrementTreeItem(AVM2Instruction instruction, TreeItem object) { + super(instruction, PRECEDENCE_POSTFIX); + this.object = object; + } + + @Override + public String toString(ConstantPool constants) { + return object.toString(constants) + hilight("--"); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/PostIncrementTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/PostIncrementTreeItem.java index 18f5bd2cd..941451ad7 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/PostIncrementTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/PostIncrementTreeItem.java @@ -1,25 +1,39 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class PostIncrementTreeItem extends TreeItem { - public TreeItem object; - - public PostIncrementTreeItem(AVM2Instruction instruction, TreeItem object) { - super(instruction, PRECEDENCE_POSTFIX); - this.object = object; - } - - @Override - public String toString(ConstantPool constants) { - return object.toString(constants) + hilight("++"); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class PostIncrementTreeItem extends TreeItem { + public TreeItem object; + + public PostIncrementTreeItem(AVM2Instruction instruction, TreeItem object) { + super(instruction, PRECEDENCE_POSTFIX); + this.object = object; + } + + @Override + public String toString(ConstantPool constants) { + return object.toString(constants) + hilight("++"); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ReturnValueTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ReturnValueTreeItem.java index 10309d9be..c36683ab2 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ReturnValueTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ReturnValueTreeItem.java @@ -1,25 +1,39 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class ReturnValueTreeItem extends TreeItem { - public TreeItem value; - - public ReturnValueTreeItem(AVM2Instruction instruction, TreeItem value) { - super(instruction, NOPRECEDENCE); - this.value = value; - } - - @Override - public String toString(ConstantPool constants) { - return hilight("return ") + value.toString(constants) + ";"; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class ReturnValueTreeItem extends TreeItem { + public TreeItem value; + + public ReturnValueTreeItem(AVM2Instruction instruction, TreeItem value) { + super(instruction, NOPRECEDENCE); + this.value = value; + } + + @Override + public String toString(ConstantPool constants) { + return hilight("return ") + value.toString(constants) + ";"; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ReturnVoidTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ReturnVoidTreeItem.java index 0f23c50dd..45f0397e9 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ReturnVoidTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ReturnVoidTreeItem.java @@ -1,23 +1,37 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class ReturnVoidTreeItem extends TreeItem { - - public ReturnVoidTreeItem(AVM2Instruction instruction) { - super(instruction, NOPRECEDENCE); - } - - @Override - public String toString(ConstantPool constants) { - return hilight("return") + ";"; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class ReturnVoidTreeItem extends TreeItem { + + public ReturnVoidTreeItem(AVM2Instruction instruction) { + super(instruction, NOPRECEDENCE); + } + + @Override + public String toString(ConstantPool constants) { + return hilight("return") + ";"; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetGlobalSlotTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetGlobalSlotTreeItem.java index eb057883a..078a00877 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetGlobalSlotTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetGlobalSlotTreeItem.java @@ -1,27 +1,41 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class SetGlobalSlotTreeItem extends TreeItem { - public int slotId; - public TreeItem value; - - public SetGlobalSlotTreeItem(AVM2Instruction instruction, int slotId, TreeItem value) { - super(instruction, PRECEDENCE_ASSIGMENT); - this.slotId = slotId; - this.value = value; - } - - @Override - public String toString(ConstantPool constants) { - return hilight("setglobalslot(" + slotId + ",") + value.toString(constants) + hilight(")") + ";"; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class SetGlobalSlotTreeItem extends TreeItem { + public int slotId; + public TreeItem value; + + public SetGlobalSlotTreeItem(AVM2Instruction instruction, int slotId, TreeItem value) { + super(instruction, PRECEDENCE_ASSIGMENT); + this.slotId = slotId; + this.value = value; + } + + @Override + public String toString(ConstantPool constants) { + return hilight("setglobalslot(" + slotId + ",") + value.toString(constants) + hilight(")") + ";"; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetLocalTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetLocalTreeItem.java index 2575b289a..34e9975b3 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetLocalTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetLocalTreeItem.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; - - -public class SetLocalTreeItem extends TreeItem { - public int regIndex; - public TreeItem value; - - public SetLocalTreeItem(AVM2Instruction instruction, int regIndex, TreeItem value) { - super(instruction, PRECEDENCE_ASSIGMENT); - this.regIndex = regIndex; - this.value = value; - } - - @Override - public String toString(ConstantPool constants) { - return hilight(InstructionDefinition.localRegName(regIndex) + "=") + value.toString(constants) + ";"; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; + + +public class SetLocalTreeItem extends TreeItem { + public int regIndex; + public TreeItem value; + + public SetLocalTreeItem(AVM2Instruction instruction, int regIndex, TreeItem value) { + super(instruction, PRECEDENCE_ASSIGMENT); + this.regIndex = regIndex; + this.value = value; + } + + @Override + public String toString(ConstantPool constants) { + return hilight(InstructionDefinition.localRegName(regIndex) + "=") + value.toString(constants) + ";"; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetPropertyTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetPropertyTreeItem.java index 065bd195b..d181b1fb6 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetPropertyTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetPropertyTreeItem.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class SetPropertyTreeItem extends TreeItem { - public TreeItem object; - public FullMultinameTreeItem propertyName; - public TreeItem value; - - public SetPropertyTreeItem(AVM2Instruction instruction, TreeItem object, FullMultinameTreeItem propertyName, TreeItem value) { - super(instruction, PRECEDENCE_ASSIGMENT); - this.object = object; - this.propertyName = propertyName; - this.value = value; - } - - @Override - public String toString(ConstantPool constants) { - return formatProperty(constants, object, propertyName) + hilight("=") + value.toString(constants) + ";"; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class SetPropertyTreeItem extends TreeItem { + public TreeItem object; + public FullMultinameTreeItem propertyName; + public TreeItem value; + + public SetPropertyTreeItem(AVM2Instruction instruction, TreeItem object, FullMultinameTreeItem propertyName, TreeItem value) { + super(instruction, PRECEDENCE_ASSIGMENT); + this.object = object; + this.propertyName = propertyName; + this.value = value; + } + + @Override + public String toString(ConstantPool constants) { + return formatProperty(constants, object, propertyName) + hilight("=") + value.toString(constants) + ";"; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetSlotTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetSlotTreeItem.java index 400989d99..53466a8a7 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetSlotTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetSlotTreeItem.java @@ -1,41 +1,55 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.types.Multiname; - - -public class SetSlotTreeItem extends TreeItem { - public Multiname slotName; - public TreeItem value; - public TreeItem scope; - - public SetSlotTreeItem(AVM2Instruction instruction, TreeItem scope, Multiname slotName, TreeItem value) { - super(instruction, PRECEDENCE_ASSIGMENT); - this.slotName = slotName; - this.value = value; - this.scope = scope; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - - if (!(scope instanceof NewActivationTreeItem)) { - ret = scope.toString(constants) + "."; - } - if(scope instanceof LocalRegTreeItem){ - if(((LocalRegTreeItem)scope).computedValue !=null){ - if(((LocalRegTreeItem)scope).computedValue instanceof NewActivationTreeItem){ - ret=""; - } - } - } - return ret + hilight(slotName.getName(constants)) + hilight("=") + value.toString(constants) + ";"; - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.types.Multiname; + + +public class SetSlotTreeItem extends TreeItem { + public Multiname slotName; + public TreeItem value; + public TreeItem scope; + + public SetSlotTreeItem(AVM2Instruction instruction, TreeItem scope, Multiname slotName, TreeItem value) { + super(instruction, PRECEDENCE_ASSIGMENT); + this.slotName = slotName; + this.value = value; + this.scope = scope; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + + if (!(scope instanceof NewActivationTreeItem)) { + ret = scope.toString(constants) + "."; + } + if(scope instanceof LocalRegTreeItem){ + if(((LocalRegTreeItem)scope).computedValue !=null){ + if(((LocalRegTreeItem)scope).computedValue instanceof NewActivationTreeItem){ + ret=""; + } + } + } + return ret + hilight(slotName.getName(constants)) + hilight("=") + value.toString(constants) + ";"; + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetSuperTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetSuperTreeItem.java index fb986b7ed..67e042d8f 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetSuperTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/SetSuperTreeItem.java @@ -1,32 +1,46 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.helpers.Highlighting; - - -public class SetSuperTreeItem extends TreeItem { - public TreeItem value; - public TreeItem object; - public FullMultinameTreeItem propertyName; - - public SetSuperTreeItem(AVM2Instruction instruction, TreeItem value, TreeItem object, FullMultinameTreeItem propertyName) { - super(instruction, PRECEDENCE_ASSIGMENT); - this.value = value; - this.object = object; - this.propertyName = propertyName; - } - - - @Override - public String toString(ConstantPool constants) { - String calee = object.toString(constants) + "."; - if (Highlighting.stripHilights(calee).equals("this.")) calee = ""; - return calee + hilight("super.") + propertyName.toString(constants) + hilight("=") + value.toString(constants) + ";"; - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.helpers.Highlighting; + + +public class SetSuperTreeItem extends TreeItem { + public TreeItem value; + public TreeItem object; + public FullMultinameTreeItem propertyName; + + public SetSuperTreeItem(AVM2Instruction instruction, TreeItem value, TreeItem object, FullMultinameTreeItem propertyName) { + super(instruction, PRECEDENCE_ASSIGMENT); + this.value = value; + this.object = object; + this.propertyName = propertyName; + } + + + @Override + public String toString(ConstantPool constants) { + String calee = object.toString(constants) + "."; + if (Highlighting.stripHilights(calee).equals("this.")) calee = ""; + return calee + hilight("super.") + propertyName.toString(constants) + hilight("=") + value.toString(constants) + ";"; + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/StringTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/StringTreeItem.java index cc57b8711..38907e5bd 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/StringTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/StringTreeItem.java @@ -1,26 +1,40 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.helpers.Helper; - - -public class StringTreeItem extends TreeItem { - public String value; - - public StringTreeItem(AVM2Instruction instruction, String value) { - super(instruction, PRECEDENCE_PRIMARY); - this.value = value; - } - - @Override - public String toString(ConstantPool constants) { - return hilight("\"" + Helper.escapeString(value) + "\""); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.helpers.Helper; + + +public class StringTreeItem extends TreeItem { + public String value; + + public StringTreeItem(AVM2Instruction instruction, String value) { + super(instruction, PRECEDENCE_PRIMARY); + this.value = value; + } + + @Override + public String toString(ConstantPool constants) { + return hilight("\"" + Helper.escapeString(value) + "\""); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ThisTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ThisTreeItem.java index fb45f5605..4c510444e 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ThisTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ThisTreeItem.java @@ -1,22 +1,36 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; - - -public class ThisTreeItem extends TreeItem { - - public ThisTreeItem() { - super(null, PRECEDENCE_PRIMARY); - } - - @Override - public String toString(ConstantPool constants) { - return "this"; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; + + +public class ThisTreeItem extends TreeItem { + + public ThisTreeItem() { + super(null, PRECEDENCE_PRIMARY); + } + + @Override + public String toString(ConstantPool constants) { + return "this"; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ThrowTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ThrowTreeItem.java index 91427ffd4..1ce512c3d 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ThrowTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/ThrowTreeItem.java @@ -1,25 +1,39 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class ThrowTreeItem extends TreeItem { - public TreeItem value; - - public ThrowTreeItem(AVM2Instruction instruction, TreeItem value) { - super(instruction, NOPRECEDENCE); - this.value = value; - } - - - @Override - public String toString(ConstantPool constants) { - return hilight("throw ") + value.toString(constants); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class ThrowTreeItem extends TreeItem { + public TreeItem value; + + public ThrowTreeItem(AVM2Instruction instruction, TreeItem value) { + super(instruction, NOPRECEDENCE); + this.value = value; + } + + + @Override + public String toString(ConstantPool constants) { + return hilight("throw ") + value.toString(constants); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/TreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/TreeItem.java index 136b07c13..d59ce1b53 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/TreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/TreeItem.java @@ -1,80 +1,94 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.helpers.Highlighting; - - -public abstract class TreeItem { - - public static final int PRECEDENCE_PRIMARY = 0; - public static final int PRECEDENCE_POSTFIX = 1; - public static final int PRECEDENCE_UNARY = 2; - public static final int PRECEDENCE_MULTIPLICATIVE = 3; - public static final int PRECEDENCE_ADDITIVE = 4; - public static final int PRECEDENCE_BITWISESHIFT = 5; - public static final int PRECEDENCE_RELATIONAL = 6; - public static final int PRECEDENCE_EQUALITY = 7; - public static final int PRECEDENCE_BITWISEAND = 8; - public static final int PRECEDENCE_BITWISEXOR = 9; - public static final int PRECEDENCE_BITWISEOR = 10; - public static final int PRECEDENCE_LOGICALAND = 11; - public static final int PRECEDENCE_LOGICALOR = 12; - public static final int PRECEDENCE_CONDITIONAL = 13; - public static final int PRECEDENCE_ASSIGMENT = 14; - public static final int PRECEDENCE_COMMA = 15; - public static final int NOPRECEDENCE = 16; - - - public int precedence = NOPRECEDENCE; - public AVM2Instruction instruction; - - public TreeItem(AVM2Instruction instruction, int precedence) { - this.instruction = instruction; - this.precedence = precedence; - } - - - public abstract String toString(ConstantPool constants); - - - protected String hilight(String str) { - if (instruction == null) - return str; - return Highlighting.hilighOffset(str, instruction.offset); - } - - public boolean isFalse() { - return false; - } - - public boolean isTrue() { - return false; - } - - protected String formatProperty(ConstantPool constants, TreeItem object, TreeItem propertyName) { - String obStr = object.toString(constants); - if (object.precedence > PRECEDENCE_PRIMARY) { - obStr = "(" + obStr + ")"; - } - if (object instanceof LocalRegTreeItem) { - if (((LocalRegTreeItem) object).computedValue instanceof FindPropertyTreeItem) - obStr = ""; - } - if (propertyName instanceof FullMultinameTreeItem) { - - if (((FullMultinameTreeItem) propertyName).isRuntime()) { - return obStr + "[" + propertyName.toString(constants) + "]"; - } else { - if (!obStr.equals("")) obStr += "."; - return obStr + ((FullMultinameTreeItem) propertyName).toString(constants); - } - } else { - return obStr + "[" + propertyName.toString(constants) + "]"; - } - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.helpers.Highlighting; + + +public abstract class TreeItem { + + public static final int PRECEDENCE_PRIMARY = 0; + public static final int PRECEDENCE_POSTFIX = 1; + public static final int PRECEDENCE_UNARY = 2; + public static final int PRECEDENCE_MULTIPLICATIVE = 3; + public static final int PRECEDENCE_ADDITIVE = 4; + public static final int PRECEDENCE_BITWISESHIFT = 5; + public static final int PRECEDENCE_RELATIONAL = 6; + public static final int PRECEDENCE_EQUALITY = 7; + public static final int PRECEDENCE_BITWISEAND = 8; + public static final int PRECEDENCE_BITWISEXOR = 9; + public static final int PRECEDENCE_BITWISEOR = 10; + public static final int PRECEDENCE_LOGICALAND = 11; + public static final int PRECEDENCE_LOGICALOR = 12; + public static final int PRECEDENCE_CONDITIONAL = 13; + public static final int PRECEDENCE_ASSIGMENT = 14; + public static final int PRECEDENCE_COMMA = 15; + public static final int NOPRECEDENCE = 16; + + + public int precedence = NOPRECEDENCE; + public AVM2Instruction instruction; + + public TreeItem(AVM2Instruction instruction, int precedence) { + this.instruction = instruction; + this.precedence = precedence; + } + + + public abstract String toString(ConstantPool constants); + + + protected String hilight(String str) { + if (instruction == null) + return str; + return Highlighting.hilighOffset(str, instruction.offset); + } + + public boolean isFalse() { + return false; + } + + public boolean isTrue() { + return false; + } + + protected String formatProperty(ConstantPool constants, TreeItem object, TreeItem propertyName) { + String obStr = object.toString(constants); + if (object.precedence > PRECEDENCE_PRIMARY) { + obStr = "(" + obStr + ")"; + } + if (object instanceof LocalRegTreeItem) { + if (((LocalRegTreeItem) object).computedValue instanceof FindPropertyTreeItem) + obStr = ""; + } + if (propertyName instanceof FullMultinameTreeItem) { + + if (((FullMultinameTreeItem) propertyName).isRuntime()) { + return obStr + "[" + propertyName.toString(constants) + "]"; + } else { + if (!obStr.equals("")) obStr += "."; + return obStr + ((FullMultinameTreeItem) propertyName).toString(constants); + } + } else { + return obStr + "[" + propertyName.toString(constants) + "]"; + } + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/UndefinedTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/UndefinedTreeItem.java index 80bb57b76..1ee71ebd7 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/UndefinedTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/UndefinedTreeItem.java @@ -1,24 +1,38 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class UndefinedTreeItem extends TreeItem { - - public UndefinedTreeItem(AVM2Instruction instruction) { - super(instruction, PRECEDENCE_PRIMARY); - } - - - @Override - public String toString(ConstantPool constants) { - return hilight("undefined"); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class UndefinedTreeItem extends TreeItem { + + public UndefinedTreeItem(AVM2Instruction instruction) { + super(instruction, PRECEDENCE_PRIMARY); + } + + + @Override + public String toString(ConstantPool constants) { + return hilight("undefined"); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/UnparsedTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/UnparsedTreeItem.java index 174228b06..5afb8df08 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/UnparsedTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/UnparsedTreeItem.java @@ -1,25 +1,39 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - - -public class UnparsedTreeItem extends TreeItem { - public String value; - - public UnparsedTreeItem(AVM2Instruction instruction, String value) { - super(instruction, NOPRECEDENCE); - this.value = value; - } - - @Override - public String toString(ConstantPool constants) { - return hilight(value); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + + +public class UnparsedTreeItem extends TreeItem { + public String value; + + public UnparsedTreeItem(AVM2Instruction instruction, String value) { + super(instruction, NOPRECEDENCE); + this.value = value; + } + + @Override + public String toString(ConstantPool constants) { + return hilight(value); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/WithTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/WithTreeItem.java index a16eb42f1..73a97b859 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/WithTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/WithTreeItem.java @@ -1,42 +1,56 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; - -import java.util.ArrayList; -import java.util.List; - - -public class WithTreeItem extends TreeItem { - public TreeItem scope; - public List items; - - public WithTreeItem(AVM2Instruction instruction, TreeItem scope, List items) { - super(instruction, NOPRECEDENCE); - this.scope = scope; - this.items = items; - } - - public WithTreeItem(AVM2Instruction instruction, TreeItem scope) { - super(instruction, NOPRECEDENCE); - this.scope = scope; - this.items = new ArrayList(); - } - - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret = hilight("with(") + scope.toString(constants) + hilight(")\r\n{\r\n"); - for (TreeItem ti : items) { - ret += ti.toString(constants) + "\r\n"; - } - ret += hilight("}"); - return ret; - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; + +import java.util.ArrayList; +import java.util.List; + + +public class WithTreeItem extends TreeItem { + public TreeItem scope; + public List items; + + public WithTreeItem(AVM2Instruction instruction, TreeItem scope, List items) { + super(instruction, NOPRECEDENCE); + this.scope = scope; + this.items = items; + } + + public WithTreeItem(AVM2Instruction instruction, TreeItem scope) { + super(instruction, NOPRECEDENCE); + this.scope = scope; + this.items = new ArrayList(); + } + + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret = hilight("with(") + scope.toString(constants) + hilight(")\r\n{\r\n"); + for (TreeItem ti : items) { + ret += ti.toString(constants) + "\r\n"; + } + ret += hilight("}"); + return ret; + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/Block.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/Block.java index 5c67b5bc1..9f7bdb84e 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/Block.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/Block.java @@ -1,14 +1,28 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.clauses; - -import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; - -import java.util.List; - - -public interface Block { - public List getContinues(); -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.clauses; + +import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; + +import java.util.List; + + +public interface Block { + public List getContinues(); +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/DoWhileTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/DoWhileTreeItem.java index f4ce6a810..0d34a11ec 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/DoWhileTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/DoWhileTreeItem.java @@ -1,53 +1,67 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.clauses; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - -import java.util.ArrayList; -import java.util.List; - - -public class DoWhileTreeItem extends LoopTreeItem implements Block { - - public List commands; - public TreeItem expression; - - public DoWhileTreeItem(AVM2Instruction instruction, int loopBreak, int loopContinue, List commands, TreeItem expression) { - super(instruction, loopBreak, loopContinue); - this.expression = expression; - this.commands = commands; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; - ret += hilight("do\r\n{") + "\r\n"; - for (TreeItem ti : commands) { - ret += ti.toString(constants) + "\r\n"; - } - ret += hilight("}\r\nwhile(") + expression.toString(constants) + 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; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.clauses; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + +import java.util.ArrayList; +import java.util.List; + + +public class DoWhileTreeItem extends LoopTreeItem implements Block { + + public List commands; + public TreeItem expression; + + public DoWhileTreeItem(AVM2Instruction instruction, int loopBreak, int loopContinue, List commands, TreeItem expression) { + super(instruction, loopBreak, loopContinue); + this.expression = expression; + this.commands = commands; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret += "loop" + loopBreak + ":\r\n"; + ret += hilight("do\r\n{") + "\r\n"; + for (TreeItem ti : commands) { + ret += ti.toString(constants) + "\r\n"; + } + ret += hilight("}\r\nwhile(") + expression.toString(constants) + 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; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/ExceptionTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/ExceptionTreeItem.java index 61fa11b1c..79dad65be 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/ExceptionTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/ExceptionTreeItem.java @@ -1,26 +1,40 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.clauses; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.ABCException; - - -public class ExceptionTreeItem extends TreeItem { - public ABCException exception; - - public ExceptionTreeItem(ABCException exception) { - super(null, NOPRECEDENCE); - this.exception = exception; - } - - @Override - public String toString(ConstantPool constants) { - return exception.getVarName(constants); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.clauses; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.ABCException; + + +public class ExceptionTreeItem extends TreeItem { + public ABCException exception; + + public ExceptionTreeItem(ABCException exception) { + super(null, NOPRECEDENCE); + this.exception = exception; + } + + @Override + public String toString(ConstantPool constants) { + return exception.getVarName(constants); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/ForEachTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/ForEachTreeItem.java index f10c9faf1..21353d855 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/ForEachTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/ForEachTreeItem.java @@ -1,53 +1,67 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.clauses; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.EachTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - -import java.util.ArrayList; -import java.util.List; - - -public class ForEachTreeItem extends LoopTreeItem implements Block { - - public EachTreeItem expression; - public List commands; - - public ForEachTreeItem(AVM2Instruction instruction, int loopBreak, int loopContinue, EachTreeItem expression, List commands) { - super(instruction, loopBreak, loopContinue); - this.expression = expression; - this.commands = commands; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; - ret += hilight("for ") + expression.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; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.clauses; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.EachTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + +import java.util.ArrayList; +import java.util.List; + + +public class ForEachTreeItem extends LoopTreeItem implements Block { + + public EachTreeItem expression; + public List commands; + + public ForEachTreeItem(AVM2Instruction instruction, int loopBreak, int loopContinue, EachTreeItem expression, List commands) { + super(instruction, loopBreak, loopContinue); + this.expression = expression; + this.commands = commands; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret += "loop" + loopBreak + ":\r\n"; + ret += hilight("for ") + expression.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; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/ForTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/ForTreeItem.java index 56a37ef52..d9e0ca017 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/ForTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/ForTreeItem.java @@ -1,79 +1,93 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.clauses; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - -import java.util.ArrayList; -import java.util.List; - - -public class ForTreeItem extends LoopTreeItem implements Block { - - public List firstCommands; - public TreeItem expression; - public List finalCommands; - public List commands; - - public ForTreeItem(AVM2Instruction instruction, int loopBreak, int loopContinue, List firstCommands, TreeItem expression, List finalCommands, List commands) { - super(instruction, loopBreak, loopContinue); - this.firstCommands = firstCommands; - this.expression = expression; - this.finalCommands = finalCommands; - this.commands = commands; - } - - private String stripSemicolon(String s) { - if (s.endsWith(";")) { - s = s.substring(0, s.length() - 1); - } - return s; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; - ret += hilight("for("); - for (int i = 0; i < firstCommands.size(); i++) { - if (i > 0) { - ret += ","; - } - ret += stripSemicolon(firstCommands.get(i).toString(constants)); - } - ret += ";"; - ret += expression.toString(constants); - ret += ";"; - for (int i = 0; i < finalCommands.size(); i++) { - if (i > 0) { - ret += ","; - } - ret += stripSemicolon(finalCommands.get(i).toString(constants)); - } - ret += hilight(")") + "\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; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.clauses; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + +import java.util.ArrayList; +import java.util.List; + + +public class ForTreeItem extends LoopTreeItem implements Block { + + public List firstCommands; + public TreeItem expression; + public List finalCommands; + public List commands; + + public ForTreeItem(AVM2Instruction instruction, int loopBreak, int loopContinue, List firstCommands, TreeItem expression, List finalCommands, List commands) { + super(instruction, loopBreak, loopContinue); + this.firstCommands = firstCommands; + this.expression = expression; + this.finalCommands = finalCommands; + this.commands = commands; + } + + private String stripSemicolon(String s) { + if (s.endsWith(";")) { + s = s.substring(0, s.length() - 1); + } + return s; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret += "loop" + loopBreak + ":\r\n"; + ret += hilight("for("); + for (int i = 0; i < firstCommands.size(); i++) { + if (i > 0) { + ret += ","; + } + ret += stripSemicolon(firstCommands.get(i).toString(constants)); + } + ret += ";"; + ret += expression.toString(constants); + ret += ";"; + for (int i = 0; i < finalCommands.size(); i++) { + if (i > 0) { + ret += ","; + } + ret += stripSemicolon(finalCommands.get(i).toString(constants)); + } + ret += hilight(")") + "\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; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/IfTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/IfTreeItem.java index eca98e2ca..92efbc782 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/IfTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/IfTreeItem.java @@ -1,68 +1,82 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.clauses; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - -import java.util.ArrayList; -import java.util.List; - - -public class IfTreeItem extends TreeItem implements Block { - public TreeItem expression; - public List onTrue; - public List onFalse; - - public IfTreeItem(AVM2Instruction instruction, TreeItem expression, List onTrue, List onFalse) { - super(instruction, NOPRECEDENCE); - this.expression = expression; - this.onTrue = onTrue; - this.onFalse = onFalse; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret = hilight("if(") + expression.toString(constants) + hilight(")\r\n{\r\n"); - for (TreeItem ti : onTrue) { - ret += ti.toString(constants) + "\r\n"; - } - ret += hilight("}"); - if (onFalse.size() > 0) { - ret += hilight("\r\nelse\r\n{\r\n"); - for (TreeItem ti : onFalse) { - ret += ti.toString(constants) + "\r\n"; - } - ret += hilight("}"); - } - return ret; - } - - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : onTrue) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - for (TreeItem ti : onFalse) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - return ret; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.clauses; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + +import java.util.ArrayList; +import java.util.List; + + +public class IfTreeItem extends TreeItem implements Block { + public TreeItem expression; + public List onTrue; + public List onFalse; + + public IfTreeItem(AVM2Instruction instruction, TreeItem expression, List onTrue, List onFalse) { + super(instruction, NOPRECEDENCE); + this.expression = expression; + this.onTrue = onTrue; + this.onFalse = onFalse; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret = hilight("if(") + expression.toString(constants) + hilight(")\r\n{\r\n"); + for (TreeItem ti : onTrue) { + ret += ti.toString(constants) + "\r\n"; + } + ret += hilight("}"); + if (onFalse.size() > 0) { + ret += hilight("\r\nelse\r\n{\r\n"); + for (TreeItem ti : onFalse) { + ret += ti.toString(constants) + "\r\n"; + } + ret += hilight("}"); + } + return ret; + } + + public List getContinues() { + List ret = new ArrayList(); + for (TreeItem ti : onTrue) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + for (TreeItem ti : onFalse) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + return ret; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/LoopTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/LoopTreeItem.java index ed3e5ed8c..c333be4fa 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/LoopTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/LoopTreeItem.java @@ -1,20 +1,34 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.clauses; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public abstract class LoopTreeItem extends TreeItem { - public int loopBreak; - public int loopContinue; - - public LoopTreeItem(AVM2Instruction instruction, int loopBreak, int loopContinue) { - super(instruction, NOPRECEDENCE); - this.loopBreak = loopBreak; - this.loopContinue = loopContinue; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.clauses; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public abstract class LoopTreeItem extends TreeItem { + public int loopBreak; + public int loopContinue; + + public LoopTreeItem(AVM2Instruction instruction, int loopBreak, int loopContinue) { + super(instruction, NOPRECEDENCE); + this.loopBreak = loopBreak; + this.loopContinue = loopContinue; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/SwitchTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/SwitchTreeItem.java index 4b8045fe6..11818dce0 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/SwitchTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/SwitchTreeItem.java @@ -1,82 +1,96 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.clauses; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - -import java.util.ArrayList; -import java.util.List; - - -public class SwitchTreeItem extends LoopTreeItem implements Block { - - public TreeItem switchedObject; - public List caseValues; - public List> caseCommands; - public List defaultCommands; - - public SwitchTreeItem(AVM2Instruction instruction, int switchBreak, TreeItem switchedObject, List caseValues, List> caseCommands, List defaultCommands) { - super(instruction, switchBreak, -1); - this.switchedObject = switchedObject; - this.caseValues = caseValues; - this.caseCommands = caseCommands; - this.defaultCommands = defaultCommands; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; - ret += hilight("switch(") + switchedObject.toString(constants) + hilight(")") + "\r\n{\r\n"; - for (int i = 0; i < caseValues.size(); i++) { - ret += "case " + caseValues.get(i).toString(constants) + ":\r\n"; - ret += AVM2Code.IDENTOPEN + "\r\n"; - for (int j = 0; j < caseCommands.get(i).size(); j++) { - ret += caseCommands.get(i).get(j).toString(constants) + "\r\n"; - } - ret += AVM2Code.IDENTCLOSE + "\r\n"; - } - if (defaultCommands.size() > 0) { - ret += hilight("default") + ":\r\n"; - ret += AVM2Code.IDENTOPEN + "\r\n"; - for (int j = 0; j < defaultCommands.size(); j++) { - ret += defaultCommands.get(j).toString(constants) + "\r\n"; - } - ret += AVM2Code.IDENTCLOSE + "\r\n"; - } - ret += hilight("}") + "\r\n"; - ret += ":loop" + loopBreak; - return ret; - } - - public List getContinues() { - List ret = new ArrayList(); - - for (List onecase : caseCommands) { - for (TreeItem ti : onecase) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - } - - for (TreeItem ti : defaultCommands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - return ret; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.clauses; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + +import java.util.ArrayList; +import java.util.List; + + +public class SwitchTreeItem extends LoopTreeItem implements Block { + + public TreeItem switchedObject; + public List caseValues; + public List> caseCommands; + public List defaultCommands; + + public SwitchTreeItem(AVM2Instruction instruction, int switchBreak, TreeItem switchedObject, List caseValues, List> caseCommands, List defaultCommands) { + super(instruction, switchBreak, -1); + this.switchedObject = switchedObject; + this.caseValues = caseValues; + this.caseCommands = caseCommands; + this.defaultCommands = defaultCommands; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret += "loop" + loopBreak + ":\r\n"; + ret += hilight("switch(") + switchedObject.toString(constants) + hilight(")") + "\r\n{\r\n"; + for (int i = 0; i < caseValues.size(); i++) { + ret += "case " + caseValues.get(i).toString(constants) + ":\r\n"; + ret += AVM2Code.IDENTOPEN + "\r\n"; + for (int j = 0; j < caseCommands.get(i).size(); j++) { + ret += caseCommands.get(i).get(j).toString(constants) + "\r\n"; + } + ret += AVM2Code.IDENTCLOSE + "\r\n"; + } + if (defaultCommands.size() > 0) { + ret += hilight("default") + ":\r\n"; + ret += AVM2Code.IDENTOPEN + "\r\n"; + for (int j = 0; j < defaultCommands.size(); j++) { + ret += defaultCommands.get(j).toString(constants) + "\r\n"; + } + ret += AVM2Code.IDENTCLOSE + "\r\n"; + } + ret += hilight("}") + "\r\n"; + ret += ":loop" + loopBreak; + return ret; + } + + public List getContinues() { + List ret = new ArrayList(); + + for (List onecase : caseCommands) { + for (TreeItem ti : onecase) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + } + + for (TreeItem ti : defaultCommands) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + return ret; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/TernarOpTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/TernarOpTreeItem.java index b8d148e5a..cf2d549c0 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/TernarOpTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/TernarOpTreeItem.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.clauses; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class TernarOpTreeItem extends TreeItem { - public TreeItem expression; - public TreeItem onTrue; - public TreeItem onFalse; - - public TernarOpTreeItem(AVM2Instruction instruction, TreeItem expression, TreeItem onTrue, TreeItem onFalse) { - super(instruction, PRECEDENCE_CONDITIONAL); - this.expression = expression; - this.onTrue = onTrue; - this.onFalse = onFalse; - } - - @Override - public String toString(ConstantPool constants) { - return expression.toString(constants) + hilight("?") + onTrue.toString(constants) + hilight(":") + onFalse.toString(constants); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.clauses; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class TernarOpTreeItem extends TreeItem { + public TreeItem expression; + public TreeItem onTrue; + public TreeItem onFalse; + + public TernarOpTreeItem(AVM2Instruction instruction, TreeItem expression, TreeItem onTrue, TreeItem onFalse) { + super(instruction, PRECEDENCE_CONDITIONAL); + this.expression = expression; + this.onTrue = onTrue; + this.onFalse = onFalse; + } + + @Override + public String toString(ConstantPool constants) { + return expression.toString(constants) + hilight("?") + onTrue.toString(constants) + hilight(":") + onFalse.toString(constants); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/TryTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/TryTreeItem.java index bb48f929c..1a4f7ca2c 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/TryTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/TryTreeItem.java @@ -1,89 +1,103 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.clauses; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.ABCException; - -import java.util.ArrayList; -import java.util.List; - - -public class TryTreeItem extends TreeItem implements Block { - - public List tryCommands; - public List catchExceptions; - public List> catchCommands; - public List finallyCommands; - - public TryTreeItem(List tryCommands, List catchExceptions, List> catchCommands, List finallyCommands) { - super(null, NOPRECEDENCE); - this.tryCommands = tryCommands; - this.catchExceptions = catchExceptions; - this.catchCommands = catchCommands; - this.finallyCommands = finallyCommands; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "try\r\n{\r\n"; - for (TreeItem ti : tryCommands) { - ret += ti.toString(constants) + "\r\n"; - } - ret += "}"; - for (int e = 0; e < catchExceptions.size(); e++) { - ret += "\r\ncatch(" + catchExceptions.get(e).getVarName(constants) + ":" + catchExceptions.get(e).getTypeName(constants) + ")\r\n{\r\n"; - List commands = catchCommands.get(e); - for (TreeItem ti : commands) { - ret += ti.toString(constants) + "\r\n"; - } - ret += "}"; - } - if (finallyCommands.size() > 0) { - ret += "\r\nfinally\r\n{\r\n"; - for (TreeItem ti : finallyCommands) { - ret += ti.toString(constants) + "\r\n"; - } - ret += "}"; - } - return ret; - } - - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : tryCommands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - if (finallyCommands != null) { - for (TreeItem ti : finallyCommands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - } - for (List commands : catchCommands) { - for (TreeItem ti : commands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - } - return ret; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.clauses; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.ABCException; + +import java.util.ArrayList; +import java.util.List; + + +public class TryTreeItem extends TreeItem implements Block { + + public List tryCommands; + public List catchExceptions; + public List> catchCommands; + public List finallyCommands; + + public TryTreeItem(List tryCommands, List catchExceptions, List> catchCommands, List finallyCommands) { + super(null, NOPRECEDENCE); + this.tryCommands = tryCommands; + this.catchExceptions = catchExceptions; + this.catchCommands = catchCommands; + this.finallyCommands = finallyCommands; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret += "try\r\n{\r\n"; + for (TreeItem ti : tryCommands) { + ret += ti.toString(constants) + "\r\n"; + } + ret += "}"; + for (int e = 0; e < catchExceptions.size(); e++) { + ret += "\r\ncatch(" + catchExceptions.get(e).getVarName(constants) + ":" + catchExceptions.get(e).getTypeName(constants) + ")\r\n{\r\n"; + List commands = catchCommands.get(e); + for (TreeItem ti : commands) { + ret += ti.toString(constants) + "\r\n"; + } + ret += "}"; + } + if (finallyCommands.size() > 0) { + ret += "\r\nfinally\r\n{\r\n"; + for (TreeItem ti : finallyCommands) { + ret += ti.toString(constants) + "\r\n"; + } + ret += "}"; + } + return ret; + } + + public List getContinues() { + List ret = new ArrayList(); + for (TreeItem ti : tryCommands) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + if (finallyCommands != null) { + for (TreeItem ti : finallyCommands) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + } + for (List commands : catchCommands) { + for (TreeItem ti : commands) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + } + return ret; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/WhileTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/WhileTreeItem.java index e204abd26..f43505a16 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/WhileTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/clauses/WhileTreeItem.java @@ -1,52 +1,66 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.clauses; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - -import java.util.ArrayList; -import java.util.List; - - -public class WhileTreeItem extends LoopTreeItem implements Block { - - public TreeItem expression; - public List commands; - - public WhileTreeItem(AVM2Instruction instruction, int loopBreak, int loopContinue, TreeItem expression, List commands) { - super(instruction, loopBreak, loopContinue); - this.expression = expression; - this.commands = commands; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; - ret += hilight("while(") + expression.toString(constants) + hilight(")") + "\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; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.clauses; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.ContinueTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + +import java.util.ArrayList; +import java.util.List; + + +public class WhileTreeItem extends LoopTreeItem implements Block { + + public TreeItem expression; + public List commands; + + public WhileTreeItem(AVM2Instruction instruction, int loopBreak, int loopContinue, TreeItem expression, List commands) { + super(instruction, loopBreak, loopContinue); + this.expression = expression; + this.commands = commands; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret += "loop" + loopBreak + ":\r\n"; + ret += hilight("while(") + expression.toString(constants) + hilight(")") + "\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; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/AddTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/AddTreeItem.java index c784eba4a..8ec389f1e 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/AddTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/AddTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class AddTreeItem extends BinaryOpTreeItem { - - public AddTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "+"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class AddTreeItem extends BinaryOpTreeItem { + + public AddTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "+"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/AndTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/AndTreeItem.java index 063d5c131..00173abc5 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/AndTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/AndTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class AndTreeItem extends BinaryOpTreeItem { - - public AndTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_LOGICALAND, leftSide, rightSide, "&&"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class AndTreeItem extends BinaryOpTreeItem { + + public AndTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_LOGICALAND, leftSide, rightSide, "&&"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/AsTypeTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/AsTypeTreeItem.java index 30875b4de..5821e1419 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/AsTypeTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/AsTypeTreeItem.java @@ -1,18 +1,32 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class AsTypeTreeItem extends BinaryOpTreeItem { - - public AsTypeTreeItem(AVM2Instruction instruction, TreeItem value, TreeItem type) { - super(instruction, PRECEDENCE_RELATIONAL, value, type, " as "); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class AsTypeTreeItem extends BinaryOpTreeItem { + + public AsTypeTreeItem(AVM2Instruction instruction, TreeItem value, TreeItem type) { + super(instruction, PRECEDENCE_RELATIONAL, value, type, " as "); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BinaryOpTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BinaryOpTreeItem.java index b3fc9849d..45b914385 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BinaryOpTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BinaryOpTreeItem.java @@ -1,43 +1,57 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public abstract class BinaryOpTreeItem extends TreeItem { - - public TreeItem leftSide; - public TreeItem rightSide; - protected String operator = ""; - - public BinaryOpTreeItem(AVM2Instruction instruction, int precedence, TreeItem leftSide, TreeItem rightSide, String operator) { - super(instruction, precedence); - this.leftSide = leftSide; - this.rightSide = rightSide; - this.operator = operator; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - if (leftSide.precedence > precedence) { - ret += "(" + leftSide.toString(constants) + ")"; - } else { - ret += leftSide.toString(constants); - } - ret += hilight(operator); - if (rightSide.precedence > precedence) { - ret += "(" + rightSide.toString(constants) + ")"; - } else { - ret += rightSide.toString(constants); - } - return ret; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public abstract class BinaryOpTreeItem extends TreeItem { + + public TreeItem leftSide; + public TreeItem rightSide; + protected String operator = ""; + + public BinaryOpTreeItem(AVM2Instruction instruction, int precedence, TreeItem leftSide, TreeItem rightSide, String operator) { + super(instruction, precedence); + this.leftSide = leftSide; + this.rightSide = rightSide; + this.operator = operator; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + if (leftSide.precedence > precedence) { + ret += "(" + leftSide.toString(constants) + ")"; + } else { + ret += leftSide.toString(constants); + } + ret += hilight(operator); + if (rightSide.precedence > precedence) { + ret += "(" + rightSide.toString(constants) + ")"; + } else { + ret += rightSide.toString(constants); + } + return ret; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitAndTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitAndTreeItem.java index 215f5df97..1d8186080 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitAndTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitAndTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class BitAndTreeItem extends BinaryOpTreeItem { - - public BitAndTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_BITWISEAND, leftSide, rightSide, "&"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class BitAndTreeItem extends BinaryOpTreeItem { + + public BitAndTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_BITWISEAND, leftSide, rightSide, "&"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitNotTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitNotTreeItem.java index 430ed570f..d8cff81bb 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitNotTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitNotTreeItem.java @@ -1,16 +1,30 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class BitNotTreeItem extends UnaryOpTreeItem { - - public BitNotTreeItem(AVM2Instruction instruction, TreeItem value) { - super(instruction, PRECEDENCE_UNARY, value, "~"); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class BitNotTreeItem extends UnaryOpTreeItem { + + public BitNotTreeItem(AVM2Instruction instruction, TreeItem value) { + super(instruction, PRECEDENCE_UNARY, value, "~"); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitOrTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitOrTreeItem.java index ecc9af640..c13c61304 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitOrTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitOrTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class BitOrTreeItem extends BinaryOpTreeItem { - - public BitOrTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_BITWISEOR, leftSide, rightSide, "|"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class BitOrTreeItem extends BinaryOpTreeItem { + + public BitOrTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_BITWISEOR, leftSide, rightSide, "|"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitXorTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitXorTreeItem.java index 23e0f04e3..a6efa046f 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitXorTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/BitXorTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class BitXorTreeItem extends BinaryOpTreeItem { - - public BitXorTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_BITWISEXOR, leftSide, rightSide, "^"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class BitXorTreeItem extends BinaryOpTreeItem { + + public BitXorTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_BITWISEXOR, leftSide, rightSide, "^"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/DeletePropertyTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/DeletePropertyTreeItem.java index 4fe3ad117..e74202d19 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/DeletePropertyTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/DeletePropertyTreeItem.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class DeletePropertyTreeItem extends TreeItem { - public TreeItem object; - public FullMultinameTreeItem propertyName; - - public DeletePropertyTreeItem(AVM2Instruction instruction, TreeItem object, FullMultinameTreeItem propertyName) { - super(instruction, PRECEDENCE_UNARY); - this.object = object; - this.propertyName = propertyName; - } - - @Override - public String toString(ConstantPool constants) { - return hilight("delete ") + object.toString(constants) + "[" + propertyName.toString(constants) + "]"; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.FullMultinameTreeItem; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class DeletePropertyTreeItem extends TreeItem { + public TreeItem object; + public FullMultinameTreeItem propertyName; + + public DeletePropertyTreeItem(AVM2Instruction instruction, TreeItem object, FullMultinameTreeItem propertyName) { + super(instruction, PRECEDENCE_UNARY); + this.object = object; + this.propertyName = propertyName; + } + + @Override + public String toString(ConstantPool constants) { + return hilight("delete ") + object.toString(constants) + "[" + propertyName.toString(constants) + "]"; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/DivideTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/DivideTreeItem.java index 371b34ac4..ac9ef4209 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/DivideTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/DivideTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class DivideTreeItem extends BinaryOpTreeItem { - - public DivideTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "/"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class DivideTreeItem extends BinaryOpTreeItem { + + public DivideTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "/"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/EqTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/EqTreeItem.java index 6aae09bfb..8298a4c57 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/EqTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/EqTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class EqTreeItem extends BinaryOpTreeItem { - - public EqTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "=="); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class EqTreeItem extends BinaryOpTreeItem { + + public EqTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "=="); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/GeTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/GeTreeItem.java index 275eeaff2..99b546d44 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/GeTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/GeTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class GeTreeItem extends BinaryOpTreeItem { - - public GeTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">="); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class GeTreeItem extends BinaryOpTreeItem { + + public GeTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">="); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/GtTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/GtTreeItem.java index 6a0650a54..e6df394a8 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/GtTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/GtTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class GtTreeItem extends BinaryOpTreeItem { - - public GtTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class GtTreeItem extends BinaryOpTreeItem { + + public GtTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/InTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/InTreeItem.java index 18bd8c3b1..e7911d89e 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/InTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/InTreeItem.java @@ -1,18 +1,32 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class InTreeItem extends BinaryOpTreeItem { - - public InTreeItem(AVM2Instruction instruction, TreeItem name, TreeItem object) { - super(instruction, PRECEDENCE_RELATIONAL, name, object, " in "); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class InTreeItem extends BinaryOpTreeItem { + + public InTreeItem(AVM2Instruction instruction, TreeItem name, TreeItem object) { + super(instruction, PRECEDENCE_RELATIONAL, name, object, " in "); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/InstanceOfTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/InstanceOfTreeItem.java index e5ab0ca71..7ac1c47fb 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/InstanceOfTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/InstanceOfTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class InstanceOfTreeItem extends BinaryOpTreeItem { - - public InstanceOfTreeItem(AVM2Instruction instruction, TreeItem value, TreeItem type) { - super(instruction, PRECEDENCE_RELATIONAL, value, type, " instanceof "); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class InstanceOfTreeItem extends BinaryOpTreeItem { + + public InstanceOfTreeItem(AVM2Instruction instruction, TreeItem value, TreeItem type) { + super(instruction, PRECEDENCE_RELATIONAL, value, type, " instanceof "); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/IsTypeTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/IsTypeTreeItem.java index b93e2ac39..b66d783c8 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/IsTypeTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/IsTypeTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class IsTypeTreeItem extends BinaryOpTreeItem { - - public IsTypeTreeItem(AVM2Instruction instruction, TreeItem value, TreeItem type) { - super(instruction, PRECEDENCE_RELATIONAL, value, type, " is "); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class IsTypeTreeItem extends BinaryOpTreeItem { + + public IsTypeTreeItem(AVM2Instruction instruction, TreeItem value, TreeItem type) { + super(instruction, PRECEDENCE_RELATIONAL, value, type, " is "); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/LShiftTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/LShiftTreeItem.java index 067208f2d..0a81f4150 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/LShiftTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/LShiftTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class LShiftTreeItem extends BinaryOpTreeItem { - - public LShiftTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, "<<"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class LShiftTreeItem extends BinaryOpTreeItem { + + public LShiftTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, "<<"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/LeTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/LeTreeItem.java index 6125bfb66..c0738b64d 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/LeTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/LeTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class LeTreeItem extends BinaryOpTreeItem { - - public LeTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<="); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class LeTreeItem extends BinaryOpTreeItem { + + public LeTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<="); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/LtTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/LtTreeItem.java index 0b7c5f983..2345701aa 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/LtTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/LtTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class LtTreeItem extends BinaryOpTreeItem { - - public LtTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class LtTreeItem extends BinaryOpTreeItem { + + public LtTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/ModuloTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/ModuloTreeItem.java index 28ccc61d4..ec43fdaa4 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/ModuloTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/ModuloTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class ModuloTreeItem extends BinaryOpTreeItem { - - public ModuloTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "%"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class ModuloTreeItem extends BinaryOpTreeItem { + + public ModuloTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "%"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/MultiplyTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/MultiplyTreeItem.java index 913584517..56aae736e 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/MultiplyTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/MultiplyTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class MultiplyTreeItem extends BinaryOpTreeItem { - - public MultiplyTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "*"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class MultiplyTreeItem extends BinaryOpTreeItem { + + public MultiplyTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "*"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/NegTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/NegTreeItem.java index f1ab86009..0d07d6d2f 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/NegTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/NegTreeItem.java @@ -1,16 +1,30 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class NegTreeItem extends UnaryOpTreeItem { - - public NegTreeItem(AVM2Instruction instruction, TreeItem value) { - super(instruction, PRECEDENCE_UNARY, value, "-"); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class NegTreeItem extends UnaryOpTreeItem { + + public NegTreeItem(AVM2Instruction instruction, TreeItem value) { + super(instruction, PRECEDENCE_UNARY, value, "-"); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/NeqTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/NeqTreeItem.java index 16728f63d..11d2030d2 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/NeqTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/NeqTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class NeqTreeItem extends BinaryOpTreeItem { - - public NeqTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!="); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class NeqTreeItem extends BinaryOpTreeItem { + + public NeqTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!="); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/NotTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/NotTreeItem.java index 409e35558..df3fbaf2b 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/NotTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/NotTreeItem.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class NotTreeItem extends UnaryOpTreeItem { - - public NotTreeItem(AVM2Instruction instruction, TreeItem value) { - super(instruction, PRECEDENCE_UNARY, value, "!"); - } - - @Override - public boolean isTrue() { - return !value.isTrue(); - } - - @Override - public boolean isFalse() { - return !value.isFalse(); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class NotTreeItem extends UnaryOpTreeItem { + + public NotTreeItem(AVM2Instruction instruction, TreeItem value) { + super(instruction, PRECEDENCE_UNARY, value, "!"); + } + + @Override + public boolean isTrue() { + return !value.isTrue(); + } + + @Override + public boolean isFalse() { + return !value.isFalse(); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/OrTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/OrTreeItem.java index 96392b388..096c607ab 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/OrTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/OrTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class OrTreeItem extends BinaryOpTreeItem { - - public OrTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_LOGICALOR, leftSide, rightSide, "||"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class OrTreeItem extends BinaryOpTreeItem { + + public OrTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_LOGICALOR, leftSide, rightSide, "||"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/PreDecrementTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/PreDecrementTreeItem.java index d50082eae..c2be428ed 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/PreDecrementTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/PreDecrementTreeItem.java @@ -1,15 +1,29 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class PreDecrementTreeItem extends UnaryOpTreeItem { - public PreDecrementTreeItem(AVM2Instruction instruction, TreeItem object) { - super(instruction, PRECEDENCE_UNARY, object, "--"); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class PreDecrementTreeItem extends UnaryOpTreeItem { + public PreDecrementTreeItem(AVM2Instruction instruction, TreeItem object) { + super(instruction, PRECEDENCE_UNARY, object, "--"); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/PreIncrementTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/PreIncrementTreeItem.java index 7e63d9a6d..506048e5b 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/PreIncrementTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/PreIncrementTreeItem.java @@ -1,18 +1,32 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class PreIncrementTreeItem extends UnaryOpTreeItem { - - public PreIncrementTreeItem(AVM2Instruction instruction, TreeItem object) { - super(instruction, PRECEDENCE_UNARY, object, "++"); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class PreIncrementTreeItem extends UnaryOpTreeItem { + + public PreIncrementTreeItem(AVM2Instruction instruction, TreeItem object) { + super(instruction, PRECEDENCE_UNARY, object, "++"); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/RShiftTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/RShiftTreeItem.java index b9eefb69a..87321efbc 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/RShiftTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/RShiftTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class RShiftTreeItem extends BinaryOpTreeItem { - - public RShiftTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class RShiftTreeItem extends BinaryOpTreeItem { + + public RShiftTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/StrictEqTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/StrictEqTreeItem.java index 51a70da63..e8203249c 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/StrictEqTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/StrictEqTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class StrictEqTreeItem extends BinaryOpTreeItem { - - public StrictEqTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "==="); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class StrictEqTreeItem extends BinaryOpTreeItem { + + public StrictEqTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "==="); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/StrictNeqTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/StrictNeqTreeItem.java index a88cde6b6..eefb80205 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/StrictNeqTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/StrictNeqTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class StrictNeqTreeItem extends BinaryOpTreeItem { - - public StrictNeqTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!=="); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class StrictNeqTreeItem extends BinaryOpTreeItem { + + public StrictNeqTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!=="); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/SubtractTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/SubtractTreeItem.java index 7f497e837..8457a3c96 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/SubtractTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/SubtractTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class SubtractTreeItem extends BinaryOpTreeItem { - - public SubtractTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "-"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class SubtractTreeItem extends BinaryOpTreeItem { + + public SubtractTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "-"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/TypeOfTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/TypeOfTreeItem.java index 17587bf49..7da910259 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/TypeOfTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/TypeOfTreeItem.java @@ -1,16 +1,30 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class TypeOfTreeItem extends UnaryOpTreeItem { - - public TypeOfTreeItem(AVM2Instruction instruction, TreeItem value) { - super(instruction, PRECEDENCE_UNARY, value, "typeof "); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class TypeOfTreeItem extends UnaryOpTreeItem { + + public TypeOfTreeItem(AVM2Instruction instruction, TreeItem value) { + super(instruction, PRECEDENCE_UNARY, value, "typeof "); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/URShiftTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/URShiftTreeItem.java index baad20c3e..a63aa2453 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/URShiftTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/URShiftTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public class URShiftTreeItem extends BinaryOpTreeItem { - - public URShiftTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>>"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public class URShiftTreeItem extends BinaryOpTreeItem { + + public URShiftTreeItem(AVM2Instruction instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>>"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/UnaryOpTreeItem.java b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/UnaryOpTreeItem.java index eb105b7ab..00ca9b59b 100644 --- a/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/UnaryOpTreeItem.java +++ b/trunk/src/com/jpexs/asdec/abc/avm2/treemodel/operations/UnaryOpTreeItem.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.avm2.treemodel.operations; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; - - -public abstract class UnaryOpTreeItem extends TreeItem { - public TreeItem value; - public String operator; - - public UnaryOpTreeItem(AVM2Instruction instruction, int precedence, TreeItem value, String operator) { - super(instruction, precedence); - this.value = value; - this.operator = operator; - } - - @Override - public String toString(ConstantPool constants) { - String s = value.toString(constants); - if (value.precedence > precedence) s = "(" + s + ")"; - return hilight(operator) + s; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.avm2.treemodel.operations; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.instructions.AVM2Instruction; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; + + +public abstract class UnaryOpTreeItem extends TreeItem { + public TreeItem value; + public String operator; + + public UnaryOpTreeItem(AVM2Instruction instruction, int precedence, TreeItem value, String operator) { + super(instruction, precedence); + this.value = value; + this.operator = operator; + } + + @Override + public String toString(ConstantPool constants) { + String s = value.toString(constants); + if (value.precedence > precedence) s = "(" + s + ")"; + return hilight(operator) + s; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/ABCComboBoxModel.java b/trunk/src/com/jpexs/asdec/abc/gui/ABCComboBoxModel.java index 3c919d73d..96daca7de 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/ABCComboBoxModel.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/ABCComboBoxModel.java @@ -1,47 +1,61 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.gui; - -import com.jpexs.asdec.tags.DoABCTag; - -import javax.swing.*; -import javax.swing.event.ListDataListener; -import java.util.List; - - -public class ABCComboBoxModel implements ComboBoxModel { - public List list; - public int itemIndex = 0; - - public ABCComboBoxModel(List list) { - this.list = list; - } - - - public int getSize() { - return list.size(); - } - - public Object getElementAt(int index) { - return list.get(index); - } - - public void addListDataListener(ListDataListener l) { - - } - - public void removeListDataListener(ListDataListener l) { - - } - - public void setSelectedItem(Object anItem) { - itemIndex = list.indexOf(anItem); - } - - public Object getSelectedItem() { - return getElementAt(itemIndex); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.gui; + +import com.jpexs.asdec.tags.DoABCTag; + +import javax.swing.*; +import javax.swing.event.ListDataListener; +import java.util.List; + + +public class ABCComboBoxModel implements ComboBoxModel { + public List list; + public int itemIndex = 0; + + public ABCComboBoxModel(List list) { + this.list = list; + } + + + public int getSize() { + return list.size(); + } + + public Object getElementAt(int index) { + return list.get(index); + } + + public void addListDataListener(ListDataListener l) { + + } + + public void removeListDataListener(ListDataListener l) { + + } + + public void setSelectedItem(Object anItem) { + itemIndex = list.indexOf(anItem); + } + + public Object getSelectedItem() { + return getElementAt(itemIndex); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/ASMSourceEditorPane.java b/trunk/src/com/jpexs/asdec/abc/gui/ASMSourceEditorPane.java index 0b9833f17..0705a94c5 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/ASMSourceEditorPane.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/ASMSourceEditorPane.java @@ -1,119 +1,133 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.gui; - -import com.jpexs.asdec.Main; -import com.jpexs.asdec.abc.ABC; -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.ConvertException; -import com.jpexs.asdec.abc.avm2.parser.ASM3Parser; -import com.jpexs.asdec.abc.avm2.parser.ParseException; - -import javax.swing.*; -import java.io.ByteArrayInputStream; -import java.io.IOException; - - -public class ASMSourceEditorPane extends JEditorPane { - - public ABC abc; - public int bodyIndex; - - public ASMSourceEditorPane() { - - } - - public void setBodyIndex(int bodyIndex, ABC abc) { - this.bodyIndex = bodyIndex; - this.abc = abc; - setText(abc.bodies[bodyIndex].code.toASMSource(abc.constants)); - } - - public void save(ConstantPool constants) { - try { - AVM2Code acode = ASM3Parser.parse(new ByteArrayInputStream(getText().getBytes()), constants, new DialogMissingSymbolHandler()); - abc.bodies[bodyIndex].code = acode; - Main.abcMainFrame.decompiledTextArea.reloadClass(); - Main.abcMainFrame.decompiledTextArea.gotoLastTrait(); - } catch (IOException ex) { - } catch (ParseException ex) { - JOptionPane.showMessageDialog(this, (ex.text + " on line " + ex.line)); - selectLine((int) ex.line); - return; - } - JOptionPane.showMessageDialog(this, ("Code Saved")); - } - - public void verify(ConstantPool constants, ABC abc) { - try { - AVM2Code acode = ASM3Parser.parse(new ByteArrayInputStream(getText().getBytes()), constants, new DialogMissingSymbolHandler()); - acode.clearSecureSWF(abc.constants, abc.bodies[bodyIndex]); - setText(acode.toASMSource(constants)); - - - //Main.mainFrame.decompiledTextArea.setBody(mb, abc); - } catch (IOException ex) { - } catch (ConvertException ex) { - } catch (ParseException ex) { - JOptionPane.showMessageDialog(this, (ex.text + " on line " + ex.line)); - selectLine((int) ex.line); - return; - } - JOptionPane.showMessageDialog(this, ("Code OK")); - } - - public void selectInstruction(int pos) { - String text = getText(); - int lineCnt = 1; - int lineStart = 0; - int lineEnd = -1; - int instrCount = 0; - int dot = -2; - for (int i = 0; i < text.length(); i++) { - if (text.charAt(i) == '\n') { - if (!((i > 0) && (text.charAt(i - 1) == ':'))) - instrCount++; - lineCnt++; - if (instrCount == pos) { - lineStart = i; - dot = lineCnt; - } - if (lineCnt == dot + 1) { - lineEnd = i; - break; - } - } - } - if (lineCnt == -1) { - lineEnd = text.length() - 1; - } - select(lineStart, lineEnd); - requestFocus(); - } - - public void selectLine(int line) { - String text = getText(); - int lineCnt = 1; - int lineStart = 0; - int lineEnd = -1; - for (int i = 0; i < text.length(); i++) { - if (text.charAt(i) == '\n') { - lineCnt++; - if (lineCnt == line) { - lineStart = i; - } - if (lineCnt == line + 1) { - lineEnd = i; - } - } - } - if (lineCnt == -1) { - lineEnd = text.length() - 1; - } - select(lineStart, lineEnd); - requestFocus(); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.gui; + +import com.jpexs.asdec.Main; +import com.jpexs.asdec.abc.ABC; +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.ConvertException; +import com.jpexs.asdec.abc.avm2.parser.ASM3Parser; +import com.jpexs.asdec.abc.avm2.parser.ParseException; + +import javax.swing.*; +import java.io.ByteArrayInputStream; +import java.io.IOException; + + +public class ASMSourceEditorPane extends JEditorPane { + + public ABC abc; + public int bodyIndex; + + public ASMSourceEditorPane() { + + } + + public void setBodyIndex(int bodyIndex, ABC abc) { + this.bodyIndex = bodyIndex; + this.abc = abc; + setText(abc.bodies[bodyIndex].code.toASMSource(abc.constants)); + } + + public void save(ConstantPool constants) { + try { + AVM2Code acode = ASM3Parser.parse(new ByteArrayInputStream(getText().getBytes()), constants, new DialogMissingSymbolHandler()); + abc.bodies[bodyIndex].code = acode; + Main.abcMainFrame.decompiledTextArea.reloadClass(); + Main.abcMainFrame.decompiledTextArea.gotoLastTrait(); + } catch (IOException ex) { + } catch (ParseException ex) { + JOptionPane.showMessageDialog(this, (ex.text + " on line " + ex.line)); + selectLine((int) ex.line); + return; + } + JOptionPane.showMessageDialog(this, ("Code Saved")); + } + + public void verify(ConstantPool constants, ABC abc) { + try { + AVM2Code acode = ASM3Parser.parse(new ByteArrayInputStream(getText().getBytes()), constants, new DialogMissingSymbolHandler()); + acode.clearSecureSWF(abc.constants, abc.bodies[bodyIndex]); + setText(acode.toASMSource(constants)); + + + //Main.mainFrame.decompiledTextArea.setBody(mb, abc); + } catch (IOException ex) { + } catch (ConvertException ex) { + } catch (ParseException ex) { + JOptionPane.showMessageDialog(this, (ex.text + " on line " + ex.line)); + selectLine((int) ex.line); + return; + } + JOptionPane.showMessageDialog(this, ("Code OK")); + } + + public void selectInstruction(int pos) { + String text = getText(); + int lineCnt = 1; + int lineStart = 0; + int lineEnd = -1; + int instrCount = 0; + int dot = -2; + for (int i = 0; i < text.length(); i++) { + if (text.charAt(i) == '\n') { + if (!((i > 0) && (text.charAt(i - 1) == ':'))) + instrCount++; + lineCnt++; + if (instrCount == pos) { + lineStart = i; + dot = lineCnt; + } + if (lineCnt == dot + 1) { + lineEnd = i; + break; + } + } + } + if (lineCnt == -1) { + lineEnd = text.length() - 1; + } + select(lineStart, lineEnd); + requestFocus(); + } + + public void selectLine(int line) { + String text = getText(); + int lineCnt = 1; + int lineStart = 0; + int lineEnd = -1; + for (int i = 0; i < text.length(); i++) { + if (text.charAt(i) == '\n') { + lineCnt++; + if (lineCnt == line) { + lineStart = i; + } + if (lineCnt == line + 1) { + lineEnd = i; + } + } + } + if (lineCnt == -1) { + lineEnd = text.length() - 1; + } + select(lineStart, lineEnd); + requestFocus(); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/ClassesListTree.java b/trunk/src/com/jpexs/asdec/abc/gui/ClassesListTree.java index f2968779c..d734eda4f 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/ClassesListTree.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/ClassesListTree.java @@ -1,56 +1,70 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.gui; - -import com.jpexs.asdec.Main; -import com.jpexs.asdec.abc.ABC; - -import javax.swing.*; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.DefaultTreeCellRenderer; - - -public class ClassesListTree extends JTree implements TreeSelectionListener { - public ABC abc; - - public ClassesListTree(ABC abc) { - this.abc = abc; - setModel(new ClassesListTreeModel(abc)); - addTreeSelectionListener(this); - DefaultTreeCellRenderer treeRenderer = new DefaultTreeCellRenderer(); - ClassLoader cldr = this.getClass().getClassLoader(); - java.net.URL imageURL = cldr.getResource("com/jpexs/asdec/abc/gui/graphics/class.png"); - ImageIcon leafIcon = new ImageIcon(imageURL); - treeRenderer.setLeafIcon(leafIcon); - setCellRenderer(treeRenderer); - } - - public void setABC(ABC abc) { - setModel(new ClassesListTreeModel(abc)); - this.abc = abc; - } - - public void valueChanged(TreeSelectionEvent e) { - if (Main.isWorking()) return; - final TreePart tp = (TreePart) getLastSelectedPathComponent(); - if (tp == null) return; - if (tp.classIndex != -1) { - if (!Main.isWorking()) { - Main.startWork("Decompiling class..."); - (new Thread() { - @Override - public void run() { - Main.abcMainFrame.navigator.setClassIndex(tp.classIndex); - Main.abcMainFrame.decompiledTextArea.setClassIndex(tp.classIndex, abc); - Main.abcMainFrame.sourceTextArea.setText(""); - Main.stopWork(); - } - }).start(); - } - } - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.gui; + +import com.jpexs.asdec.Main; +import com.jpexs.asdec.abc.ABC; + +import javax.swing.*; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultTreeCellRenderer; + + +public class ClassesListTree extends JTree implements TreeSelectionListener { + public ABC abc; + + public ClassesListTree(ABC abc) { + this.abc = abc; + setModel(new ClassesListTreeModel(abc)); + addTreeSelectionListener(this); + DefaultTreeCellRenderer treeRenderer = new DefaultTreeCellRenderer(); + ClassLoader cldr = this.getClass().getClassLoader(); + java.net.URL imageURL = cldr.getResource("com/jpexs/asdec/abc/gui/graphics/class.png"); + ImageIcon leafIcon = new ImageIcon(imageURL); + treeRenderer.setLeafIcon(leafIcon); + setCellRenderer(treeRenderer); + } + + public void setABC(ABC abc) { + setModel(new ClassesListTreeModel(abc)); + this.abc = abc; + } + + public void valueChanged(TreeSelectionEvent e) { + if (Main.isWorking()) return; + final TreePart tp = (TreePart) getLastSelectedPathComponent(); + if (tp == null) return; + if (tp.classIndex != -1) { + if (!Main.isWorking()) { + Main.startWork("Decompiling class..."); + (new Thread() { + @Override + public void run() { + Main.abcMainFrame.navigator.setClassIndex(tp.classIndex); + Main.abcMainFrame.decompiledTextArea.setClassIndex(tp.classIndex, abc); + Main.abcMainFrame.sourceTextArea.setText(""); + Main.stopWork(); + } + }).start(); + } + } + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/ClassesListTreeModel.java b/trunk/src/com/jpexs/asdec/abc/gui/ClassesListTreeModel.java index 5aac03919..fed005956 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/ClassesListTreeModel.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/ClassesListTreeModel.java @@ -1,114 +1,128 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.gui; - -import com.jpexs.asdec.abc.ABC; - -import javax.swing.event.TreeModelListener; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.regex.Pattern; - - -public class ClassesListTreeModel implements TreeModel { - private ABC abc; - private List pathList = new ArrayList(); - - public ClassesListTreeModel(ABC abc) { - this.abc = abc; - for (int i = 0; i < abc.instance_info.length; i++) { - String packageName = abc.instance_info[i].getName(abc.constants).getNamespace(abc.constants).getName(abc.constants); - String className = abc.instance_info[i].getName(abc.constants).getName(abc.constants); - String full = packageName + "." + className; - String parts[] = full.split("\\."); - String s = ""; - for (int j = 0; j < parts.length; j++) { - if (!s.endsWith(".")) s += "."; - s += parts[j]; - TreePart tp = new TreePart(s, parts[j], j < parts.length - 1 ? -1 : i); - if (!pathList.contains(tp)) { - pathList.add(tp); - } - } - } - for (int k1 = 0; k1 < pathList.size(); k1++) { - TreePart tp1 = pathList.get(k1); - for (int k2 = 0; k2 < pathList.size(); k2++) { - if (k1 == k2) continue; - TreePart tp2 = pathList.get(k2); - if (!tp1.path.equals(tp2.path)) { - if (tp1.path.startsWith(tp2.path + ".")) { - tp2.hasSubParts = true; - } - if (tp2.path.startsWith(tp1.path + ".")) { - tp1.hasSubParts = true; - } - } - } - } - Collections.sort(pathList); - } - - - public Object getRoot() { - return new TreePart("", "", -1); - } - - public Object getChild(Object parent, int index) { - int i = -1; - for (TreePart tp : pathList) { - if (tp.path.matches(Pattern.quote(((TreePart) parent).path) + "\\.[^\\.]+")) { - i++; - if (i == index) { - return tp; - } - } - } - return null; - } - - public int getChildCount(Object parent) { - int i = 0; - for (TreePart tp : pathList) { - if (tp.path.matches(Pattern.quote(((TreePart) parent).path) + "\\.[^\\.]+")) { - i++; - } - } - return i; - } - - public boolean isLeaf(Object node) { - return getChildCount(node) == 0; - } - - public void valueForPathChanged(TreePath path, Object newValue) { - - } - - public int getIndexOfChild(Object parent, Object child) { - int i = -1; - for (TreePart tp : pathList) { - if (tp.path.matches(Pattern.quote(((TreePart) parent).path) + "\\.[^\\.]+")) { - i++; - if (tp.equals(child)) { - return i; - } - } - } - return i; - } - - public void addTreeModelListener(TreeModelListener l) { - - } - - public void removeTreeModelListener(TreeModelListener l) { - - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.gui; + +import com.jpexs.asdec.abc.ABC; + +import javax.swing.event.TreeModelListener; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.regex.Pattern; + + +public class ClassesListTreeModel implements TreeModel { + private ABC abc; + private List pathList = new ArrayList(); + + public ClassesListTreeModel(ABC abc) { + this.abc = abc; + for (int i = 0; i < abc.instance_info.length; i++) { + String packageName = abc.instance_info[i].getName(abc.constants).getNamespace(abc.constants).getName(abc.constants); + String className = abc.instance_info[i].getName(abc.constants).getName(abc.constants); + String full = packageName + "." + className; + String parts[] = full.split("\\."); + String s = ""; + for (int j = 0; j < parts.length; j++) { + if (!s.endsWith(".")) s += "."; + s += parts[j]; + TreePart tp = new TreePart(s, parts[j], j < parts.length - 1 ? -1 : i); + if (!pathList.contains(tp)) { + pathList.add(tp); + } + } + } + for (int k1 = 0; k1 < pathList.size(); k1++) { + TreePart tp1 = pathList.get(k1); + for (int k2 = 0; k2 < pathList.size(); k2++) { + if (k1 == k2) continue; + TreePart tp2 = pathList.get(k2); + if (!tp1.path.equals(tp2.path)) { + if (tp1.path.startsWith(tp2.path + ".")) { + tp2.hasSubParts = true; + } + if (tp2.path.startsWith(tp1.path + ".")) { + tp1.hasSubParts = true; + } + } + } + } + Collections.sort(pathList); + } + + + public Object getRoot() { + return new TreePart("", "", -1); + } + + public Object getChild(Object parent, int index) { + int i = -1; + for (TreePart tp : pathList) { + if (tp.path.matches(Pattern.quote(((TreePart) parent).path) + "\\.[^\\.]+")) { + i++; + if (i == index) { + return tp; + } + } + } + return null; + } + + public int getChildCount(Object parent) { + int i = 0; + for (TreePart tp : pathList) { + if (tp.path.matches(Pattern.quote(((TreePart) parent).path) + "\\.[^\\.]+")) { + i++; + } + } + return i; + } + + public boolean isLeaf(Object node) { + return getChildCount(node) == 0; + } + + public void valueForPathChanged(TreePath path, Object newValue) { + + } + + public int getIndexOfChild(Object parent, Object child) { + int i = -1; + for (TreePart tp : pathList) { + if (tp.path.matches(Pattern.quote(((TreePart) parent).path) + "\\.[^\\.]+")) { + i++; + if (tp.equals(child)) { + return i; + } + } + } + return i; + } + + public void addTreeModelListener(TreeModelListener l) { + + } + + public void removeTreeModelListener(TreeModelListener l) { + + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/ConstantsListModel.java b/trunk/src/com/jpexs/asdec/abc/gui/ConstantsListModel.java index a4a73e734..46ee37a95 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/ConstantsListModel.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/ConstantsListModel.java @@ -1,85 +1,99 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.gui; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.helpers.Helper; - -import javax.swing.*; -import javax.swing.event.ListDataListener; - - -public class ConstantsListModel implements ListModel { - private ConstantPool constants; - - public static final int TYPE_UINT = 0; - public static final int TYPE_INT = 1; - public static final int TYPE_DOUBLE = 2; - public static final int TYPE_STRING = 3; - public static final int TYPE_NAMESPACE = 4; - public static final int TYPE_NAMESPACESET = 5; - public static final int TYPE_MULTINAME = 6; - private int type = TYPE_INT; - - public ConstantsListModel(ConstantPool constants, int type) { - this.type = type; - this.constants = constants; - } - - - private int makeUp(int i) { - if (i < 0) return 0; - return i; - } - - public int getSize() { - switch (type) { - case TYPE_UINT: - return makeUp(constants.constant_uint.length - 1); - case TYPE_INT: - return makeUp(constants.constant_int.length - 1); - case TYPE_DOUBLE: - return makeUp(constants.constant_double.length - 1); - case TYPE_STRING: - return makeUp(constants.constant_string.length - 1); - case TYPE_NAMESPACE: - return makeUp(constants.constant_namespace.length - 1); - case TYPE_NAMESPACESET: - return makeUp(constants.constant_namespace_set.length - 1); - case TYPE_MULTINAME: - return makeUp(constants.constant_multiname.length - 1); - } - return 0; - } - - public Object getElementAt(int index) { - switch (type) { - case TYPE_UINT: - return "" + (index + 1) + ":" + constants.constant_uint[index + 1]; - case TYPE_INT: - return "" + (index + 1) + ":" + constants.constant_int[index + 1]; - case TYPE_DOUBLE: - return "" + (index + 1) + ":" + constants.constant_double[index + 1]; - case TYPE_STRING: - return "" + (index + 1) + ":" + Helper.escapeString(constants.constant_string[index + 1]); - case TYPE_NAMESPACE: - return "" + (index + 1) + ":" + constants.constant_namespace[index + 1].getNameWithKind(constants); - case TYPE_NAMESPACESET: - return "" + (index + 1) + ":" + constants.constant_namespace_set[index + 1].toString(constants); - case TYPE_MULTINAME: - return "" + (index + 1) + ":" + constants.constant_multiname[index + 1].toString(constants); - } - return null; - } - - public void addListDataListener(ListDataListener l) { - - } - - public void removeListDataListener(ListDataListener l) { - - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.gui; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.helpers.Helper; + +import javax.swing.*; +import javax.swing.event.ListDataListener; + + +public class ConstantsListModel implements ListModel { + private ConstantPool constants; + + public static final int TYPE_UINT = 0; + public static final int TYPE_INT = 1; + public static final int TYPE_DOUBLE = 2; + public static final int TYPE_STRING = 3; + public static final int TYPE_NAMESPACE = 4; + public static final int TYPE_NAMESPACESET = 5; + public static final int TYPE_MULTINAME = 6; + private int type = TYPE_INT; + + public ConstantsListModel(ConstantPool constants, int type) { + this.type = type; + this.constants = constants; + } + + + private int makeUp(int i) { + if (i < 0) return 0; + return i; + } + + public int getSize() { + switch (type) { + case TYPE_UINT: + return makeUp(constants.constant_uint.length - 1); + case TYPE_INT: + return makeUp(constants.constant_int.length - 1); + case TYPE_DOUBLE: + return makeUp(constants.constant_double.length - 1); + case TYPE_STRING: + return makeUp(constants.constant_string.length - 1); + case TYPE_NAMESPACE: + return makeUp(constants.constant_namespace.length - 1); + case TYPE_NAMESPACESET: + return makeUp(constants.constant_namespace_set.length - 1); + case TYPE_MULTINAME: + return makeUp(constants.constant_multiname.length - 1); + } + return 0; + } + + public Object getElementAt(int index) { + switch (type) { + case TYPE_UINT: + return "" + (index + 1) + ":" + constants.constant_uint[index + 1]; + case TYPE_INT: + return "" + (index + 1) + ":" + constants.constant_int[index + 1]; + case TYPE_DOUBLE: + return "" + (index + 1) + ":" + constants.constant_double[index + 1]; + case TYPE_STRING: + return "" + (index + 1) + ":" + Helper.escapeString(constants.constant_string[index + 1]); + case TYPE_NAMESPACE: + return "" + (index + 1) + ":" + constants.constant_namespace[index + 1].getNameWithKind(constants); + case TYPE_NAMESPACESET: + return "" + (index + 1) + ":" + constants.constant_namespace_set[index + 1].toString(constants); + case TYPE_MULTINAME: + return "" + (index + 1) + ":" + constants.constant_multiname[index + 1].toString(constants); + } + return null; + } + + public void addListDataListener(ListDataListener l) { + + } + + public void removeListDataListener(ListDataListener l) { + + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/DecompiledEditorPane.java b/trunk/src/com/jpexs/asdec/abc/gui/DecompiledEditorPane.java index 1c5244f11..3d0f9df23 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/DecompiledEditorPane.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/DecompiledEditorPane.java @@ -1,154 +1,168 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.gui; - -import com.jpexs.asdec.Main; -import com.jpexs.asdec.abc.ABC; -import com.jpexs.asdec.abc.avm2.ConvertException; -import com.jpexs.asdec.helpers.Highlighting; - -import javax.swing.*; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - - -public class DecompiledEditorPane extends JEditorPane implements MouseListener { - - private List highlights = new ArrayList(); - private List traitHighlights = new ArrayList(); - private ABC abc; - private int classIndex; - public int lastTraitIndex = 0; - - private class BufferedClass { - - public String text; - public List highlights; - public List traitHighlights; - - public BufferedClass(String text, List highlights, List traitHighlights) { - this.text = text; - this.highlights = highlights; - this.traitHighlights = traitHighlights; - } - } - - private HashMap bufferedClasses = new HashMap(); - - public void gotoLastTrait() { - gotoTrait(lastTraitIndex); - } - - public void gotoTrait(int traitId) { - for (Highlighting th : traitHighlights) { - if (th.offset == traitId) { - setCaretPosition(th.startPos + th.len - 1); - setCaretPosition(th.startPos); - break; - } - } - int mi = abc.findMethodIdByTraitId(classIndex, traitId); - int bi = abc.findBodyIndex(mi); - if (bi == -1) { - Main.abcMainFrame.sourceTextArea.setText(""); - return; - } - if (Main.abcMainFrame.sourceTextArea.bodyIndex != bi) { - Main.abcMainFrame.sourceTextArea.setBodyIndex(bi, abc); - } - } - - public DecompiledEditorPane() { - /*setFont(new Font("Courier new", Font.PLAIN, 16)); - setBackground(new Color(0, 0, 0x80)); - setForeground(Color.white); - setCaretColor(Color.white);*/ - addMouseListener(this); - setEditable(false); - } - - public void setClassIndex(int index, ABC abc) { - setText("//Please wait..."); - - String hilightedCode = ""; - if (!bufferedClasses.containsKey(index)) { - hilightedCode = abc.classToString(index, true); - highlights = Highlighting.getInstrHighlights(hilightedCode); - traitHighlights = Highlighting.getTraitHighlights(hilightedCode); - hilightedCode = Highlighting.stripHilights(hilightedCode); - bufferedClasses.put(index, new BufferedClass(hilightedCode, highlights, traitHighlights)); - } else { - BufferedClass bc = bufferedClasses.get(index); - hilightedCode = bc.text; - highlights = bc.highlights; - traitHighlights = bc.traitHighlights; - } - setText(hilightedCode); - this.abc = abc; - classIndex = index; - } - - public void reloadClass() { - if (bufferedClasses.containsKey(classIndex)) { - bufferedClasses.remove(classIndex); - } - setClassIndex(classIndex, abc); - } - - public void setABC(ABC abc) { - this.abc = abc; - bufferedClasses.clear(); - setText(""); - } - - public void mouseClicked(MouseEvent e) { - } - - public void mousePressed(MouseEvent e) { - int pos = getCaretPosition(); - for (Highlighting th : traitHighlights) { - if ((pos >= th.startPos) && (pos < th.startPos + th.len)) { - - int bi = abc.findBodyIndex(abc.findMethodIdByTraitId(classIndex, (int) th.offset)); - if (bi == -1) { - Main.abcMainFrame.sourceTextArea.setText(""); - break; - } - lastTraitIndex = (int) th.offset; - if (Main.abcMainFrame.sourceTextArea.bodyIndex != bi) { - /*try { - abc.bodies[bi].code.clearCode(abc.constants, abc.bodies[bi]); - } catch (ConvertException ex) { - Logger.getLogger(DecompiledEditorPane.class.getName()).log(Level.SEVERE, null, ex); - }*/ - Main.abcMainFrame.sourceTextArea.setBodyIndex(bi, abc); - } - for (Highlighting h : highlights) { - if ((pos >= h.startPos) && (pos < h.startPos + h.len)) { - try { - Main.abcMainFrame.sourceTextArea.selectInstruction(abc.bodies[bi].code.adr2pos(h.offset)); - - } catch (ConvertException ex) { - } - break; - } - } - } - } - - } - - public void mouseReleased(MouseEvent e) { - } - - public void mouseEntered(MouseEvent e) { - } - - public void mouseExited(MouseEvent e) { - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.gui; + +import com.jpexs.asdec.Main; +import com.jpexs.asdec.abc.ABC; +import com.jpexs.asdec.abc.avm2.ConvertException; +import com.jpexs.asdec.helpers.Highlighting; + +import javax.swing.*; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + + +public class DecompiledEditorPane extends JEditorPane implements MouseListener { + + private List highlights = new ArrayList(); + private List traitHighlights = new ArrayList(); + private ABC abc; + private int classIndex; + public int lastTraitIndex = 0; + + private class BufferedClass { + + public String text; + public List highlights; + public List traitHighlights; + + public BufferedClass(String text, List highlights, List traitHighlights) { + this.text = text; + this.highlights = highlights; + this.traitHighlights = traitHighlights; + } + } + + private HashMap bufferedClasses = new HashMap(); + + public void gotoLastTrait() { + gotoTrait(lastTraitIndex); + } + + public void gotoTrait(int traitId) { + for (Highlighting th : traitHighlights) { + if (th.offset == traitId) { + setCaretPosition(th.startPos + th.len - 1); + setCaretPosition(th.startPos); + break; + } + } + int mi = abc.findMethodIdByTraitId(classIndex, traitId); + int bi = abc.findBodyIndex(mi); + if (bi == -1) { + Main.abcMainFrame.sourceTextArea.setText(""); + return; + } + if (Main.abcMainFrame.sourceTextArea.bodyIndex != bi) { + Main.abcMainFrame.sourceTextArea.setBodyIndex(bi, abc); + } + } + + public DecompiledEditorPane() { + /*setFont(new Font("Courier new", Font.PLAIN, 16)); + setBackground(new Color(0, 0, 0x80)); + setForeground(Color.white); + setCaretColor(Color.white);*/ + addMouseListener(this); + setEditable(false); + } + + public void setClassIndex(int index, ABC abc) { + setText("//Please wait..."); + + String hilightedCode = ""; + if (!bufferedClasses.containsKey(index)) { + hilightedCode = abc.classToString(index, true); + highlights = Highlighting.getInstrHighlights(hilightedCode); + traitHighlights = Highlighting.getTraitHighlights(hilightedCode); + hilightedCode = Highlighting.stripHilights(hilightedCode); + bufferedClasses.put(index, new BufferedClass(hilightedCode, highlights, traitHighlights)); + } else { + BufferedClass bc = bufferedClasses.get(index); + hilightedCode = bc.text; + highlights = bc.highlights; + traitHighlights = bc.traitHighlights; + } + setText(hilightedCode); + this.abc = abc; + classIndex = index; + } + + public void reloadClass() { + if (bufferedClasses.containsKey(classIndex)) { + bufferedClasses.remove(classIndex); + } + setClassIndex(classIndex, abc); + } + + public void setABC(ABC abc) { + this.abc = abc; + bufferedClasses.clear(); + setText(""); + } + + public void mouseClicked(MouseEvent e) { + } + + public void mousePressed(MouseEvent e) { + int pos = getCaretPosition(); + for (Highlighting th : traitHighlights) { + if ((pos >= th.startPos) && (pos < th.startPos + th.len)) { + + int bi = abc.findBodyIndex(abc.findMethodIdByTraitId(classIndex, (int) th.offset)); + if (bi == -1) { + Main.abcMainFrame.sourceTextArea.setText(""); + break; + } + lastTraitIndex = (int) th.offset; + if (Main.abcMainFrame.sourceTextArea.bodyIndex != bi) { + /*try { + abc.bodies[bi].code.clearCode(abc.constants, abc.bodies[bi]); + } catch (ConvertException ex) { + Logger.getLogger(DecompiledEditorPane.class.getName()).log(Level.SEVERE, null, ex); + }*/ + Main.abcMainFrame.sourceTextArea.setBodyIndex(bi, abc); + } + for (Highlighting h : highlights) { + if ((pos >= h.startPos) && (pos < h.startPos + h.len)) { + try { + Main.abcMainFrame.sourceTextArea.selectInstruction(abc.bodies[bi].code.adr2pos(h.offset)); + + } catch (ConvertException ex) { + } + break; + } + } + } + } + + } + + public void mouseReleased(MouseEvent e) { + } + + public void mouseEntered(MouseEvent e) { + } + + public void mouseExited(MouseEvent e) { + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/DialogMissingSymbolHandler.java b/trunk/src/com/jpexs/asdec/abc/gui/DialogMissingSymbolHandler.java index ea519dd5b..8190909d1 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/DialogMissingSymbolHandler.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/DialogMissingSymbolHandler.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.gui; - -import com.jpexs.asdec.abc.avm2.parser.MissingSymbolHandler; - -import javax.swing.*; - - -public class DialogMissingSymbolHandler implements MissingSymbolHandler { - - public boolean missingString(String value) { - return JOptionPane.showConfirmDialog(null, "String \"" + value + "\" is not present in constants table. Do you want to add it?", "Add String", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; - } - - public boolean missingInt(long value) { - return JOptionPane.showConfirmDialog(null, "Integer value \"" + value + "\" is not present in constants table. Do you want to add it?", "Add Integer", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; - } - - public boolean missingUInt(long value) { - return JOptionPane.showConfirmDialog(null, "Unsigned integer value \"" + value + "\" is not present in constants table. Do you want to add it?", "Add Unsigned integer", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; - } - - public boolean missingDouble(double value) { - return JOptionPane.showConfirmDialog(null, "Double value \"" + value + "\" is not present in constants table. Do you want to add it?", "Add Double", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.gui; + +import com.jpexs.asdec.abc.avm2.parser.MissingSymbolHandler; + +import javax.swing.*; + + +public class DialogMissingSymbolHandler implements MissingSymbolHandler { + + public boolean missingString(String value) { + return JOptionPane.showConfirmDialog(null, "String \"" + value + "\" is not present in constants table. Do you want to add it?", "Add String", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; + } + + public boolean missingInt(long value) { + return JOptionPane.showConfirmDialog(null, "Integer value \"" + value + "\" is not present in constants table. Do you want to add it?", "Add Integer", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; + } + + public boolean missingUInt(long value) { + return JOptionPane.showConfirmDialog(null, "Unsigned integer value \"" + value + "\" is not present in constants table. Do you want to add it?", "Add Unsigned integer", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; + } + + public boolean missingDouble(double value) { + return JOptionPane.showConfirmDialog(null, "Double value \"" + value + "\" is not present in constants table. Do you want to add it?", "Add Double", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION; + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/IconListRenderer.java b/trunk/src/com/jpexs/asdec/abc/gui/IconListRenderer.java index cd28dea4d..ade974e38 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/IconListRenderer.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/IconListRenderer.java @@ -1,59 +1,73 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.gui; - -import javax.swing.*; -import java.awt.*; - - -public class IconListRenderer - extends DefaultListCellRenderer { - - private Icon constIcon; - private Icon functionIcon; - private Icon variableIcon; - - private Icon loadIcon(String path) { - ClassLoader cldr = this.getClass().getClassLoader(); - java.net.URL imageURL = cldr.getResource(path); - return new ImageIcon(imageURL); - } - - public IconListRenderer() { - constIcon = loadIcon("com/jpexs/asdec/abc/gui/graphics/constant.png"); - functionIcon = loadIcon("com/jpexs/asdec/abc/gui/graphics/function.png"); - variableIcon = loadIcon("com/jpexs/asdec/abc/gui/graphics/variable.png"); - } - - @Override - public Component getListCellRendererComponent( - JList list, Object value, int index, - boolean isSelected, boolean cellHasFocus) { - - // Get the renderer component from parent class - - JLabel label = - (JLabel) super.getListCellRendererComponent(list, - value, index, isSelected, cellHasFocus); - - // Get icon to use for the list item value - - String modifiersRegex = "(public |static |final |override |private |protected |package )*"; - - if (value.toString().matches(modifiersRegex + "const .*")) - label.setIcon(constIcon); - if (value.toString().matches(modifiersRegex + "var .*")) - label.setIcon(variableIcon); - if (value.toString().matches(modifiersRegex + "function .*")) - label.setIcon(functionIcon); - if (value.toString().equals(TraitsListModel.STR_CLASS_INITIALIZER)) - label.setIcon(functionIcon); - if (value.toString().equals(TraitsListModel.STR_INSTANCE_INITIALIZER)) - label.setIcon(functionIcon); - return label; - } - -} - +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.gui; + +import javax.swing.*; +import java.awt.*; + + +public class IconListRenderer + extends DefaultListCellRenderer { + + private Icon constIcon; + private Icon functionIcon; + private Icon variableIcon; + + private Icon loadIcon(String path) { + ClassLoader cldr = this.getClass().getClassLoader(); + java.net.URL imageURL = cldr.getResource(path); + return new ImageIcon(imageURL); + } + + public IconListRenderer() { + constIcon = loadIcon("com/jpexs/asdec/abc/gui/graphics/constant.png"); + functionIcon = loadIcon("com/jpexs/asdec/abc/gui/graphics/function.png"); + variableIcon = loadIcon("com/jpexs/asdec/abc/gui/graphics/variable.png"); + } + + @Override + public Component getListCellRendererComponent( + JList list, Object value, int index, + boolean isSelected, boolean cellHasFocus) { + + // Get the renderer component from parent class + + JLabel label = + (JLabel) super.getListCellRendererComponent(list, + value, index, isSelected, cellHasFocus); + + // Get icon to use for the list item value + + String modifiersRegex = "(public |static |final |override |private |protected |package )*"; + + if (value.toString().matches(modifiersRegex + "const .*")) + label.setIcon(constIcon); + if (value.toString().matches(modifiersRegex + "var .*")) + label.setIcon(variableIcon); + if (value.toString().matches(modifiersRegex + "function .*")) + label.setIcon(functionIcon); + if (value.toString().equals(TraitsListModel.STR_CLASS_INITIALIZER)) + label.setIcon(functionIcon); + if (value.toString().equals(TraitsListModel.STR_INSTANCE_INITIALIZER)) + label.setIcon(functionIcon); + return label; + } + +} + diff --git a/trunk/src/com/jpexs/asdec/abc/gui/MainFrame.java b/trunk/src/com/jpexs/asdec/abc/gui/MainFrame.java index 469f80626..c84c1fdfe 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/MainFrame.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/MainFrame.java @@ -1,380 +1,394 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.gui; - -import com.jpexs.asdec.Main; -import com.jpexs.asdec.abc.ABC; -import com.jpexs.asdec.abc.gui.tablemodels.*; -import com.jpexs.asdec.gui.LoadingPanel; -import com.jpexs.asdec.gui.View; -import com.jpexs.asdec.tags.DoABCTag; -import jsyntaxpane.DefaultSyntaxKit; - -import javax.swing.*; -import javax.swing.border.BevelBorder; -import javax.swing.table.*; -import java.awt.*; -import java.awt.event.*; -import java.io.IOException; -import java.util.List; - - -public class MainFrame extends JFrame implements ActionListener, ItemListener { - - public ASMSourceEditorPane sourceTextArea; - public TraitsList navigator; - public ClassesListTree classTree; - public ABC abc; - public List list; - public JComboBox abcComboBox; - public int listIndex = 0; - public DecompiledEditorPane decompiledTextArea; - public JScrollPane decompiledScrollPane; - public JSplitPane splitPane1; - public JSplitPane splitPane2; - public JSplitPane splitPane3; - //private ConstantsListModel constantListModel; - private JTable constantTable; - //private JList constantsList; - public JComboBox constantTypeList; - public JPanel statusPanel = new JPanel(); - public LoadingPanel loadingPanel = new LoadingPanel(20, 20); - public JLabel statusLabel = new JLabel(""); - public JLabel asmLabel = new JLabel("P-code source (editable)"); - public JLabel decLabel = new JLabel("ActionScript source"); - - public void setStatus(String s) { - if (s.equals("")) { - loadingPanel.setVisible(false); - } else { - loadingPanel.setVisible(true); - } - statusLabel.setText(s); - } - - - public JTable autoResizeColWidth(JTable table, TableModel model) { - table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - table.setModel(model); - - int margin = 5; - - for (int i = 0; i < table.getColumnCount(); i++) { - int vColIndex = i; - DefaultTableColumnModel colModel = (DefaultTableColumnModel) table.getColumnModel(); - TableColumn col = colModel.getColumn(vColIndex); - int width = 0; - - // Get width of column header - TableCellRenderer renderer = col.getHeaderRenderer(); - - if (renderer == null) { - renderer = table.getTableHeader().getDefaultRenderer(); - } - - Component comp = renderer.getTableCellRendererComponent(table, col.getHeaderValue(), false, false, 0, 0); - - width = comp.getPreferredSize().width; - - // Get maximum width of column data - for (int r = 0; r < table.getRowCount(); r++) { - renderer = table.getCellRenderer(r, vColIndex); - comp = renderer.getTableCellRendererComponent(table, table.getValueAt(r, vColIndex), false, false, - r, vColIndex); - width = Math.max(width, comp.getPreferredSize().width); - } - - // Add margin - width += 2 * margin; - - // Set the width - col.setPreferredWidth(width); - } - - ((DefaultTableCellRenderer) table.getTableHeader().getDefaultRenderer()).setHorizontalAlignment( - SwingConstants.LEFT); - - // table.setAutoCreateRowSorter(true); - table.getTableHeader().setReorderingAllowed(false); - - return table; - } - - public void updateConstList() { - switch (constantTypeList.getSelectedIndex()) { - case 0: - autoResizeColWidth(constantTable, new UIntTableModel(abc)); - break; - case 1: - autoResizeColWidth(constantTable, new IntTableModel(abc)); - break; - case 2: - autoResizeColWidth(constantTable, new DoubleTableModel(abc)); - break; - case 3: - autoResizeColWidth(constantTable, new StringTableModel(abc)); - break; - case 4: - autoResizeColWidth(constantTable, new NamespaceTableModel(abc)); - break; - case 5: - autoResizeColWidth(constantTable, new NamespaceSetTableModel(abc)); - break; - case 6: - autoResizeColWidth(constantTable, new MultinameTableModel(abc)); - break; - } - //DefaultTableColumnModel colModel = (DefaultTableColumnModel) constantTable.getColumnModel(); - //colModel.getColumn(0).setMaxWidth(50); - } - - public void switchAbc(int index) { - listIndex = index; - this.abc = list.get(listIndex).abc; - classTree.setABC(abc); - decompiledTextArea.setABC(abc); - navigator.setABC(abc); - //constantTypeList = new JComboBox(new String[]{"UINT", "INT", "DOUBLE", "STRING", "NAMESPACE", "NAMESPACESET", "MULTINAME"}); - updateConstList(); - - } - - - public MainFrame(List list) { - - View.setWindowIcon(this); - - DefaultSyntaxKit.initKit(); - - this.list = list; - setSize(800, 600); - this.abc = list.get(listIndex).abc; - getContentPane().setLayout(new BorderLayout()); - sourceTextArea = new ASMSourceEditorPane(); - - JPanel rightPanel = new JPanel(); - rightPanel.setLayout(new BorderLayout()); - rightPanel.add(new JScrollPane(sourceTextArea), BorderLayout.CENTER); - sourceTextArea.setContentType("text/flasm3"); - JPanel buttonsPan = new JPanel(); - buttonsPan.setLayout(new FlowLayout()); - JButton verifyButton = new JButton("Verify"); - verifyButton.setActionCommand("VERIFYBODY"); - verifyButton.addActionListener(this); - - JButton saveButton = new JButton("Save"); - saveButton.setActionCommand("SAVEBODY"); - saveButton.addActionListener(this); - - - buttonsPan.add(saveButton); - rightPanel.add(buttonsPan, BorderLayout.SOUTH); - decompiledTextArea = new DecompiledEditorPane(); - - decompiledScrollPane = new JScrollPane(decompiledTextArea); - - JPanel panA = new JPanel(); - panA.setLayout(new BorderLayout()); - panA.add(rightPanel, BorderLayout.CENTER); - panA.add(asmLabel, BorderLayout.NORTH); - - asmLabel.setHorizontalAlignment(SwingConstants.CENTER); - asmLabel.setBorder(new BevelBorder(BevelBorder.RAISED)); - JPanel panB = new JPanel(); - panB.setLayout(new BorderLayout()); - panB.add(decompiledScrollPane, BorderLayout.CENTER); - panB.add(decLabel, BorderLayout.NORTH); - decLabel.setHorizontalAlignment(SwingConstants.CENTER); - decLabel.setBorder(new BevelBorder(BevelBorder.RAISED)); - splitPane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, - panB, panA); - decompiledTextArea.setContentType("text/actionscript"); - - JPanel pan2 = new JPanel(); - pan2.setLayout(new BorderLayout()); - pan2.add((abcComboBox = new JComboBox(new ABCComboBoxModel(list))), BorderLayout.NORTH); - - navigator = new TraitsList(); - navigator.setABC(abc); - - JTabbedPane tabbedPane = new JTabbedPane(); - tabbedPane.addTab("Traits", new JScrollPane(navigator)); - splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, - new JScrollPane(classTree = new ClassesListTree(abc)), - tabbedPane); - - pan2.add(splitPane2, BorderLayout.CENTER); - abcComboBox.addItemListener(this); - - - splitPane3 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, - pan2, - splitPane1); - - pan2.setPreferredSize(new Dimension(300, 200)); - - - loadingPanel.setPreferredSize(new Dimension(30, 30)); - statusPanel = new JPanel(); - statusPanel.setPreferredSize(new Dimension(1, 30)); - statusPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); - statusPanel.setLayout(new BorderLayout()); - statusPanel.add(loadingPanel, BorderLayout.WEST); - statusPanel.add(statusLabel, BorderLayout.CENTER); - loadingPanel.setVisible(false); - - - getContentPane().add(splitPane3, BorderLayout.CENTER); - getContentPane().add(statusPanel, BorderLayout.SOUTH); - addWindowListener(new WindowAdapter() { - - @Override - public void windowClosing(WindowEvent e) { - if (Main.proxyFrame != null) { - if (Main.proxyFrame.isVisible()) return; - } - Main.exit(); - } - }); - setTitle(Main.applicationName + " - " + Main.getFileTitle()); - - JMenuBar menuBar = new JMenuBar(); - - JMenu menuFile = new JMenu("File"); - JMenuItem miOpen = new JMenuItem("Open..."); - miOpen.setActionCommand("OPEN"); - miOpen.addActionListener(this); - JMenuItem miSave = new JMenuItem("Save"); - miSave.setActionCommand("SAVE"); - miSave.addActionListener(this); - JMenuItem miSaveAs = new JMenuItem("Save as..."); - miSaveAs.setActionCommand("SAVEAS"); - miSaveAs.addActionListener(this); - JMenuItem miExport = new JMenuItem("Export..."); - miExport.setActionCommand("EXPORT"); - miExport.addActionListener(this); - menuFile.add(miOpen); - menuFile.add(miSave); - menuFile.add(miSaveAs); - menuFile.add(miExport); - menuFile.addSeparator(); - JMenuItem miClose = new JMenuItem("Exit"); - miClose.setActionCommand("EXIT"); - miClose.addActionListener(this); - menuFile.add(miClose); - menuBar.add(menuFile); - - JMenu menuTools = new JMenu("Tools"); - JMenuItem miProxy = new JMenuItem("Proxy"); - miProxy.setActionCommand("SHOWPROXY"); - miProxy.setIcon(new ImageIcon(View.loadImage("com/jpexs/asdec/gui/graphics/proxy16.png"))); - miProxy.addActionListener(this); - menuTools.add(miProxy); - menuBar.add(menuTools); - - setJMenuBar(menuBar); - - /* Constants */ - JPanel panConstants = new JPanel(); - panConstants.setLayout(new BorderLayout()); - constantTypeList = new JComboBox(new String[]{"UINT", "INT", "DOUBLE", "STRING", "NAMESPACE", "NAMESPACESET", "MULTINAME"}); - constantTable = new JTable(); - autoResizeColWidth(constantTable, new UIntTableModel(abc)); - constantTable.setAutoCreateRowSorter(true); - constantTypeList.addItemListener(this); - panConstants.add(constantTypeList, BorderLayout.NORTH); - panConstants.add(new JScrollPane(constantTable), BorderLayout.CENTER); - tabbedPane.addTab("Constants", panConstants); - View.centerScreen(this); - - } - - public void actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals("EXIT")) { - setVisible(false); - if (Main.proxyFrame != null) { - if (Main.proxyFrame.isVisible()) return; - } - Main.exit(); - } - if (Main.isWorking()) return; - if (e.getActionCommand().equals("SHOWPROXY")) { - Main.showProxy(); - } - if (e.getActionCommand().equals("VERIFYBODY")) { - sourceTextArea.verify(abc.constants, abc); - } - if (e.getActionCommand().equals("SAVEBODY")) { - sourceTextArea.save(abc.constants); - } - if (e.getActionCommand().equals("SAVE")) { - try { - Main.saveFile(Main.file); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - if (e.getActionCommand().equals("SAVEAS")) { - if (Main.saveFileDialog(this)) { - setTitle(Main.applicationName + " - " + Main.getFileTitle()); - } - } - if (e.getActionCommand().equals("OPEN")) { - Main.openFileDialog(); - - } - - if (e.getActionCommand().equals("EXPORT")) { - JFileChooser chooser = new JFileChooser(); - chooser.setCurrentDirectory(new java.io.File(".")); - chooser.setDialogTitle("Select directory to export"); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - chooser.setAcceptAllFileFilterUsed(false); - if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { - Main.startWork("Exporting..."); - final String selFile = chooser.getSelectedFile().getAbsolutePath(); - (new Thread() { - - @Override - public void run() { - try { - for (DoABCTag tag : list) { - tag.abc.export(selFile); - } - } catch (IOException ignored) { - JOptionPane.showMessageDialog(null, "Cannot write to the file"); - } - Main.stopWork(); - } - }).start(); - - } - - } - } - - public void itemStateChanged(ItemEvent e) { - if (e.getSource() == abcComboBox) { - int index = ((JComboBox) e.getSource()).getSelectedIndex(); - if (index == -1) { - return; - } - switchAbc(index); - } - if (e.getSource() == constantTypeList) { - int index = ((JComboBox) e.getSource()).getSelectedIndex(); - if (index == -1) { - return; - } - updateConstList(); - } - } - - public void display() { - setVisible(true); - splitPane2.setDividerLocation(0.5); - splitPane1.setDividerLocation(0.5); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.gui; + +import com.jpexs.asdec.Main; +import com.jpexs.asdec.abc.ABC; +import com.jpexs.asdec.abc.gui.tablemodels.*; +import com.jpexs.asdec.gui.LoadingPanel; +import com.jpexs.asdec.gui.View; +import com.jpexs.asdec.tags.DoABCTag; +import jsyntaxpane.DefaultSyntaxKit; + +import javax.swing.*; +import javax.swing.border.BevelBorder; +import javax.swing.table.*; +import java.awt.*; +import java.awt.event.*; +import java.io.IOException; +import java.util.List; + + +public class MainFrame extends JFrame implements ActionListener, ItemListener { + + public ASMSourceEditorPane sourceTextArea; + public TraitsList navigator; + public ClassesListTree classTree; + public ABC abc; + public List list; + public JComboBox abcComboBox; + public int listIndex = 0; + public DecompiledEditorPane decompiledTextArea; + public JScrollPane decompiledScrollPane; + public JSplitPane splitPane1; + public JSplitPane splitPane2; + public JSplitPane splitPane3; + //private ConstantsListModel constantListModel; + private JTable constantTable; + //private JList constantsList; + public JComboBox constantTypeList; + public JPanel statusPanel = new JPanel(); + public LoadingPanel loadingPanel = new LoadingPanel(20, 20); + public JLabel statusLabel = new JLabel(""); + public JLabel asmLabel = new JLabel("P-code source (editable)"); + public JLabel decLabel = new JLabel("ActionScript source"); + + public void setStatus(String s) { + if (s.equals("")) { + loadingPanel.setVisible(false); + } else { + loadingPanel.setVisible(true); + } + statusLabel.setText(s); + } + + + public JTable autoResizeColWidth(JTable table, TableModel model) { + table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + table.setModel(model); + + int margin = 5; + + for (int i = 0; i < table.getColumnCount(); i++) { + int vColIndex = i; + DefaultTableColumnModel colModel = (DefaultTableColumnModel) table.getColumnModel(); + TableColumn col = colModel.getColumn(vColIndex); + int width = 0; + + // Get width of column header + TableCellRenderer renderer = col.getHeaderRenderer(); + + if (renderer == null) { + renderer = table.getTableHeader().getDefaultRenderer(); + } + + Component comp = renderer.getTableCellRendererComponent(table, col.getHeaderValue(), false, false, 0, 0); + + width = comp.getPreferredSize().width; + + // Get maximum width of column data + for (int r = 0; r < table.getRowCount(); r++) { + renderer = table.getCellRenderer(r, vColIndex); + comp = renderer.getTableCellRendererComponent(table, table.getValueAt(r, vColIndex), false, false, + r, vColIndex); + width = Math.max(width, comp.getPreferredSize().width); + } + + // Add margin + width += 2 * margin; + + // Set the width + col.setPreferredWidth(width); + } + + ((DefaultTableCellRenderer) table.getTableHeader().getDefaultRenderer()).setHorizontalAlignment( + SwingConstants.LEFT); + + // table.setAutoCreateRowSorter(true); + table.getTableHeader().setReorderingAllowed(false); + + return table; + } + + public void updateConstList() { + switch (constantTypeList.getSelectedIndex()) { + case 0: + autoResizeColWidth(constantTable, new UIntTableModel(abc)); + break; + case 1: + autoResizeColWidth(constantTable, new IntTableModel(abc)); + break; + case 2: + autoResizeColWidth(constantTable, new DoubleTableModel(abc)); + break; + case 3: + autoResizeColWidth(constantTable, new StringTableModel(abc)); + break; + case 4: + autoResizeColWidth(constantTable, new NamespaceTableModel(abc)); + break; + case 5: + autoResizeColWidth(constantTable, new NamespaceSetTableModel(abc)); + break; + case 6: + autoResizeColWidth(constantTable, new MultinameTableModel(abc)); + break; + } + //DefaultTableColumnModel colModel = (DefaultTableColumnModel) constantTable.getColumnModel(); + //colModel.getColumn(0).setMaxWidth(50); + } + + public void switchAbc(int index) { + listIndex = index; + this.abc = list.get(listIndex).abc; + classTree.setABC(abc); + decompiledTextArea.setABC(abc); + navigator.setABC(abc); + //constantTypeList = new JComboBox(new String[]{"UINT", "INT", "DOUBLE", "STRING", "NAMESPACE", "NAMESPACESET", "MULTINAME"}); + updateConstList(); + + } + + + public MainFrame(List list) { + + View.setWindowIcon(this); + + DefaultSyntaxKit.initKit(); + + this.list = list; + setSize(800, 600); + this.abc = list.get(listIndex).abc; + getContentPane().setLayout(new BorderLayout()); + sourceTextArea = new ASMSourceEditorPane(); + + JPanel rightPanel = new JPanel(); + rightPanel.setLayout(new BorderLayout()); + rightPanel.add(new JScrollPane(sourceTextArea), BorderLayout.CENTER); + sourceTextArea.setContentType("text/flasm3"); + JPanel buttonsPan = new JPanel(); + buttonsPan.setLayout(new FlowLayout()); + JButton verifyButton = new JButton("Verify"); + verifyButton.setActionCommand("VERIFYBODY"); + verifyButton.addActionListener(this); + + JButton saveButton = new JButton("Save"); + saveButton.setActionCommand("SAVEBODY"); + saveButton.addActionListener(this); + + + buttonsPan.add(saveButton); + rightPanel.add(buttonsPan, BorderLayout.SOUTH); + decompiledTextArea = new DecompiledEditorPane(); + + decompiledScrollPane = new JScrollPane(decompiledTextArea); + + JPanel panA = new JPanel(); + panA.setLayout(new BorderLayout()); + panA.add(rightPanel, BorderLayout.CENTER); + panA.add(asmLabel, BorderLayout.NORTH); + + asmLabel.setHorizontalAlignment(SwingConstants.CENTER); + asmLabel.setBorder(new BevelBorder(BevelBorder.RAISED)); + JPanel panB = new JPanel(); + panB.setLayout(new BorderLayout()); + panB.add(decompiledScrollPane, BorderLayout.CENTER); + panB.add(decLabel, BorderLayout.NORTH); + decLabel.setHorizontalAlignment(SwingConstants.CENTER); + decLabel.setBorder(new BevelBorder(BevelBorder.RAISED)); + splitPane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, + panB, panA); + decompiledTextArea.setContentType("text/actionscript"); + + JPanel pan2 = new JPanel(); + pan2.setLayout(new BorderLayout()); + pan2.add((abcComboBox = new JComboBox(new ABCComboBoxModel(list))), BorderLayout.NORTH); + + navigator = new TraitsList(); + navigator.setABC(abc); + + JTabbedPane tabbedPane = new JTabbedPane(); + tabbedPane.addTab("Traits", new JScrollPane(navigator)); + splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, + new JScrollPane(classTree = new ClassesListTree(abc)), + tabbedPane); + + pan2.add(splitPane2, BorderLayout.CENTER); + abcComboBox.addItemListener(this); + + + splitPane3 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, + pan2, + splitPane1); + + pan2.setPreferredSize(new Dimension(300, 200)); + + + loadingPanel.setPreferredSize(new Dimension(30, 30)); + statusPanel = new JPanel(); + statusPanel.setPreferredSize(new Dimension(1, 30)); + statusPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); + statusPanel.setLayout(new BorderLayout()); + statusPanel.add(loadingPanel, BorderLayout.WEST); + statusPanel.add(statusLabel, BorderLayout.CENTER); + loadingPanel.setVisible(false); + + + getContentPane().add(splitPane3, BorderLayout.CENTER); + getContentPane().add(statusPanel, BorderLayout.SOUTH); + addWindowListener(new WindowAdapter() { + + @Override + public void windowClosing(WindowEvent e) { + if (Main.proxyFrame != null) { + if (Main.proxyFrame.isVisible()) return; + } + Main.exit(); + } + }); + setTitle(Main.applicationName + " - " + Main.getFileTitle()); + + JMenuBar menuBar = new JMenuBar(); + + JMenu menuFile = new JMenu("File"); + JMenuItem miOpen = new JMenuItem("Open..."); + miOpen.setActionCommand("OPEN"); + miOpen.addActionListener(this); + JMenuItem miSave = new JMenuItem("Save"); + miSave.setActionCommand("SAVE"); + miSave.addActionListener(this); + JMenuItem miSaveAs = new JMenuItem("Save as..."); + miSaveAs.setActionCommand("SAVEAS"); + miSaveAs.addActionListener(this); + JMenuItem miExport = new JMenuItem("Export..."); + miExport.setActionCommand("EXPORT"); + miExport.addActionListener(this); + menuFile.add(miOpen); + menuFile.add(miSave); + menuFile.add(miSaveAs); + menuFile.add(miExport); + menuFile.addSeparator(); + JMenuItem miClose = new JMenuItem("Exit"); + miClose.setActionCommand("EXIT"); + miClose.addActionListener(this); + menuFile.add(miClose); + menuBar.add(menuFile); + + JMenu menuTools = new JMenu("Tools"); + JMenuItem miProxy = new JMenuItem("Proxy"); + miProxy.setActionCommand("SHOWPROXY"); + miProxy.setIcon(new ImageIcon(View.loadImage("com/jpexs/asdec/gui/graphics/proxy16.png"))); + miProxy.addActionListener(this); + menuTools.add(miProxy); + menuBar.add(menuTools); + + setJMenuBar(menuBar); + + /* Constants */ + JPanel panConstants = new JPanel(); + panConstants.setLayout(new BorderLayout()); + constantTypeList = new JComboBox(new String[]{"UINT", "INT", "DOUBLE", "STRING", "NAMESPACE", "NAMESPACESET", "MULTINAME"}); + constantTable = new JTable(); + autoResizeColWidth(constantTable, new UIntTableModel(abc)); + constantTable.setAutoCreateRowSorter(true); + constantTypeList.addItemListener(this); + panConstants.add(constantTypeList, BorderLayout.NORTH); + panConstants.add(new JScrollPane(constantTable), BorderLayout.CENTER); + tabbedPane.addTab("Constants", panConstants); + View.centerScreen(this); + + } + + public void actionPerformed(ActionEvent e) { + if (e.getActionCommand().equals("EXIT")) { + setVisible(false); + if (Main.proxyFrame != null) { + if (Main.proxyFrame.isVisible()) return; + } + Main.exit(); + } + if (Main.isWorking()) return; + if (e.getActionCommand().equals("SHOWPROXY")) { + Main.showProxy(); + } + if (e.getActionCommand().equals("VERIFYBODY")) { + sourceTextArea.verify(abc.constants, abc); + } + if (e.getActionCommand().equals("SAVEBODY")) { + sourceTextArea.save(abc.constants); + } + if (e.getActionCommand().equals("SAVE")) { + try { + Main.saveFile(Main.file); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + if (e.getActionCommand().equals("SAVEAS")) { + if (Main.saveFileDialog(this)) { + setTitle(Main.applicationName + " - " + Main.getFileTitle()); + } + } + if (e.getActionCommand().equals("OPEN")) { + Main.openFileDialog(); + + } + + if (e.getActionCommand().equals("EXPORT")) { + JFileChooser chooser = new JFileChooser(); + chooser.setCurrentDirectory(new java.io.File(".")); + chooser.setDialogTitle("Select directory to export"); + chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + chooser.setAcceptAllFileFilterUsed(false); + if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { + Main.startWork("Exporting..."); + final String selFile = chooser.getSelectedFile().getAbsolutePath(); + (new Thread() { + + @Override + public void run() { + try { + for (DoABCTag tag : list) { + tag.abc.export(selFile); + } + } catch (IOException ignored) { + JOptionPane.showMessageDialog(null, "Cannot write to the file"); + } + Main.stopWork(); + } + }).start(); + + } + + } + } + + public void itemStateChanged(ItemEvent e) { + if (e.getSource() == abcComboBox) { + int index = ((JComboBox) e.getSource()).getSelectedIndex(); + if (index == -1) { + return; + } + switchAbc(index); + } + if (e.getSource() == constantTypeList) { + int index = ((JComboBox) e.getSource()).getSelectedIndex(); + if (index == -1) { + return; + } + updateConstList(); + } + } + + public void display() { + setVisible(true); + splitPane2.setDividerLocation(0.5); + splitPane1.setDividerLocation(0.5); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/TraitsList.java b/trunk/src/com/jpexs/asdec/abc/gui/TraitsList.java index c2e8c5899..ae00ff655 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/TraitsList.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/TraitsList.java @@ -1,45 +1,59 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.gui; - -import com.jpexs.asdec.Main; -import com.jpexs.asdec.abc.ABC; - -import javax.swing.*; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; - - -public class TraitsList extends JList implements ListSelectionListener { - ABC abc; - int classIndex = -1; - - public TraitsList() { - addListSelectionListener(this); - setCellRenderer(new IconListRenderer()); - } - - public void setABC(ABC abc) { - this.abc = abc; - if (classIndex != -1) - setModel(new TraitsListModel(abc, classIndex)); - } - - public void setClassIndex(int classIndex) { - if (abc != null) - setModel(new TraitsListModel(abc, classIndex)); - this.classIndex = classIndex; - - } - - public void valueChanged(ListSelectionEvent e) { - - int index = getSelectedIndex(); - if (index == -1) - return; - Main.abcMainFrame.decompiledTextArea.gotoTrait(index); - - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.gui; + +import com.jpexs.asdec.Main; +import com.jpexs.asdec.abc.ABC; + +import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + + +public class TraitsList extends JList implements ListSelectionListener { + ABC abc; + int classIndex = -1; + + public TraitsList() { + addListSelectionListener(this); + setCellRenderer(new IconListRenderer()); + } + + public void setABC(ABC abc) { + this.abc = abc; + if (classIndex != -1) + setModel(new TraitsListModel(abc, classIndex)); + } + + public void setClassIndex(int classIndex) { + if (abc != null) + setModel(new TraitsListModel(abc, classIndex)); + this.classIndex = classIndex; + + } + + public void valueChanged(ListSelectionEvent e) { + + int index = getSelectedIndex(); + if (index == -1) + return; + Main.abcMainFrame.decompiledTextArea.gotoTrait(index); + + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/TraitsListModel.java b/trunk/src/com/jpexs/asdec/abc/gui/TraitsListModel.java index 020da6101..ca13d67e4 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/TraitsListModel.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/TraitsListModel.java @@ -1,52 +1,66 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.gui; - -import com.jpexs.asdec.abc.ABC; - -import javax.swing.*; -import javax.swing.event.ListDataListener; - - -public class TraitsListModel implements ListModel { - ABC abc; - int classIndex; - - public static final String STR_INSTANCE_INITIALIZER = "instance initializer"; - public static final String STR_CLASS_INITIALIZER = "class initializer"; - - public TraitsListModel(ABC abc, int classIndex) { - this.abc = abc; - this.classIndex = classIndex; - } - - public int getSize() { - int cnt = abc.class_info[classIndex].static_traits.traits.length + abc.instance_info[classIndex].instance_traits.traits.length; - //if(abc.instance_info[classIndex].iinit_index!=0) cnt++; - cnt += 2; - return cnt; - } - - public Object getElementAt(int index) { - if (index < abc.class_info[classIndex].static_traits.traits.length) { - return abc.class_info[classIndex].static_traits.traits[index].convert(abc.constants, abc.method_info, true); - } else if (index < abc.class_info[classIndex].static_traits.traits.length + abc.instance_info[classIndex].instance_traits.traits.length) { - return abc.instance_info[classIndex].instance_traits.traits[index - abc.class_info[classIndex].static_traits.traits.length].convert(abc.constants, abc.method_info, false); - } else if (index == abc.class_info[classIndex].static_traits.traits.length + abc.instance_info[classIndex].instance_traits.traits.length) { - return STR_INSTANCE_INITIALIZER; - } else { - return STR_CLASS_INITIALIZER; - } - } - - public void addListDataListener(ListDataListener l) { - - } - - public void removeListDataListener(ListDataListener l) { - - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.gui; + +import com.jpexs.asdec.abc.ABC; + +import javax.swing.*; +import javax.swing.event.ListDataListener; + + +public class TraitsListModel implements ListModel { + ABC abc; + int classIndex; + + public static final String STR_INSTANCE_INITIALIZER = "instance initializer"; + public static final String STR_CLASS_INITIALIZER = "class initializer"; + + public TraitsListModel(ABC abc, int classIndex) { + this.abc = abc; + this.classIndex = classIndex; + } + + public int getSize() { + int cnt = abc.class_info[classIndex].static_traits.traits.length + abc.instance_info[classIndex].instance_traits.traits.length; + //if(abc.instance_info[classIndex].iinit_index!=0) cnt++; + cnt += 2; + return cnt; + } + + public Object getElementAt(int index) { + if (index < abc.class_info[classIndex].static_traits.traits.length) { + return abc.class_info[classIndex].static_traits.traits[index].convert(abc.constants, abc.method_info, true); + } else if (index < abc.class_info[classIndex].static_traits.traits.length + abc.instance_info[classIndex].instance_traits.traits.length) { + return abc.instance_info[classIndex].instance_traits.traits[index - abc.class_info[classIndex].static_traits.traits.length].convert(abc.constants, abc.method_info, false); + } else if (index == abc.class_info[classIndex].static_traits.traits.length + abc.instance_info[classIndex].instance_traits.traits.length) { + return STR_INSTANCE_INITIALIZER; + } else { + return STR_CLASS_INITIALIZER; + } + } + + public void addListDataListener(ListDataListener l) { + + } + + public void removeListDataListener(ListDataListener l) { + + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/TreePart.java b/trunk/src/com/jpexs/asdec/abc/gui/TreePart.java index f2fb50fed..8c7fabef2 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/TreePart.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/TreePart.java @@ -1,56 +1,70 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.gui; - - -public class TreePart implements Comparable { - - public String path; - public String name; - public int classIndex; - public boolean hasSubParts = false; - - public TreePart(String path, String name, int classIndex) { - this.path = path; - this.name = name; - this.classIndex = classIndex; - } - - @Override - public String toString() { - return name; - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final TreePart other = (TreePart) obj; - if ((this.path == null) ? (other.path != null) : !this.path.equals(other.path)) { - return false; - } - return true; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 23 * hash + (this.path != null ? this.path.hashCode() : 0); - return hash; - } - - public int compareTo(Object o) { - if (o instanceof TreePart) { - if (((TreePart) o).hasSubParts && (!hasSubParts)) return 1; - if ((!((TreePart) o).hasSubParts) && (hasSubParts)) return -1; - return (path + "." + name).compareTo(((TreePart) o).path + "." + ((TreePart) o).name); - } - return -1; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.gui; + + +public class TreePart implements Comparable { + + public String path; + public String name; + public int classIndex; + public boolean hasSubParts = false; + + public TreePart(String path, String name, int classIndex) { + this.path = path; + this.name = name; + this.classIndex = classIndex; + } + + @Override + public String toString() { + return name; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final TreePart other = (TreePart) obj; + if ((this.path == null) ? (other.path != null) : !this.path.equals(other.path)) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 23 * hash + (this.path != null ? this.path.hashCode() : 0); + return hash; + } + + public int compareTo(Object o) { + if (o instanceof TreePart) { + if (((TreePart) o).hasSubParts && (!hasSubParts)) return 1; + if ((!((TreePart) o).hasSubParts) && (hasSubParts)) return -1; + return (path + "." + name).compareTo(((TreePart) o).path + "." + ((TreePart) o).name); + } + return -1; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/DoubleTableModel.java b/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/DoubleTableModel.java index b7d4e6a1a..1f41c730f 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/DoubleTableModel.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/DoubleTableModel.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.abc.gui.tablemodels; import com.jpexs.asdec.abc.ABC; @@ -128,4 +146,4 @@ public class DoubleTableModel implements TableModel { public void removeTableModelListener(TableModelListener l) { } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/IntTableModel.java b/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/IntTableModel.java index f2d797dbd..4b9475c7b 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/IntTableModel.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/IntTableModel.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.abc.gui.tablemodels; import com.jpexs.asdec.abc.ABC; @@ -124,4 +142,4 @@ public class IntTableModel implements TableModel { public void removeTableModelListener(TableModelListener l) { } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/MultinameTableModel.java b/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/MultinameTableModel.java index 3f0942e1e..3c839a7a8 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/MultinameTableModel.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/MultinameTableModel.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.abc.gui.tablemodels; import com.jpexs.asdec.abc.ABC; @@ -143,4 +161,4 @@ public class MultinameTableModel implements TableModel { public void removeTableModelListener(TableModelListener l) { } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/NamespaceSetTableModel.java b/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/NamespaceSetTableModel.java index 3e80df5f5..a5ee5e8a2 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/NamespaceSetTableModel.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/NamespaceSetTableModel.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.abc.gui.tablemodels; import com.jpexs.asdec.abc.ABC; @@ -131,4 +149,4 @@ public class NamespaceSetTableModel implements TableModel { public void removeTableModelListener(TableModelListener l) { } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/NamespaceTableModel.java b/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/NamespaceTableModel.java index b02f3fa28..e0133e051 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/NamespaceTableModel.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/NamespaceTableModel.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.abc.gui.tablemodels; import com.jpexs.asdec.abc.ABC; @@ -134,4 +152,4 @@ public class NamespaceTableModel implements TableModel { public void removeTableModelListener(TableModelListener l) { } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/StringTableModel.java b/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/StringTableModel.java index e370192d8..fb9cd15fb 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/StringTableModel.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/StringTableModel.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.abc.gui.tablemodels; import com.jpexs.asdec.abc.ABC; @@ -124,4 +142,4 @@ public class StringTableModel implements TableModel { public void removeTableModelListener(TableModelListener l) { } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/UIntTableModel.java b/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/UIntTableModel.java index 507c2954a..e803e7d55 100644 --- a/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/UIntTableModel.java +++ b/trunk/src/com/jpexs/asdec/abc/gui/tablemodels/UIntTableModel.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.abc.gui.tablemodels; import com.jpexs.asdec.abc.ABC; diff --git a/trunk/src/com/jpexs/asdec/abc/types/ABCException.java b/trunk/src/com/jpexs/asdec/abc/types/ABCException.java index aefb50982..771079bcc 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/ABCException.java +++ b/trunk/src/com/jpexs/asdec/abc/types/ABCException.java @@ -1,51 +1,65 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types; - -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.ConvertException; -import com.jpexs.asdec.helpers.Helper; - - -public class ABCException { - public int start; - public int end; - public int target; - public int type_index; - public int name_index; - - @Override - public String toString() { - return "Exception: startServer=" + Helper.formatAddress(start) + " end=" + Helper.formatAddress(end) + " target=" + target + " type_index=" + type_index + " name_index=" + name_index; - } - - public String toString(ConstantPool constants) { - return "Exception: startServer=" + Helper.formatAddress(start) + " end=" + Helper.formatAddress(end) + " target=" + target + " type=\"" + getTypeName(constants) + "\" name=\"" + getVarName(constants) + "\""; - } - - public String toString(ConstantPool constants, AVM2Code code) { - try { - return "Exception: startServer=" + code.adr2pos(start) + ":" + code.code.get(code.adr2pos(start)).toStringNoAddress(constants) + " end=" + code.adr2pos(end) + ":" + code.code.get(code.adr2pos(end)).toStringNoAddress(constants) + " target=" + code.adr2pos(target) + ":" + code.code.get(code.adr2pos(target)).toStringNoAddress(constants) + " type=\"" + getTypeName(constants) + "\" name=\"" + getVarName(constants) + "\""; - } catch (ConvertException ex) { - return ""; - } - } - - public boolean isFinally() { - return (name_index == 0) && (type_index == 0); - } - - public String getVarName(ConstantPool constants) { - if (name_index == 0) return ""; - return constants.constant_multiname[name_index].getName(constants); - } - - public String getTypeName(ConstantPool constants) { - if (type_index == 0) return "*"; - return constants.constant_multiname[type_index].getName(constants); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types; + +import com.jpexs.asdec.abc.avm2.AVM2Code; +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.ConvertException; +import com.jpexs.asdec.helpers.Helper; + + +public class ABCException { + public int start; + public int end; + public int target; + public int type_index; + public int name_index; + + @Override + public String toString() { + return "Exception: startServer=" + Helper.formatAddress(start) + " end=" + Helper.formatAddress(end) + " target=" + target + " type_index=" + type_index + " name_index=" + name_index; + } + + public String toString(ConstantPool constants) { + return "Exception: startServer=" + Helper.formatAddress(start) + " end=" + Helper.formatAddress(end) + " target=" + target + " type=\"" + getTypeName(constants) + "\" name=\"" + getVarName(constants) + "\""; + } + + public String toString(ConstantPool constants, AVM2Code code) { + try { + return "Exception: startServer=" + code.adr2pos(start) + ":" + code.code.get(code.adr2pos(start)).toStringNoAddress(constants) + " end=" + code.adr2pos(end) + ":" + code.code.get(code.adr2pos(end)).toStringNoAddress(constants) + " target=" + code.adr2pos(target) + ":" + code.code.get(code.adr2pos(target)).toStringNoAddress(constants) + " type=\"" + getTypeName(constants) + "\" name=\"" + getVarName(constants) + "\""; + } catch (ConvertException ex) { + return ""; + } + } + + public boolean isFinally() { + return (name_index == 0) && (type_index == 0); + } + + public String getVarName(ConstantPool constants) { + if (name_index == 0) return ""; + return constants.constant_multiname[name_index].getName(constants); + } + + public String getTypeName(ConstantPool constants) { + if (type_index == 0) return "*"; + return constants.constant_multiname[type_index].getName(constants); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/types/ClassInfo.java b/trunk/src/com/jpexs/asdec/abc/types/ClassInfo.java index ac1f5e33f..07e5b6874 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/ClassInfo.java +++ b/trunk/src/com/jpexs/asdec/abc/types/ClassInfo.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.types.traits.Traits; - - -public class ClassInfo { - - public int cinit_index; //MethodInfo - static initializer - public Traits static_traits; - - @Override - public String toString() { - return "method_index=" + cinit_index + "\r\n" + static_traits.toString(); - } - - - public String toString(ConstantPool constants) { - return "method_index=" + cinit_index + "\r\n" + static_traits.toString(constants); - } - - public String getStaticVarsStr(ConstantPool constants) { - return static_traits.convert(constants, "\tstatic "); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.types.traits.Traits; + + +public class ClassInfo { + + public int cinit_index; //MethodInfo - static initializer + public Traits static_traits; + + @Override + public String toString() { + return "method_index=" + cinit_index + "\r\n" + static_traits.toString(); + } + + + public String toString(ConstantPool constants) { + return "method_index=" + cinit_index + "\r\n" + static_traits.toString(constants); + } + + public String getStaticVarsStr(ConstantPool constants) { + return static_traits.convert(constants, "\tstatic "); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/types/InstanceInfo.java b/trunk/src/com/jpexs/asdec/abc/types/InstanceInfo.java index 8946353ef..4a300ae4c 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/InstanceInfo.java +++ b/trunk/src/com/jpexs/asdec/abc/types/InstanceInfo.java @@ -1,70 +1,84 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.types.traits.Traits; -import com.jpexs.asdec.helpers.Helper; - - -public class InstanceInfo { - - public int name_index; - public int super_index; - public int flags; // 1 = sealed, 0 = dynamic, 2 = final, 4 = interface, 8 = ProtectedNs - public int protectedNS; //if flags & 8 - public int interfaces[]; - public int iinit_index; // MethodInfo - constructor - public Traits instance_traits; - - public static final int CLASS_SEALED = 1; //not dynamic - public static final int CLASS_FINAL = 2; - public static final int CLASS_INTERFACE = 4; - public static final int CLASS_PROTECTEDNS = 8; - - @Override - public String toString() { - return "name_index=" + name_index + " super_index=" + super_index + " flags=" + flags + " protectedNS=" + protectedNS + " interfaces=" + Helper.intArrToString(interfaces) + " method_index=" + iinit_index + "\r\n" + instance_traits.toString(); - } - - - public String toString(ConstantPool constants) { - String supIndexStr = "[nothing]"; - if (super_index > 0) - constants.constant_multiname[super_index].toString(constants); - return "name_index=" + constants.constant_multiname[name_index].toString(constants) + " super_index=" + supIndexStr + " flags=" + flags + " protectedNS=" + protectedNS + " interfaces=" + Helper.intArrToString(interfaces) + " method_index=" + iinit_index + "\r\n" + instance_traits.toString(constants); - } - - public String getClassHeaderStr(ConstantPool constants) { - String supIndexStr = ""; - if (super_index > 0) - supIndexStr = " extends " + constants.constant_multiname[super_index].getName(constants);////+" flags="+flags+" protectedNS="+protectedNS+" interfaces="+Helper.intArrToString(interfaces)+" method_index="+iinit_index - String modifiers = ""; - Namespace ns = constants.constant_multiname[name_index].getNamespace(constants); - modifiers = ns.getPrefix(constants); - if (!modifiers.equals("")) modifiers += " "; - - if ((flags & CLASS_FINAL) == CLASS_FINAL) { - modifiers = "final "; - } - if ((flags & CLASS_SEALED) == 0) { - modifiers = modifiers + "dynamic "; - } - String objType = "class "; - if ((flags & CLASS_INTERFACE) == CLASS_INTERFACE) { - objType = "interface "; - } - return modifiers + objType + constants.constant_multiname[name_index].getName(constants) + supIndexStr; - } - - public String getInstanceVarsStr(ConstantPool constants) { - return instance_traits.convert(constants, "\t"); - } - - public Multiname getName(ConstantPool constants) { - return constants.constant_multiname[name_index]; - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.types.traits.Traits; +import com.jpexs.asdec.helpers.Helper; + + +public class InstanceInfo { + + public int name_index; + public int super_index; + public int flags; // 1 = sealed, 0 = dynamic, 2 = final, 4 = interface, 8 = ProtectedNs + public int protectedNS; //if flags & 8 + public int interfaces[]; + public int iinit_index; // MethodInfo - constructor + public Traits instance_traits; + + public static final int CLASS_SEALED = 1; //not dynamic + public static final int CLASS_FINAL = 2; + public static final int CLASS_INTERFACE = 4; + public static final int CLASS_PROTECTEDNS = 8; + + @Override + public String toString() { + return "name_index=" + name_index + " super_index=" + super_index + " flags=" + flags + " protectedNS=" + protectedNS + " interfaces=" + Helper.intArrToString(interfaces) + " method_index=" + iinit_index + "\r\n" + instance_traits.toString(); + } + + + public String toString(ConstantPool constants) { + String supIndexStr = "[nothing]"; + if (super_index > 0) + constants.constant_multiname[super_index].toString(constants); + return "name_index=" + constants.constant_multiname[name_index].toString(constants) + " super_index=" + supIndexStr + " flags=" + flags + " protectedNS=" + protectedNS + " interfaces=" + Helper.intArrToString(interfaces) + " method_index=" + iinit_index + "\r\n" + instance_traits.toString(constants); + } + + public String getClassHeaderStr(ConstantPool constants) { + String supIndexStr = ""; + if (super_index > 0) + supIndexStr = " extends " + constants.constant_multiname[super_index].getName(constants);////+" flags="+flags+" protectedNS="+protectedNS+" interfaces="+Helper.intArrToString(interfaces)+" method_index="+iinit_index + String modifiers = ""; + Namespace ns = constants.constant_multiname[name_index].getNamespace(constants); + modifiers = ns.getPrefix(constants); + if (!modifiers.equals("")) modifiers += " "; + + if ((flags & CLASS_FINAL) == CLASS_FINAL) { + modifiers = "final "; + } + if ((flags & CLASS_SEALED) == 0) { + modifiers = modifiers + "dynamic "; + } + String objType = "class "; + if ((flags & CLASS_INTERFACE) == CLASS_INTERFACE) { + objType = "interface "; + } + return modifiers + objType + constants.constant_multiname[name_index].getName(constants) + supIndexStr; + } + + public String getInstanceVarsStr(ConstantPool constants) { + return instance_traits.convert(constants, "\t"); + } + + public Multiname getName(ConstantPool constants) { + return constants.constant_multiname[name_index]; + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/types/MetadataInfo.java b/trunk/src/com/jpexs/asdec/abc/types/MetadataInfo.java index 667c12da6..4a92c85c8 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/MetadataInfo.java +++ b/trunk/src/com/jpexs/asdec/abc/types/MetadataInfo.java @@ -1,41 +1,55 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.helpers.Helper; - - -public class MetadataInfo { - - public int name_index; - public int keys[]; - public int values[]; - - public MetadataInfo(int name_index, int[] keys, int[] values) { - this.name_index = name_index; - this.keys = keys; - this.values = values; - } - - @Override - public String toString() { - return "name_index=" + name_index + " keys=" + Helper.intArrToString(keys) + " values=" + Helper.intArrToString(values); - } - - public String toString(ConstantPool constants) { - String s = "name=" + constants.constant_string[name_index]; - if (keys.length > 0) s += "\r\n"; - for (int i = 0; i < keys.length; i++) { - if (keys[i] == 0) { - s += "\"" + constants.constant_string[values[i]] + "\"\r\n"; - } else { - s += "\"" + constants.constant_string[keys[i]] + "\"=\"" + constants.constant_string[values[i]] + "\"\r\n"; - } - } - return s; - } - -} \ No newline at end of file +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.helpers.Helper; + + +public class MetadataInfo { + + public int name_index; + public int keys[]; + public int values[]; + + public MetadataInfo(int name_index, int[] keys, int[] values) { + this.name_index = name_index; + this.keys = keys; + this.values = values; + } + + @Override + public String toString() { + return "name_index=" + name_index + " keys=" + Helper.intArrToString(keys) + " values=" + Helper.intArrToString(values); + } + + public String toString(ConstantPool constants) { + String s = "name=" + constants.constant_string[name_index]; + if (keys.length > 0) s += "\r\n"; + for (int i = 0; i < keys.length; i++) { + if (keys[i] == 0) { + s += "\"" + constants.constant_string[values[i]] + "\"\r\n"; + } else { + s += "\"" + constants.constant_string[keys[i]] + "\"=\"" + constants.constant_string[values[i]] + "\"\r\n"; + } + } + return s; + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/types/MethodBody.java b/trunk/src/com/jpexs/asdec/abc/types/MethodBody.java index 9bc15c7e3..e1b241d1c 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/MethodBody.java +++ b/trunk/src/com/jpexs/asdec/abc/types/MethodBody.java @@ -1,82 +1,96 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types; - -import com.jpexs.asdec.abc.ABC; -import com.jpexs.asdec.abc.avm2.AVM2Code; -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.instructions.InstructionDefinition; -import com.jpexs.asdec.abc.types.traits.Traits; - - -public class MethodBody implements Cloneable { - - public int method_info; - public int max_stack; - public int max_regs; - public int scope_depth; - public int max_scope; - public byte codeBytes[]; - public AVM2Code code; - public ABCException exceptions[] = new ABCException[0]; - public Traits traits = new Traits(); - - @Override - public String toString() { - String s = ""; - s += "method_info=" + method_info + " max_stack=" + max_stack + " max_regs=" + max_regs + " scope_depth=" + scope_depth + " max_scope=" + max_scope; - s += "\r\nCode:\r\n" + code.toString(); - return s; - } - - private String replaceParams(String code, MethodInfo method_info[]) { - for (int i = 1; i <= method_info[this.method_info].param_types.length; i++) { - code = code.replace(InstructionDefinition.localRegName(i), "param" + i); - } - return code; - } - - public String toString(boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[]) { - return toString(isStatic, classIndex, abc, constants, method_info, false); - } - - public String toString(boolean isStatic, int classIndex, ABC abc, ConstantPool constants, MethodInfo method_info[], boolean hilight) { - String s = ""; - - //s+="method_info="+method_info+" max_stack="+max_stack+" max_regs="+max_regs+" scope_depth="+scope_depth+" max_scope="+max_scope; - //s+="\r\nCode:\r\n"+ - - try { - s += code.toSource(isStatic, classIndex, abc, constants, method_info, this, hilight); - s = replaceParams(s, method_info); - } catch (Exception ex) { - s = "//error:" + ex.toString(); - } - //s+="----------- ORIGINAL ------------\r\n"; - //s+=code.toString(constants); - /*s+="Exceptions:"; - for(int i=0;i 0) { - optionalStr += ","; - } - optionalStr += optional[i].toString(); - } - } - optionalStr += "]"; - return "MethodInfo: param_types=" + Helper.intArrToString(param_types) + " ret_type=" + ret_type + " name_index=" + name_index + " flags=" + flags + " optional=" + optionalStr + " paramNames=" + Helper.intArrToString(paramNames); - } - - public String toString(ConstantPool constants) { - String optionalStr = "["; - if (optional != null) { - for (int i = 0; i < optional.length; i++) { - if (i > 0) { - optionalStr += ","; - } - optionalStr += optional[i].toString(constants); - } - } - optionalStr += "]"; - - String param_typesStr = ""; - for (int i = 0; i < param_types.length; i++) { - if (i > 0) { - param_typesStr += ","; - } - if (param_types[i] == 0) { - param_typesStr += "*"; - } else { - param_typesStr += constants.constant_multiname[param_types[i]].toString(constants); - } - } - - String paramNamesStr = ""; - for (int i = 0; i < paramNames.length; i++) { - if (i > 0) { - paramNamesStr += ","; - } - paramNamesStr += constants.constant_string[paramNames[i]]; - } - - String ret_typeStr = ""; - if (ret_type == 0) { - ret_typeStr += "*"; - } else { - ret_typeStr += constants.constant_multiname[ret_type].toString(constants); - } - - return "param_types=" + param_typesStr + " ret_type=" + ret_typeStr + " name=\"" + constants.constant_string[name_index] + "\" flags=" + flags + " optional=" + optionalStr + " paramNames=" + paramNamesStr; - } - - - public String getName(ConstantPool constants) { - if (name_index == 0) return "UNKNOWN"; - return constants.constant_string[name_index]; - } - - public String getParamStr(ConstantPool constants) { - String paramStr = ""; - for (int i = 0; i < param_types.length; i++) { - if (i > 0) { - paramStr += ", "; - } - if ((paramNames.length > i) && (paramNames[i] != 0)) { - paramStr += constants.constant_string[paramNames[i]]; - } else { - paramStr += "param" + (i + 1); - } - paramStr += ":"; - if (param_types[i] == 0) { - paramStr += "*"; - } else { - paramStr += constants.constant_multiname[param_types[i]].getName(constants); - } - if (optional != null) { - if (i >= param_types.length - optional.length) { - //System.out.println("param_types.length:"+param_types.length); - //System.out.println("optional.lengt:"+optional.length); - paramStr += "=" + optional[i - (param_types.length - optional.length)].toString(constants); - } - } - } - return paramStr; - } - - public String getReturnTypeStr(ConstantPool constants) { - if (ret_type == 0) return "*"; - return constants.constant_multiname[ret_type].getName(constants); - } -} - +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.helpers.Helper; + + +public class MethodInfo { + + public int param_types[]; + public int ret_type; + public int name_index; //0=no name + // 1=need_arguments, 2=need_activation, 4=need_rest 8=has_optional 16=ignore_rest, 32=explicit, 64=setsdxns, 128=has_paramnames + public int flags; + public ValueKind optional[]; + public int paramNames[]; + + public boolean flagNeed_arguments() { + return (flags & 1) == 1; + } + + public boolean flagNeed_activation() { + return (flags & 2) == 2; + } + + public boolean flagNeed_rest() { + return (flags & 4) == 4; + } + + public boolean flagHas_optional() { + return (flags & 8) == 8; + } + + public boolean flagIgnore_restHas_optional() { + return (flags & 16) == 16; + } + + public boolean flagExplicit() { + return (flags & 32) == 32; + } + + public boolean flagSetsdxns() { + return (flags & 64) == 64; + } + + public boolean flagHas_paramnames() { + return (flags & 128) == 128; + } + + public MethodInfo(int param_types[], int ret_type, int name_index, int flags, ValueKind optional[], int paramNames[]) { + this.param_types = param_types; + this.ret_type = ret_type; + this.name_index = name_index; + this.flags = flags; + this.optional = optional; + this.paramNames = paramNames; + } + + @Override + public String toString() { + String optionalStr = "["; + if (optional != null) { + for (int i = 0; i < optional.length; i++) { + if (i > 0) { + optionalStr += ","; + } + optionalStr += optional[i].toString(); + } + } + optionalStr += "]"; + return "MethodInfo: param_types=" + Helper.intArrToString(param_types) + " ret_type=" + ret_type + " name_index=" + name_index + " flags=" + flags + " optional=" + optionalStr + " paramNames=" + Helper.intArrToString(paramNames); + } + + public String toString(ConstantPool constants) { + String optionalStr = "["; + if (optional != null) { + for (int i = 0; i < optional.length; i++) { + if (i > 0) { + optionalStr += ","; + } + optionalStr += optional[i].toString(constants); + } + } + optionalStr += "]"; + + String param_typesStr = ""; + for (int i = 0; i < param_types.length; i++) { + if (i > 0) { + param_typesStr += ","; + } + if (param_types[i] == 0) { + param_typesStr += "*"; + } else { + param_typesStr += constants.constant_multiname[param_types[i]].toString(constants); + } + } + + String paramNamesStr = ""; + for (int i = 0; i < paramNames.length; i++) { + if (i > 0) { + paramNamesStr += ","; + } + paramNamesStr += constants.constant_string[paramNames[i]]; + } + + String ret_typeStr = ""; + if (ret_type == 0) { + ret_typeStr += "*"; + } else { + ret_typeStr += constants.constant_multiname[ret_type].toString(constants); + } + + return "param_types=" + param_typesStr + " ret_type=" + ret_typeStr + " name=\"" + constants.constant_string[name_index] + "\" flags=" + flags + " optional=" + optionalStr + " paramNames=" + paramNamesStr; + } + + + public String getName(ConstantPool constants) { + if (name_index == 0) return "UNKNOWN"; + return constants.constant_string[name_index]; + } + + public String getParamStr(ConstantPool constants) { + String paramStr = ""; + for (int i = 0; i < param_types.length; i++) { + if (i > 0) { + paramStr += ", "; + } + if ((paramNames.length > i) && (paramNames[i] != 0)) { + paramStr += constants.constant_string[paramNames[i]]; + } else { + paramStr += "param" + (i + 1); + } + paramStr += ":"; + if (param_types[i] == 0) { + paramStr += "*"; + } else { + paramStr += constants.constant_multiname[param_types[i]].getName(constants); + } + if (optional != null) { + if (i >= param_types.length - optional.length) { + //System.out.println("param_types.length:"+param_types.length); + //System.out.println("optional.lengt:"+optional.length); + paramStr += "=" + optional[i - (param_types.length - optional.length)].toString(constants); + } + } + } + return paramStr; + } + + public String getReturnTypeStr(ConstantPool constants) { + if (ret_type == 0) return "*"; + return constants.constant_multiname[ret_type].getName(constants); + } +} + diff --git a/trunk/src/com/jpexs/asdec/abc/types/Multiname.java b/trunk/src/com/jpexs/asdec/abc/types/Multiname.java index d11e9f03c..bd045f9c1 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/Multiname.java +++ b/trunk/src/com/jpexs/asdec/abc/types/Multiname.java @@ -1,145 +1,159 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; - - -public class Multiname { - - public static final int QNAME = 7; - public static final int QNAMEA = 13; - public static final int MULTINAME = 9; - public static final int MULTINAMEA = 14; - public static final int RTQNAME = 15; - public static final int RTQNAMEA = 16; - public static final int MULTINAMEL = 27; - public static final int RTQNAMEL = 17; - public static final int RTQNAMELA = 18; - private static final int multinameKinds[] = new int[]{QNAME, QNAMEA, MULTINAME, MULTINAMEA, RTQNAME, RTQNAMEA, MULTINAMEL, RTQNAMEL, RTQNAMELA}; - private static final String multinameKindNames[] = new String[]{"Qname", "QnameA", "Multiname", "MultinameA", "RTQname", "RTQnameA", "MultinameL", "RTQnameL", "RTQnameLA"}; - - - public int kind = -1; - public int name_index = -1; - public int namespace_index = -1; - public int namespace_set_index = -1; - - - public Multiname(int kind, int name_index, int namespace_index, int namespace_set_index) { - this.kind = kind; - this.name_index = name_index; - this.namespace_index = namespace_index; - this.namespace_set_index = namespace_set_index; - } - - public boolean isAttribute() { - if (kind == QNAMEA) return true; - if (kind == MULTINAMEA) return true; - if (kind == RTQNAMEA) return true; - if (kind == RTQNAMELA) return true; - return false; - } - - public boolean isRuntime() { - if (kind == RTQNAME) return true; - if (kind == RTQNAMEA) return true; - if (kind == MULTINAMEL) return true; - return false; - } - - public boolean needsName() { - if (kind == RTQNAMEL) return true; - if (kind == RTQNAMELA) return true; - if (kind == MULTINAMEL) return true; - return false; - } - - public boolean needsNs() { - if (kind == RTQNAME) return true; - if (kind == RTQNAMEA) return true; - if (kind == RTQNAMEL) return true; - if (kind == RTQNAMELA) return true; - return false; - } - - public String getKindStr() { - String kindStr = "?"; - for (int k = 0; k < multinameKinds.length; k++) { - if (multinameKinds[k] == kind) { - kindStr = multinameKindNames[k]; - break; - } - } - return kindStr; - } - - @Override - public String toString() { - String kindStr = getKindStr(); - return "kind=" + kindStr + " name_index=" + name_index + " namespace_index=" + namespace_index + " namespace_set_index=" + namespace_set_index; - - } - - public String toString(ConstantPool constants) { - String kindStr = "?"; - for (int k = 0; k < multinameKinds.length; k++) { - if (multinameKinds[k] == kind) { - kindStr = multinameKindNames[k] + " "; - break; - } - } - String nameStr = ""; - if (name_index > 0) { - nameStr = constants.constant_string[name_index]; - } - if (name_index == 0) { - nameStr = "*"; - } - String namespaceStr = ""; - if (namespace_index > 0) { - namespaceStr = constants.constant_namespace[namespace_index].toString(constants); - } - if (!namespaceStr.equals("")) - namespaceStr = namespaceStr + "."; - if (namespace_index == 0) { - namespaceStr = "*."; - } - String namespaceSetStr = ""; - if (namespace_set_index > 0) { - namespaceSetStr = " "; - } - //kindStr+" "+ - return namespaceStr + nameStr + namespaceSetStr; - - } - - public String getName(ConstantPool constants) { - if (name_index == -1) { - return ""; - } - if (name_index == 0) { - return "*"; - } else { - return (isAttribute() ? "@" : "") + constants.constant_string[name_index]; - } - } - - public Namespace getNamespace(ConstantPool constants) { - if ((namespace_index == 0) || (namespace_index == -1)) { - return null; - } else { - return constants.constant_namespace[namespace_index]; - } - } - - public NamespaceSet getNamespaceSet(ConstantPool constants) { - if (namespace_set_index == 0) { - return null; - } else { - return constants.constant_namespace_set[namespace_set_index]; - } - } -} \ No newline at end of file +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; + + +public class Multiname { + + public static final int QNAME = 7; + public static final int QNAMEA = 13; + public static final int MULTINAME = 9; + public static final int MULTINAMEA = 14; + public static final int RTQNAME = 15; + public static final int RTQNAMEA = 16; + public static final int MULTINAMEL = 27; + public static final int RTQNAMEL = 17; + public static final int RTQNAMELA = 18; + private static final int multinameKinds[] = new int[]{QNAME, QNAMEA, MULTINAME, MULTINAMEA, RTQNAME, RTQNAMEA, MULTINAMEL, RTQNAMEL, RTQNAMELA}; + private static final String multinameKindNames[] = new String[]{"Qname", "QnameA", "Multiname", "MultinameA", "RTQname", "RTQnameA", "MultinameL", "RTQnameL", "RTQnameLA"}; + + + public int kind = -1; + public int name_index = -1; + public int namespace_index = -1; + public int namespace_set_index = -1; + + + public Multiname(int kind, int name_index, int namespace_index, int namespace_set_index) { + this.kind = kind; + this.name_index = name_index; + this.namespace_index = namespace_index; + this.namespace_set_index = namespace_set_index; + } + + public boolean isAttribute() { + if (kind == QNAMEA) return true; + if (kind == MULTINAMEA) return true; + if (kind == RTQNAMEA) return true; + if (kind == RTQNAMELA) return true; + return false; + } + + public boolean isRuntime() { + if (kind == RTQNAME) return true; + if (kind == RTQNAMEA) return true; + if (kind == MULTINAMEL) return true; + return false; + } + + public boolean needsName() { + if (kind == RTQNAMEL) return true; + if (kind == RTQNAMELA) return true; + if (kind == MULTINAMEL) return true; + return false; + } + + public boolean needsNs() { + if (kind == RTQNAME) return true; + if (kind == RTQNAMEA) return true; + if (kind == RTQNAMEL) return true; + if (kind == RTQNAMELA) return true; + return false; + } + + public String getKindStr() { + String kindStr = "?"; + for (int k = 0; k < multinameKinds.length; k++) { + if (multinameKinds[k] == kind) { + kindStr = multinameKindNames[k]; + break; + } + } + return kindStr; + } + + @Override + public String toString() { + String kindStr = getKindStr(); + return "kind=" + kindStr + " name_index=" + name_index + " namespace_index=" + namespace_index + " namespace_set_index=" + namespace_set_index; + + } + + public String toString(ConstantPool constants) { + String kindStr = "?"; + for (int k = 0; k < multinameKinds.length; k++) { + if (multinameKinds[k] == kind) { + kindStr = multinameKindNames[k] + " "; + break; + } + } + String nameStr = ""; + if (name_index > 0) { + nameStr = constants.constant_string[name_index]; + } + if (name_index == 0) { + nameStr = "*"; + } + String namespaceStr = ""; + if (namespace_index > 0) { + namespaceStr = constants.constant_namespace[namespace_index].toString(constants); + } + if (!namespaceStr.equals("")) + namespaceStr = namespaceStr + "."; + if (namespace_index == 0) { + namespaceStr = "*."; + } + String namespaceSetStr = ""; + if (namespace_set_index > 0) { + namespaceSetStr = " "; + } + //kindStr+" "+ + return namespaceStr + nameStr + namespaceSetStr; + + } + + public String getName(ConstantPool constants) { + if (name_index == -1) { + return ""; + } + if (name_index == 0) { + return "*"; + } else { + return (isAttribute() ? "@" : "") + constants.constant_string[name_index]; + } + } + + public Namespace getNamespace(ConstantPool constants) { + if ((namespace_index == 0) || (namespace_index == -1)) { + return null; + } else { + return constants.constant_namespace[namespace_index]; + } + } + + public NamespaceSet getNamespaceSet(ConstantPool constants) { + if (namespace_set_index == 0) { + return null; + } else { + return constants.constant_namespace_set[namespace_set_index]; + } + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/types/Namespace.java b/trunk/src/com/jpexs/asdec/abc/types/Namespace.java index 368c169aa..d61726fef 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/Namespace.java +++ b/trunk/src/com/jpexs/asdec/abc/types/Namespace.java @@ -1,65 +1,79 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; - - -public class Namespace { - - public static final int nameSpaceKinds[] = new int[]{8, 5, 22, 23, 24, 25, 26}; - public static final String nameSpaceKindNames[] = new String[]{"Namespace", "PrivateNamespace", "PackageNamespace", "PackageInternalNamespace", "ProtectedNamespace", "ExplicitNamespace", "StaticProtectedNamespace"}; - public static final String namePrefixes[] = new String[]{"", "private", "public", "", "protected", "explicit", ""}; - - public int kind; - public int name_index; - - public Namespace(int kind, int name_index) { - this.kind = kind; - this.name_index = name_index; - } - - public String getKindStr() { - String kindStr = "?"; - for (int k = 0; k < nameSpaceKinds.length; k++) { - if (nameSpaceKinds[k] == kind) { - kindStr = nameSpaceKindNames[k]; - break; - } - } - return kindStr; - } - - @Override - public String toString() { - - return "Namespace: kind=" + getKindStr() + " name_index=" + name_index; - } - - public String toString(ConstantPool constants) { - return getName(constants); //getPrefix(constants)+" "+getName(constants); - } - - public String getNameWithKind(ConstantPool constants) { - String kindStr = getKindStr(); - String nameStr = constants.constant_string[name_index]; - return kindStr + (nameStr.equals("") ? "" : " " + nameStr); - } - - public String getPrefix(ConstantPool constants) { - String kindStr = "?"; - for (int k = 0; k < nameSpaceKinds.length; k++) { - if (nameSpaceKinds[k] == kind) { - kindStr = namePrefixes[k]; - break; - } - } - return kindStr; - } - - public String getName(ConstantPool constants) { - return constants.constant_string[name_index]; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; + + +public class Namespace { + + public static final int nameSpaceKinds[] = new int[]{8, 5, 22, 23, 24, 25, 26}; + public static final String nameSpaceKindNames[] = new String[]{"Namespace", "PrivateNamespace", "PackageNamespace", "PackageInternalNamespace", "ProtectedNamespace", "ExplicitNamespace", "StaticProtectedNamespace"}; + public static final String namePrefixes[] = new String[]{"", "private", "public", "", "protected", "explicit", ""}; + + public int kind; + public int name_index; + + public Namespace(int kind, int name_index) { + this.kind = kind; + this.name_index = name_index; + } + + public String getKindStr() { + String kindStr = "?"; + for (int k = 0; k < nameSpaceKinds.length; k++) { + if (nameSpaceKinds[k] == kind) { + kindStr = nameSpaceKindNames[k]; + break; + } + } + return kindStr; + } + + @Override + public String toString() { + + return "Namespace: kind=" + getKindStr() + " name_index=" + name_index; + } + + public String toString(ConstantPool constants) { + return getName(constants); //getPrefix(constants)+" "+getName(constants); + } + + public String getNameWithKind(ConstantPool constants) { + String kindStr = getKindStr(); + String nameStr = constants.constant_string[name_index]; + return kindStr + (nameStr.equals("") ? "" : " " + nameStr); + } + + public String getPrefix(ConstantPool constants) { + String kindStr = "?"; + for (int k = 0; k < nameSpaceKinds.length; k++) { + if (nameSpaceKinds[k] == kind) { + kindStr = namePrefixes[k]; + break; + } + } + return kindStr; + } + + public String getName(ConstantPool constants) { + return constants.constant_string[name_index]; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/types/NamespaceSet.java b/trunk/src/com/jpexs/asdec/abc/types/NamespaceSet.java index b26a7ee13..f5ed2f6da 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/NamespaceSet.java +++ b/trunk/src/com/jpexs/asdec/abc/types/NamespaceSet.java @@ -1,24 +1,38 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; - - -public class NamespaceSet { - - public int namespaces[]; - - public String toString(ConstantPool constants) { - String s = ""; - for (int i = 0; i < this.namespaces.length; i++) { - if (i > 0) s += ", "; - s += constants.constant_namespace[namespaces[i]].getNameWithKind(constants); - } - return s; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; + + +public class NamespaceSet { + + public int namespaces[]; + + public String toString(ConstantPool constants) { + String s = ""; + for (int i = 0; i < this.namespaces.length; i++) { + if (i > 0) s += ", "; + s += constants.constant_namespace[namespaces[i]].getNameWithKind(constants); + } + return s; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/types/ScriptInfo.java b/trunk/src/com/jpexs/asdec/abc/types/ScriptInfo.java index b307e21e7..5f8c50a78 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/ScriptInfo.java +++ b/trunk/src/com/jpexs/asdec/abc/types/ScriptInfo.java @@ -1,27 +1,41 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.types.traits.Traits; - - -public class ScriptInfo { - - public int init_index; //MethodInfo - public Traits traits; - - @Override - public String toString() { - return "method_index=" + init_index + "\r\n" + traits.toString(); - } - - - public String toString(ConstantPool constants) { - return "method_index=" + init_index + "\r\n" + traits.toString(constants); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.types.traits.Traits; + + +public class ScriptInfo { + + public int init_index; //MethodInfo + public Traits traits; + + @Override + public String toString() { + return "method_index=" + init_index + "\r\n" + traits.toString(); + } + + + public String toString(ConstantPool constants) { + return "method_index=" + init_index + "\r\n" + traits.toString(constants); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/types/ValueKind.java b/trunk/src/com/jpexs/asdec/abc/types/ValueKind.java index 1a74e9747..c77fe07bf 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/ValueKind.java +++ b/trunk/src/com/jpexs/asdec/abc/types/ValueKind.java @@ -1,103 +1,117 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types; - -import com.jpexs.asdec.abc.avm2.ConstantPool; - - -public class ValueKind { - - public static final int CONSTANT_Int = 0x03;// integer - public static final int CONSTANT_UInt = 0x04;// uinteger - public static final int CONSTANT_Double = 0x06;// double - public static final int CONSTANT_Utf8 = 0x01;// string - public static final int CONSTANT_True = 0x0B;// - - public static final int CONSTANT_False = 0x0A;// - - public static final int CONSTANT_Null = 0x0C;// - - public static final int CONSTANT_Undefined = 0x00;// - - public static final int CONSTANT_Namespace = 0x08;// namespace - public static final int CONSTANT_PackageNamespace = 0x16;// namespace - public static final int CONSTANT_PackageInternalNs = 0x17;// Namespace - public static final int CONSTANT_ProtectedNamespace = 0x18;// Namespace - public static final int CONSTANT_ExplicitNamespace = 0x19;// Namespace - public static final int CONSTANT_StaticProtectedNs = 0x1A;// Namespace - public static final int CONSTANT_PrivateNs = 0x05;// namespace - private static final int optionalKinds[] = new int[]{0x03, 0x04, 0x06, 0x01, 0x0B, 0x0A, 0x0C, 0x00, 0x08, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x05}; - private static final String optionalKindNames[] = new String[]{"Int", "UInt", "Double", "Utf8", "True", "False", "Null", "Undefined", "Namespace", "PackageNamespace", "PackageInternalNs", "ProtectedNamespace", "ExplicitNamespace", "StaticProtectedNs", "PrivateNs"}; - public int value_index; - public int value_kind; - - public ValueKind(int value_index, int value_kind) { - this.value_index = value_index; - this.value_kind = value_kind; - } - - @Override - public String toString() { - String s = ""; - s += value_index + ":"; - boolean found = false; - for (int i = 0; i < optionalKinds.length; i++) { - if (optionalKinds[i] == value_kind) { - s += optionalKindNames[i]; - found = true; - break; - } - } - if (!found) { - s += "?"; - } - return s; - } - - public String toString(ConstantPool constants) { - String ret = "?"; - switch (value_kind) { - case CONSTANT_Int: - ret = "" + constants.constant_int[value_index]; - break; - case CONSTANT_UInt: - ret = "" + constants.constant_uint[value_index]; - break; - case CONSTANT_Double: - ret = "" + constants.constant_double[value_index]; - break; - case CONSTANT_Utf8: - ret = "\"" + constants.constant_string[value_index] + "\""; - break; - case CONSTANT_True: - ret = "True"; - break; - case CONSTANT_False: - ret = "False"; - break; - case CONSTANT_Null: - ret = "Null"; - break; - case CONSTANT_Undefined: - ret = "Undefined"; - break; - case CONSTANT_Namespace: - ret = "" + constants.constant_namespace[value_index].getName(constants); - break; - case CONSTANT_PackageInternalNs: - ret = "" + constants.constant_namespace[value_index].getName(constants); - break; - case CONSTANT_ProtectedNamespace: - ret = "protected " + constants.constant_namespace[value_index].getName(constants); - break; - case CONSTANT_ExplicitNamespace: - ret = "explicit " + constants.constant_namespace[value_index].getName(constants); - break; - case CONSTANT_StaticProtectedNs: - ret = "static protected " + constants.constant_namespace[value_index].getName(constants); - break; - case CONSTANT_PrivateNs: - ret = "private " + constants.constant_namespace[value_index].getName(constants); - break; - } - return ret; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types; + +import com.jpexs.asdec.abc.avm2.ConstantPool; + + +public class ValueKind { + + public static final int CONSTANT_Int = 0x03;// integer + public static final int CONSTANT_UInt = 0x04;// uinteger + public static final int CONSTANT_Double = 0x06;// double + public static final int CONSTANT_Utf8 = 0x01;// string + public static final int CONSTANT_True = 0x0B;// - + public static final int CONSTANT_False = 0x0A;// - + public static final int CONSTANT_Null = 0x0C;// - + public static final int CONSTANT_Undefined = 0x00;// - + public static final int CONSTANT_Namespace = 0x08;// namespace + public static final int CONSTANT_PackageNamespace = 0x16;// namespace + public static final int CONSTANT_PackageInternalNs = 0x17;// Namespace + public static final int CONSTANT_ProtectedNamespace = 0x18;// Namespace + public static final int CONSTANT_ExplicitNamespace = 0x19;// Namespace + public static final int CONSTANT_StaticProtectedNs = 0x1A;// Namespace + public static final int CONSTANT_PrivateNs = 0x05;// namespace + private static final int optionalKinds[] = new int[]{0x03, 0x04, 0x06, 0x01, 0x0B, 0x0A, 0x0C, 0x00, 0x08, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x05}; + private static final String optionalKindNames[] = new String[]{"Int", "UInt", "Double", "Utf8", "True", "False", "Null", "Undefined", "Namespace", "PackageNamespace", "PackageInternalNs", "ProtectedNamespace", "ExplicitNamespace", "StaticProtectedNs", "PrivateNs"}; + public int value_index; + public int value_kind; + + public ValueKind(int value_index, int value_kind) { + this.value_index = value_index; + this.value_kind = value_kind; + } + + @Override + public String toString() { + String s = ""; + s += value_index + ":"; + boolean found = false; + for (int i = 0; i < optionalKinds.length; i++) { + if (optionalKinds[i] == value_kind) { + s += optionalKindNames[i]; + found = true; + break; + } + } + if (!found) { + s += "?"; + } + return s; + } + + public String toString(ConstantPool constants) { + String ret = "?"; + switch (value_kind) { + case CONSTANT_Int: + ret = "" + constants.constant_int[value_index]; + break; + case CONSTANT_UInt: + ret = "" + constants.constant_uint[value_index]; + break; + case CONSTANT_Double: + ret = "" + constants.constant_double[value_index]; + break; + case CONSTANT_Utf8: + ret = "\"" + constants.constant_string[value_index] + "\""; + break; + case CONSTANT_True: + ret = "True"; + break; + case CONSTANT_False: + ret = "False"; + break; + case CONSTANT_Null: + ret = "Null"; + break; + case CONSTANT_Undefined: + ret = "Undefined"; + break; + case CONSTANT_Namespace: + ret = "" + constants.constant_namespace[value_index].getName(constants); + break; + case CONSTANT_PackageInternalNs: + ret = "" + constants.constant_namespace[value_index].getName(constants); + break; + case CONSTANT_ProtectedNamespace: + ret = "protected " + constants.constant_namespace[value_index].getName(constants); + break; + case CONSTANT_ExplicitNamespace: + ret = "explicit " + constants.constant_namespace[value_index].getName(constants); + break; + case CONSTANT_StaticProtectedNs: + ret = "static protected " + constants.constant_namespace[value_index].getName(constants); + break; + case CONSTANT_PrivateNs: + ret = "private " + constants.constant_namespace[value_index].getName(constants); + break; + } + return ret; + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/types/traits/Trait.java b/trunk/src/com/jpexs/asdec/abc/types/traits/Trait.java index 6519b3304..eac8bcc25 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/traits/Trait.java +++ b/trunk/src/com/jpexs/asdec/abc/types/traits/Trait.java @@ -1,81 +1,95 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types.traits; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.types.MethodInfo; -import com.jpexs.asdec.abc.types.Multiname; -import com.jpexs.asdec.abc.types.Namespace; -import com.jpexs.asdec.helpers.Helper; - - -public class Trait { - - public int name_index; - public int kindType; - public int kindFlags; - public int metadata[] = new int[0]; - public long fileOffset; - public byte bytes[]; - public static final int ATTR_Final = 0x1; - public static final int ATTR_Override = 0x2; - public static final int ATTR_Metadata = 0x4; - - public static final int TRAIT_SLOT = 0; - public static final int TRAIT_METHOD = 1; - public static final int TRAIT_GETTER = 2; - public static final int TRAIT_SETTER = 3; - public static final int TRAIT_CLASS = 4; - public static final int TRAIT_FUNCTION = 5; - public static final int TRAIT_CONST = 6; - - - public String getModifiers(ConstantPool constants, boolean isStatic) { - String ret = ""; - if ((kindFlags & ATTR_Override) > 0) { - ret += "override"; - } - Multiname m = getMultiName(constants); - if (m != null) { - Namespace ns = m.getNamespace(constants); - if (ns != null) { - ret += " " + ns.getPrefix(constants); - } - } - if (isStatic) - ret += " static"; - if ((kindFlags & ATTR_Final) > 0) { - if (!isStatic) { - ret += " final"; - } - } - return ret.trim(); - } - - @Override - public String toString() { - return "name_index=" + name_index + " kind=" + kindType + " metadata=" + Helper.intArrToString(metadata); - } - - public String toString(ConstantPool constants) { - return constants.constant_multiname[name_index].toString(constants) + " kind=" + kindType + " metadata=" + Helper.intArrToString(metadata); - } - - public String convert(ConstantPool constants, MethodInfo[] methodInfo) { - return convert(constants, methodInfo, false); - } - - public String convert(ConstantPool constants, MethodInfo[] methodInfo, boolean isStatic) { - return constants.constant_multiname[name_index].toString(constants) + " kind=" + kindType + " metadata=" + Helper.intArrToString(metadata); - } - - public Multiname getMultiName(ConstantPool constants) { - if (name_index == 0) { - return null; - } else { - return constants.constant_multiname[name_index]; - } - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types.traits; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.types.MethodInfo; +import com.jpexs.asdec.abc.types.Multiname; +import com.jpexs.asdec.abc.types.Namespace; +import com.jpexs.asdec.helpers.Helper; + + +public class Trait { + + public int name_index; + public int kindType; + public int kindFlags; + public int metadata[] = new int[0]; + public long fileOffset; + public byte bytes[]; + public static final int ATTR_Final = 0x1; + public static final int ATTR_Override = 0x2; + public static final int ATTR_Metadata = 0x4; + + public static final int TRAIT_SLOT = 0; + public static final int TRAIT_METHOD = 1; + public static final int TRAIT_GETTER = 2; + public static final int TRAIT_SETTER = 3; + public static final int TRAIT_CLASS = 4; + public static final int TRAIT_FUNCTION = 5; + public static final int TRAIT_CONST = 6; + + + public String getModifiers(ConstantPool constants, boolean isStatic) { + String ret = ""; + if ((kindFlags & ATTR_Override) > 0) { + ret += "override"; + } + Multiname m = getMultiName(constants); + if (m != null) { + Namespace ns = m.getNamespace(constants); + if (ns != null) { + ret += " " + ns.getPrefix(constants); + } + } + if (isStatic) + ret += " static"; + if ((kindFlags & ATTR_Final) > 0) { + if (!isStatic) { + ret += " final"; + } + } + return ret.trim(); + } + + @Override + public String toString() { + return "name_index=" + name_index + " kind=" + kindType + " metadata=" + Helper.intArrToString(metadata); + } + + public String toString(ConstantPool constants) { + return constants.constant_multiname[name_index].toString(constants) + " kind=" + kindType + " metadata=" + Helper.intArrToString(metadata); + } + + public String convert(ConstantPool constants, MethodInfo[] methodInfo) { + return convert(constants, methodInfo, false); + } + + public String convert(ConstantPool constants, MethodInfo[] methodInfo, boolean isStatic) { + return constants.constant_multiname[name_index].toString(constants) + " kind=" + kindType + " metadata=" + Helper.intArrToString(metadata); + } + + public Multiname getMultiName(ConstantPool constants) { + if (name_index == 0) { + return null; + } else { + return constants.constant_multiname[name_index]; + } + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/types/traits/TraitClass.java b/trunk/src/com/jpexs/asdec/abc/types/traits/TraitClass.java index 627ffcc96..21db70290 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/traits/TraitClass.java +++ b/trunk/src/com/jpexs/asdec/abc/types/traits/TraitClass.java @@ -1,20 +1,34 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types.traits; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.helpers.Helper; - - -public class TraitClass extends Trait { - - public int slot_id; - public int class_info; - - @Override - public String toString(ConstantPool constants) { - return "Class " + constants.constant_multiname[name_index].toString(constants) + " slot=" + slot_id + " class_info=" + class_info + " metadata=" + Helper.intArrToString(metadata); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types.traits; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.helpers.Helper; + + +public class TraitClass extends Trait { + + public int slot_id; + public int class_info; + + @Override + public String toString(ConstantPool constants) { + return "Class " + constants.constant_multiname[name_index].toString(constants) + " slot=" + slot_id + " class_info=" + class_info + " metadata=" + Helper.intArrToString(metadata); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/types/traits/TraitFunction.java b/trunk/src/com/jpexs/asdec/abc/types/traits/TraitFunction.java index a46aca113..cc7cb969b 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/traits/TraitFunction.java +++ b/trunk/src/com/jpexs/asdec/abc/types/traits/TraitFunction.java @@ -1,20 +1,34 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types.traits; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.helpers.Helper; - - -public class TraitFunction extends Trait { - - public int slot_index; - public int method_info; - - @Override - public String toString(ConstantPool constants) { - return "Function " + constants.constant_multiname[name_index].toString(constants) + " slot=" + slot_index + " method_info=" + method_info + " metadata=" + Helper.intArrToString(metadata); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types.traits; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.helpers.Helper; + + +public class TraitFunction extends Trait { + + public int slot_index; + public int method_info; + + @Override + public String toString(ConstantPool constants) { + return "Function " + constants.constant_multiname[name_index].toString(constants) + " slot=" + slot_index + " method_info=" + method_info + " metadata=" + Helper.intArrToString(metadata); + } +} diff --git a/trunk/src/com/jpexs/asdec/abc/types/traits/TraitMethodGetterSetter.java b/trunk/src/com/jpexs/asdec/abc/types/traits/TraitMethodGetterSetter.java index b127b6422..7f6c7540f 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/traits/TraitMethodGetterSetter.java +++ b/trunk/src/com/jpexs/asdec/abc/types/traits/TraitMethodGetterSetter.java @@ -1,38 +1,52 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types.traits; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.types.MethodInfo; -import com.jpexs.asdec.helpers.Helper; - - -public class TraitMethodGetterSetter extends Trait { - - public int disp_id; //compiler assigned value that helps overriding - public int method_info; - - @Override - public String toString(ConstantPool constants) { - return "0x" + Helper.formatAddress(fileOffset) + " " + Helper.byteArrToString(bytes) + " MethodGetterSetter " + constants.constant_multiname[name_index].toString(constants) + " disp_id=" + disp_id + " method_info=" + method_info + " metadata=" + Helper.intArrToString(metadata); - } - - @Override - public String convert(ConstantPool constants, MethodInfo[] methodInfo, boolean isStatic) { - String modifier = getModifiers(constants, isStatic) + " "; - if (modifier.equals(" ")) modifier = ""; - String addKind = ""; - if (kindType == TRAIT_GETTER) addKind = "get "; - if (kindType == TRAIT_SETTER) addKind = "set "; - return modifier + "function " + addKind + getMethodName(constants) + "(" + methodInfo[method_info].getParamStr(constants) + ") : " + methodInfo[method_info].getReturnTypeStr(constants); - } - - - public String getMethodName(ConstantPool constants) { - return constants.constant_multiname[name_index].getName(constants); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types.traits; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.types.MethodInfo; +import com.jpexs.asdec.helpers.Helper; + + +public class TraitMethodGetterSetter extends Trait { + + public int disp_id; //compiler assigned value that helps overriding + public int method_info; + + @Override + public String toString(ConstantPool constants) { + return "0x" + Helper.formatAddress(fileOffset) + " " + Helper.byteArrToString(bytes) + " MethodGetterSetter " + constants.constant_multiname[name_index].toString(constants) + " disp_id=" + disp_id + " method_info=" + method_info + " metadata=" + Helper.intArrToString(metadata); + } + + @Override + public String convert(ConstantPool constants, MethodInfo[] methodInfo, boolean isStatic) { + String modifier = getModifiers(constants, isStatic) + " "; + if (modifier.equals(" ")) modifier = ""; + String addKind = ""; + if (kindType == TRAIT_GETTER) addKind = "get "; + if (kindType == TRAIT_SETTER) addKind = "set "; + return modifier + "function " + addKind + getMethodName(constants) + "(" + methodInfo[method_info].getParamStr(constants) + ") : " + methodInfo[method_info].getReturnTypeStr(constants); + } + + + public String getMethodName(ConstantPool constants) { + return constants.constant_multiname[name_index].getName(constants); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/abc/types/traits/TraitSlotConst.java b/trunk/src/com/jpexs/asdec/abc/types/traits/TraitSlotConst.java index 4418cb08e..8009093ff 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/traits/TraitSlotConst.java +++ b/trunk/src/com/jpexs/asdec/abc/types/traits/TraitSlotConst.java @@ -1,61 +1,75 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types.traits; - -import com.jpexs.asdec.abc.avm2.ConstantPool; -import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; -import com.jpexs.asdec.abc.types.MethodInfo; -import com.jpexs.asdec.abc.types.ValueKind; -import com.jpexs.asdec.helpers.Helper; -import com.jpexs.asdec.helpers.Highlighting; - - -public class TraitSlotConst extends Trait { - - public int slot_id; - public int type_index; - public int value_index; - public int value_kind; - - public TreeItem assignedValue; - - @Override - public String toString(ConstantPool constants) { - String typeStr = "*"; - if (type_index > 0) { - typeStr = constants.constant_multiname[type_index].toString(constants); - } - return "0x" + Helper.formatAddress(fileOffset) + " " + Helper.byteArrToString(bytes) + " SlotConst " + constants.constant_multiname[name_index].toString(constants) + " slot=" + slot_id + " type=" + typeStr + " value=" + (new ValueKind(value_index, value_kind)).toString(constants) + " metadata=" + Helper.intArrToString(metadata); - } - - public String getNameValueStr(ConstantPool constants) { - String typeStr = "*"; - if (type_index > 0) { - typeStr = constants.constant_multiname[type_index].getName(constants); - } - String valueStr = ""; - if (value_kind != 0) { - valueStr = " = " + (new ValueKind(value_index, value_kind)).toString(constants); - } - - if (assignedValue != null) { - valueStr = " = " + Highlighting.stripHilights(assignedValue.toString(constants)); - } - - String slotconst = "var"; - if (kindType == TRAIT_CONST) { - slotconst = "const"; - } - return slotconst + " " + constants.constant_multiname[name_index].getName(constants) + ":" + typeStr + valueStr; - } - - @Override - public String convert(ConstantPool constants, MethodInfo[] methodInfo, boolean isStatic) { - String modifier = getModifiers(constants, isStatic) + " "; - if (modifier.equals(" ")) modifier = ""; - return modifier + getNameValueStr(constants); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types.traits; + +import com.jpexs.asdec.abc.avm2.ConstantPool; +import com.jpexs.asdec.abc.avm2.treemodel.TreeItem; +import com.jpexs.asdec.abc.types.MethodInfo; +import com.jpexs.asdec.abc.types.ValueKind; +import com.jpexs.asdec.helpers.Helper; +import com.jpexs.asdec.helpers.Highlighting; + + +public class TraitSlotConst extends Trait { + + public int slot_id; + public int type_index; + public int value_index; + public int value_kind; + + public TreeItem assignedValue; + + @Override + public String toString(ConstantPool constants) { + String typeStr = "*"; + if (type_index > 0) { + typeStr = constants.constant_multiname[type_index].toString(constants); + } + return "0x" + Helper.formatAddress(fileOffset) + " " + Helper.byteArrToString(bytes) + " SlotConst " + constants.constant_multiname[name_index].toString(constants) + " slot=" + slot_id + " type=" + typeStr + " value=" + (new ValueKind(value_index, value_kind)).toString(constants) + " metadata=" + Helper.intArrToString(metadata); + } + + public String getNameValueStr(ConstantPool constants) { + String typeStr = "*"; + if (type_index > 0) { + typeStr = constants.constant_multiname[type_index].getName(constants); + } + String valueStr = ""; + if (value_kind != 0) { + valueStr = " = " + (new ValueKind(value_index, value_kind)).toString(constants); + } + + if (assignedValue != null) { + valueStr = " = " + Highlighting.stripHilights(assignedValue.toString(constants)); + } + + String slotconst = "var"; + if (kindType == TRAIT_CONST) { + slotconst = "const"; + } + return slotconst + " " + constants.constant_multiname[name_index].getName(constants) + ":" + typeStr + valueStr; + } + + @Override + public String convert(ConstantPool constants, MethodInfo[] methodInfo, boolean isStatic) { + String modifier = getModifiers(constants, isStatic) + " "; + if (modifier.equals(" ")) modifier = ""; + return modifier + getNameValueStr(constants); + } + +} diff --git a/trunk/src/com/jpexs/asdec/abc/types/traits/Traits.java b/trunk/src/com/jpexs/asdec/abc/types/traits/Traits.java index 84431ffd8..8236b5fa4 100644 --- a/trunk/src/com/jpexs/asdec/abc/types/traits/Traits.java +++ b/trunk/src/com/jpexs/asdec/abc/types/traits/Traits.java @@ -1,43 +1,57 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.abc.types.traits; - -import com.jpexs.asdec.abc.avm2.ConstantPool; - - -public class Traits { - public Trait traits[] = new Trait[0]; - - @Override - public String toString() { - String s = ""; - for (int t = 0; t < traits.length; t++) { - if (t > 0) s += "\r\n"; - s += traits[t].toString(); - } - return s; - } - - - public String toString(ConstantPool constants) { - String s = ""; - for (int t = 0; t < traits.length; t++) { - if (t > 0) s += "\r\n"; - s += traits[t].toString(constants); - } - return s; - } - - public String convert(ConstantPool constants, String prefix) { - String s = ""; - for (int t = 0; t < traits.length; t++) { - if (t > 0) s += "\r\n"; - s += prefix + traits[t].convert(constants, null); - } - return s; - } - - -} \ No newline at end of file +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.abc.types.traits; + +import com.jpexs.asdec.abc.avm2.ConstantPool; + + +public class Traits { + public Trait traits[] = new Trait[0]; + + @Override + public String toString() { + String s = ""; + for (int t = 0; t < traits.length; t++) { + if (t > 0) s += "\r\n"; + s += traits[t].toString(); + } + return s; + } + + + public String toString(ConstantPool constants) { + String s = ""; + for (int t = 0; t < traits.length; t++) { + if (t > 0) s += "\r\n"; + s += traits[t].toString(constants); + } + return s; + } + + public String convert(ConstantPool constants, String prefix) { + String s = ""; + for (int t = 0; t < traits.length; t++) { + if (t > 0) s += "\r\n"; + s += prefix + traits[t].convert(constants, null); + } + return s; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/action/Action.java b/trunk/src/com/jpexs/asdec/action/Action.java index 9d13d8613..9574ff9e2 100644 --- a/trunk/src/com/jpexs/asdec/action/Action.java +++ b/trunk/src/com/jpexs/asdec/action/Action.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action; import com.jpexs.asdec.SWFOutputStream; diff --git a/trunk/src/com/jpexs/asdec/action/UnknownJumpException.java b/trunk/src/com/jpexs/asdec/action/UnknownJumpException.java index 00a19916a..296296738 100644 --- a/trunk/src/com/jpexs/asdec/action/UnknownJumpException.java +++ b/trunk/src/com/jpexs/asdec/action/UnknownJumpException.java @@ -1,51 +1,69 @@ -package com.jpexs.asdec.action; - -import com.jpexs.asdec.action.treemodel.TreeItem; - -import java.util.List; -import java.util.Stack; - -/** - * Raised when actual address has been referenced with an unknown jump - * - * @author JPEXS - */ -public class UnknownJumpException extends RuntimeException { - /** - * Actual stack - */ - public Stack stack; - /** - * Actual address - */ - public long addr; - /** - * Output of the method before raising the exception - */ - public List output; - - /** - * Constructor - * - * @param stack Actual stack - * @param addr Actual address - * @param output Output of the method before raising the exception - */ - public UnknownJumpException(Stack stack, long addr, List output) { - this.stack = stack; - this.addr = addr; - this.output = output; - } - - /** - * Returns a string representation of the object - * - * @return a string representation of the object. - */ - @Override - public String toString() { - return "Unknown jump to " + addr; - } - - -} \ No newline at end of file +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action; + +import com.jpexs.asdec.action.treemodel.TreeItem; + +import java.util.List; +import java.util.Stack; + +/** + * Raised when actual address has been referenced with an unknown jump + * + * @author JPEXS + */ +public class UnknownJumpException extends RuntimeException { + /** + * Actual stack + */ + public Stack stack; + /** + * Actual address + */ + public long addr; + /** + * Output of the method before raising the exception + */ + public List output; + + /** + * Constructor + * + * @param stack Actual stack + * @param addr Actual address + * @param output Output of the method before raising the exception + */ + public UnknownJumpException(Stack stack, long addr, List output) { + this.stack = stack; + this.addr = addr; + this.output = output; + } + + /** + * Returns a string representation of the object + * + * @return a string representation of the object. + */ + @Override + public String toString() { + return "Unknown jump to " + addr; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/action/gui/MainFrame.java b/trunk/src/com/jpexs/asdec/action/gui/MainFrame.java index 1ff93817a..310a2362b 100644 --- a/trunk/src/com/jpexs/asdec/action/gui/MainFrame.java +++ b/trunk/src/com/jpexs/asdec/action/gui/MainFrame.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.gui; import com.jpexs.asdec.Main; diff --git a/trunk/src/com/jpexs/asdec/action/gui/TagTreeItem.java b/trunk/src/com/jpexs/asdec/action/gui/TagTreeItem.java index 568e3e702..a7065c0bf 100644 --- a/trunk/src/com/jpexs/asdec/action/gui/TagTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/gui/TagTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.gui; import java.util.ArrayList; diff --git a/trunk/src/com/jpexs/asdec/action/gui/TagTreeModel.java b/trunk/src/com/jpexs/asdec/action/gui/TagTreeModel.java index 16e003bf2..e0f8e1d37 100644 --- a/trunk/src/com/jpexs/asdec/action/gui/TagTreeModel.java +++ b/trunk/src/com/jpexs/asdec/action/gui/TagTreeModel.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.gui; import com.jpexs.asdec.tags.*; diff --git a/trunk/src/com/jpexs/asdec/action/parser/ASMParser.java b/trunk/src/com/jpexs/asdec/action/parser/ASMParser.java index 936ae1efd..105051c10 100644 --- a/trunk/src/com/jpexs/asdec/action/parser/ASMParser.java +++ b/trunk/src/com/jpexs/asdec/action/parser/ASMParser.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.parser; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/parser/FlasmLexer.java b/trunk/src/com/jpexs/asdec/action/parser/FlasmLexer.java index 2fc149f6e..6ce7bcc88 100644 --- a/trunk/src/com/jpexs/asdec/action/parser/FlasmLexer.java +++ b/trunk/src/com/jpexs/asdec/action/parser/FlasmLexer.java @@ -1,6 +1,20 @@ -/* The following code was generated by JFlex 1.4.3 on 10.8.10 18:06 */ - -/* Flash assembler language lexer specification */ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ package com.jpexs.asdec.action.parser; diff --git a/trunk/src/com/jpexs/asdec/action/parser/Label.java b/trunk/src/com/jpexs/asdec/action/parser/Label.java index aba64ec6a..15d470bc1 100644 --- a/trunk/src/com/jpexs/asdec/action/parser/Label.java +++ b/trunk/src/com/jpexs/asdec/action/parser/Label.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.parser; public class Label { diff --git a/trunk/src/com/jpexs/asdec/action/parser/ParseException.java b/trunk/src/com/jpexs/asdec/action/parser/ParseException.java index 520d2cd01..25a870ab4 100644 --- a/trunk/src/com/jpexs/asdec/action/parser/ParseException.java +++ b/trunk/src/com/jpexs/asdec/action/parser/ParseException.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.parser; - - -public class ParseException extends Exception { - public long line; - public String text; - - public ParseException(String text, long line) { - super("ParseException:" + text + " on line " + line); - this.line = line; - this.text = text; - } -} \ No newline at end of file +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.parser; + + +public class ParseException extends Exception { + public long line; + public String text; + + public ParseException(String text, long line) { + super("ParseException:" + text + " on line " + line); + this.line = line; + this.text = text; + } +} diff --git a/trunk/src/com/jpexs/asdec/action/parser/ParsedSymbol.java b/trunk/src/com/jpexs/asdec/action/parser/ParsedSymbol.java index 95da18007..88bced4a5 100644 --- a/trunk/src/com/jpexs/asdec/action/parser/ParsedSymbol.java +++ b/trunk/src/com/jpexs/asdec/action/parser/ParsedSymbol.java @@ -1,39 +1,53 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.parser; - - -public class ParsedSymbol { - public int type; - public Object value; - - public static final int TYPE_STRING = 1; - public static final int TYPE_BLOCK_END = 2; - public static final int TYPE_INSTRUCTION_NAME = 3; - public static final int TYPE_INTEGER = 4; - public static final int TYPE_FLOAT = 5; - public static final int TYPE_BOOLEAN = 11; - public static final int TYPE_IDENTIFIER = 6; - public static final int TYPE_EOF = 7; - public static final int TYPE_LABEL = 8; - public static final int TYPE_COMMENT = 9; - public static final int TYPE_BLOCK_START = 10; - public static final int TYPE_REGISTER = 12; - public static final int TYPE_CONSTANT = 13; - public static final int TYPE_NULL = 14; - public static final int TYPE_UNDEFINED = 15; - public static final int TYPE_EOL = 16; - public static final int TYPE_CONSTANT_LITERAL=17; - - public ParsedSymbol(int type, Object value) { - this.type = type; - this.value = value; - } - - public ParsedSymbol(int type) { - this.type = type; - } - -} \ No newline at end of file +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.parser; + + +public class ParsedSymbol { + public int type; + public Object value; + + public static final int TYPE_STRING = 1; + public static final int TYPE_BLOCK_END = 2; + public static final int TYPE_INSTRUCTION_NAME = 3; + public static final int TYPE_INTEGER = 4; + public static final int TYPE_FLOAT = 5; + public static final int TYPE_BOOLEAN = 11; + public static final int TYPE_IDENTIFIER = 6; + public static final int TYPE_EOF = 7; + public static final int TYPE_LABEL = 8; + public static final int TYPE_COMMENT = 9; + public static final int TYPE_BLOCK_START = 10; + public static final int TYPE_REGISTER = 12; + public static final int TYPE_CONSTANT = 13; + public static final int TYPE_NULL = 14; + public static final int TYPE_UNDEFINED = 15; + public static final int TYPE_EOL = 16; + public static final int TYPE_CONSTANT_LITERAL=17; + + public ParsedSymbol(int type, Object value) { + this.type = type; + this.value = value; + } + + public ParsedSymbol(int type) { + this.type = type; + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionGetURL.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionGetURL.java index 71a0e04e6..bea6fd88a 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionGetURL.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionGetURL.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf3; import com.jpexs.asdec.SWFInputStream; diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionGoToLabel.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionGoToLabel.java index 71a0244ef..1a7949b1a 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionGoToLabel.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionGoToLabel.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf3; import com.jpexs.asdec.SWFInputStream; diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionGotoFrame.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionGotoFrame.java index 223ffd891..71714b3df 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionGotoFrame.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionGotoFrame.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf3; import com.jpexs.asdec.SWFInputStream; diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionNextFrame.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionNextFrame.java index 20b56959b..1e43cd99a 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionNextFrame.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionNextFrame.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf3; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionPlay.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionPlay.java index dadd0d863..d0f9c2491 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionPlay.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionPlay.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf3; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionPrevFrame.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionPrevFrame.java index 0b992fb75..9316bb817 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionPrevFrame.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionPrevFrame.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf3; import com.jpexs.asdec.action.Action; @@ -23,4 +41,4 @@ public class ActionPrevFrame extends Action { 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 811bf95e6..7f646301f 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionSetTarget.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionSetTarget.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf3; import com.jpexs.asdec.SWFInputStream; diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionStop.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionStop.java index 56212358e..7549d35f6 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionStop.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionStop.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf3; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionStopSounds.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionStopSounds.java index 234b789a4..7a27f3db3 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionStopSounds.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionStopSounds.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf3; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionToggleQuality.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionToggleQuality.java index 6b3285163..43d5fdb60 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionToggleQuality.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionToggleQuality.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf3; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf3/ActionWaitForFrame.java b/trunk/src/com/jpexs/asdec/action/swf3/ActionWaitForFrame.java index 9e765b009..19a6b11f8 100644 --- a/trunk/src/com/jpexs/asdec/action/swf3/ActionWaitForFrame.java +++ b/trunk/src/com/jpexs/asdec/action/swf3/ActionWaitForFrame.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf3; import com.jpexs.asdec.SWFInputStream; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionAdd.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionAdd.java index f9c3ef7c4..6403dfea7 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionAdd.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionAdd.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionAnd.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionAnd.java index 0d49ea4be..d517de28c 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionAnd.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionAnd.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionAsciiToChar.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionAsciiToChar.java index 426d44636..4d92870b4 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionAsciiToChar.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionAsciiToChar.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionCall.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionCall.java index 9b4e0f285..29c8ed735 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionCall.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionCall.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionCharToAscii.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionCharToAscii.java index 293f45104..5019fba75 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionCharToAscii.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionCharToAscii.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionCloneSprite.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionCloneSprite.java index 2e3af2053..b566849cb 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionCloneSprite.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionCloneSprite.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionDivide.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionDivide.java index 9444914a6..75a850f46 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionDivide.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionDivide.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionEndDrag.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionEndDrag.java index e6fcb2ef2..b8b816b7f 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionEndDrag.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionEndDrag.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; @@ -23,4 +41,4 @@ public class ActionEndDrag extends Action { 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 245c12268..4855503b6 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionEquals.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionEquals.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetProperty.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetProperty.java index b7acb394f..b5be53db6 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetProperty.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetProperty.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; @@ -32,4 +50,4 @@ public class ActionGetProperty extends Action { } stack.push(new GetPropertyTreeItem(this, target, indexInt)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetTime.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetTime.java index 1a2bd210c..32f2a65e0 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetTime.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetTime.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; @@ -23,4 +41,4 @@ public class ActionGetTime extends Action { 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 414205b4f..c44c84c05 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetURL2.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetURL2.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.SWFInputStream; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetVariable.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetVariable.java index b21d322ea..cc466f97f 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionGetVariable.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionGetVariable.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionGotoFrame2.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionGotoFrame2.java index cfde4eba8..f4d3ed900 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionGotoFrame2.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionGotoFrame2.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.SWFInputStream; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionIf.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionIf.java index 3a941b8dc..3710c1031 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionIf.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionIf.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.SWFInputStream; @@ -60,4 +78,4 @@ public class ActionIf extends Action { ret.add(this); return ret; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionJump.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionJump.java index d44e15ea5..645a384e0 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionJump.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionJump.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.SWFInputStream; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionLess.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionLess.java index c9732dee9..715857c57 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionLess.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionLess.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBAsciiToChar.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBAsciiToChar.java index 646baa760..d03e470f0 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBAsciiToChar.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBAsciiToChar.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionMBAsciiToChar extends Action { TreeItem a = stack.pop(); stack.push(new MBAsciiToCharTreeItem(this, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBCharToAscii.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBCharToAscii.java index 1c385e1b1..d5cdf32ac 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBCharToAscii.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBCharToAscii.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; @@ -23,4 +41,4 @@ public class ActionMBCharToAscii extends Action { TreeItem a = stack.pop(); stack.push(new MBCharToAsciiTreeItem(this, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringExtract.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringExtract.java index 5c019706b..c66cf002a 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringExtract.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringExtract.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringLength.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringLength.java index c8e96a7ed..b08cbb9bc 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringLength.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionMBStringLength.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionMultiply.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionMultiply.java index 3f149ba9a..25221eeb6 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionMultiply.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionMultiply.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionNot.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionNot.java index 544ae077a..0aade10c2 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionNot.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionNot.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionOr.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionOr.java index e2eba9fba..033173e00 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionOr.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionOr.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionPop.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionPop.java index 02a0fe745..1b3183766 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionPop.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionPop.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionPush.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionPush.java index 283c385e8..73bcd5713 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionPush.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionPush.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.SWFInputStream; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionRandomNumber.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionRandomNumber.java index e1167014f..2493bd2e5 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionRandomNumber.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionRandomNumber.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionRandomNumber extends Action { TreeItem maximum = stack.pop(); stack.push(new RandomNumberTreeItem(this, maximum)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionRemoveSprite.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionRemoveSprite.java index e5d8bf211..45a6444b3 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionRemoveSprite.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionRemoveSprite.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionRemoveSprite extends Action { TreeItem target = stack.pop(); output.add(new RemoveSpriteTreeItem(this, target)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionSetProperty.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionSetProperty.java index 35fe7f9f3..b5651c0a7 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionSetProperty.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionSetProperty.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; @@ -33,4 +51,4 @@ public class ActionSetProperty extends Action { } output.add(new SetPropertyTreeItem(this, target, indexInt, value)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionSetTarget2.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionSetTarget2.java index f93eb3126..d88ee55f3 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionSetTarget2.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionSetTarget2.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionSetVariable.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionSetVariable.java index 5b0d9e1e3..8acafdb50 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionSetVariable.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionSetVariable.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionSetVariable extends Action { TreeItem name = stack.pop(); output.add(new SetVariableTreeItem(this, name, value)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionStartDrag.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionStartDrag.java index ca1f4d1f8..235f41f16 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionStartDrag.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionStartDrag.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; @@ -51,4 +69,4 @@ public class ActionStartDrag extends Action { } output.add(new StartDragTreeItem(this, target, lockCenter, constrain, x1, y1, x2, y2)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringAdd.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringAdd.java index 158c2e4e6..0c1ccd8c2 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringAdd.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringAdd.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringEquals.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringEquals.java index c71cf9df5..7a5163eec 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringEquals.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringEquals.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringExtract.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringExtract.java index 2354dd195..8d65c5b78 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringExtract.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringExtract.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLength.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLength.java index c037b0b1d..6e82967e7 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLength.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLength.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLess.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLess.java index 4ba84f194..2be68e2ae 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLess.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionStringLess.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionSubtract.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionSubtract.java index d9766e359..752f5442a 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionSubtract.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionSubtract.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionToInteger.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionToInteger.java index 0af04e99b..41f1e7cdc 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionToInteger.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionToInteger.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionTrace.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionTrace.java index 6ce5caa9e..d9ff7f6ac 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionTrace.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionTrace.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionTrace extends Action { TreeItem value = stack.pop(); output.add(new TraceTreeItem(this, value)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ActionWaitForFrame2.java b/trunk/src/com/jpexs/asdec/action/swf4/ActionWaitForFrame2.java index c172ce101..499b85e44 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ActionWaitForFrame2.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ActionWaitForFrame2.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.SWFInputStream; @@ -49,4 +67,4 @@ public class ActionWaitForFrame2 extends Action { TreeItem frame = stack.pop(); output.add(new WaitForFrame2TreeItem(this, frame, skipCount)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf4/ConstantIndex.java b/trunk/src/com/jpexs/asdec/action/swf4/ConstantIndex.java index 90abf38c1..111811971 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/ConstantIndex.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/ConstantIndex.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; import com.jpexs.asdec.helpers.Helper; diff --git a/trunk/src/com/jpexs/asdec/action/swf4/Null.java b/trunk/src/com/jpexs/asdec/action/swf4/Null.java index 9fbe1ce04..9f1217cfa 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/Null.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/Null.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; public class Null { diff --git a/trunk/src/com/jpexs/asdec/action/swf4/RegisterNumber.java b/trunk/src/com/jpexs/asdec/action/swf4/RegisterNumber.java index 60ec3cdff..f56e294d6 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/RegisterNumber.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/RegisterNumber.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; public class RegisterNumber { diff --git a/trunk/src/com/jpexs/asdec/action/swf4/Undefined.java b/trunk/src/com/jpexs/asdec/action/swf4/Undefined.java index 4148c3728..e9a14ab1d 100644 --- a/trunk/src/com/jpexs/asdec/action/swf4/Undefined.java +++ b/trunk/src/com/jpexs/asdec/action/swf4/Undefined.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf4; public class Undefined { diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionAdd2.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionAdd2.java index 1e96f4163..6f0b9df3e 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionAdd2.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionAdd2.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionAdd2 extends Action { TreeItem b = stack.pop(); stack.push(new AddTreeItem(this, b, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitAnd.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitAnd.java index 28a49de41..0ee241253 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitAnd.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitAnd.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionBitAnd extends Action { TreeItem b = stack.pop(); stack.push(new BitAndTreeItem(this, b, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitLShift.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitLShift.java index fe60c4a15..96f3fd6bc 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitLShift.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitLShift.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionBitLShift extends Action { TreeItem b = stack.pop(); stack.push(new LShiftTreeItem(this, b, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitOr.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitOr.java index 6c5205f0b..074896420 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitOr.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitOr.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionBitOr extends Action { TreeItem b = stack.pop(); stack.push(new BitOrTreeItem(this, b, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitRShift.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitRShift.java index f17a58991..732cce626 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitRShift.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitRShift.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionBitRShift extends Action { TreeItem b = stack.pop(); stack.push(new RShiftTreeItem(this, b, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitURShift.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitURShift.java index b5e4076cf..c7ffa4825 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitURShift.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitURShift.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionBitURShift extends Action { TreeItem b = stack.pop(); stack.push(new URShiftTreeItem(this, b, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitXor.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitXor.java index 953af4f3e..a2215c285 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionBitXor.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionBitXor.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionBitXor extends Action { TreeItem b = stack.pop(); stack.push(new BitXorTreeItem(this, b, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionCallFunction.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionCallFunction.java index cb2f6e1b5..48e5c91e4 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionCallFunction.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionCallFunction.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -30,4 +48,4 @@ public class ActionCallFunction extends Action { } stack.push(new CallFunctionTreeItem(this, functionName, args)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionCallMethod.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionCallMethod.java index 2199eec72..2ca909af1 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionCallMethod.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionCallMethod.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -31,4 +49,4 @@ public class ActionCallMethod extends Action { } stack.push(new CallMethodTreeItem(this, scriptObject, methodName, args)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionConstantPool.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionConstantPool.java index 5939bddf5..bada533d1 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionConstantPool.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionConstantPool.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.SWFInputStream; @@ -69,4 +87,4 @@ public class ActionConstantPool extends Action { 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 640ecfa58..7d4e0a670 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionDecrement.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionDecrement.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionDecrement extends Action { TreeItem a = stack.pop(); stack.push(new DecrementTreeItem(this, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineFunction.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineFunction.java index 447facbc6..1fc504339 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineFunction.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineFunction.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.SWFInputStream; @@ -111,4 +129,4 @@ public class ActionDefineFunction extends Action { public List getAllIfsOrJumps() { return Action.getActionsAllIfsOrJumps(code); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal.java index ddc359def..e8eef4857 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionDefineLocal extends Action { TreeItem name = stack.pop(); output.add(new DefineLocalTreeItem(this, name, value)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal2.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal2.java index dbabd7ad9..3b5a2beea 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal2.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionDefineLocal2.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionDefineLocal2 extends Action { TreeItem name = stack.pop(); output.add(new DefineLocalTreeItem(this, name, null)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete.java index 12bf58319..a3a6375d5 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -29,4 +47,4 @@ public class ActionDelete extends Action { output.add(new DeleteTreeItem(this, object, propertyName)); stack.push(new DirectValueTreeItem(this, Boolean.TRUE, constants)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete2.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete2.java index 1a3deac3a..986e97cf8 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete2.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionDelete2.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -27,4 +45,4 @@ public class ActionDelete2 extends Action { output.add(new DeleteTreeItem(this, null, propertyName)); stack.push(new DirectValueTreeItem(this, Boolean.TRUE, constants)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionEnumerate.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionEnumerate.java index 84e11323e..e00545fe0 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionEnumerate.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionEnumerate.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionEnumerate extends Action { TreeItem object = stack.pop(); stack.push(new EnumerateTreeItem(this, object)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionEquals2.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionEquals2.java index b16a82a88..58c61aaf5 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionEquals2.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionEquals2.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionEquals2 extends Action { TreeItem b = stack.pop(); stack.push(new EqTreeItem(this, b, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionGetMember.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionGetMember.java index b8ae3374e..0a73d5167 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionGetMember.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionGetMember.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionGetMember extends Action { TreeItem object = stack.pop(); stack.push(new GetMemberTreeItem(this, object, functionName)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionIncrement.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionIncrement.java index 73f09ab3e..5508e55bd 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionIncrement.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionIncrement.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionIncrement extends Action { TreeItem a = stack.pop(); stack.push(new IncrementTreeItem(this, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionInitArray.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionInitArray.java index db28213ab..b71265c49 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionInitArray.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionInitArray.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -29,4 +47,4 @@ public class ActionInitArray extends Action { public String toString() { return "InitArray"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionInitObject.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionInitObject.java index e6035fef6..7eb9c463e 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionInitObject.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionInitObject.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -31,4 +49,4 @@ public class ActionInitObject extends Action { } stack.push(new InitObjectTreeItem(this, names, values)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionLess2.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionLess2.java index 3df1aa5fb..a4df7c38d 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionLess2.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionLess2.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionLess2 extends Action { TreeItem b = stack.pop(); stack.push(new LtTreeItem(this, b, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionModulo.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionModulo.java index 2ef551eb5..f2f11ab02 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionModulo.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionModulo.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionModulo extends Action { TreeItem b = stack.pop(); stack.push(new ModuloTreeItem(this, b, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionNewMethod.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionNewMethod.java index 4f3b42ef0..816753ae1 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionNewMethod.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionNewMethod.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -31,4 +49,4 @@ public class ActionNewMethod extends Action { } stack.push(new NewMethodTreeItem(this, scriptObject, methodName, args)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionNewObject.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionNewObject.java index e97c6cec4..44be4030b 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionNewObject.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionNewObject.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -30,4 +48,4 @@ public class ActionNewObject extends Action { } stack.push(new NewObjectTreeItem(this, objectName, args)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionPushDuplicate.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionPushDuplicate.java index 22c388705..a1af9a1fd 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionPushDuplicate.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionPushDuplicate.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionPushDuplicate extends Action { stack.push(value); stack.push(value); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionReturn.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionReturn.java index 6daf81d79..11c59978c 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionReturn.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionReturn.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionReturn extends Action { TreeItem value = stack.pop(); output.add(new ReturnTreeItem(this, value)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionSetMember.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionSetMember.java index f1f1a141f..7f5a2fea3 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionSetMember.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionSetMember.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -26,4 +44,4 @@ public class ActionSetMember extends Action { TreeItem object = stack.pop(); output.add(new SetMemberTreeItem(this, object, objectName, value)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionStackSwap.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionStackSwap.java index 8c555a277..4928a0ce5 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionStackSwap.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionStackSwap.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionStackSwap extends Action { stack.push(a); stack.push(b); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionStoreRegister.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionStoreRegister.java index 54beb39b8..962c9c734 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionStoreRegister.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionStoreRegister.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.SWFInputStream; @@ -54,4 +72,4 @@ public class ActionStoreRegister extends Action { } 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 7e3b9878d..52473a0a3 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionTargetPath.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionTargetPath.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionTargetPath extends Action { TreeItem object = stack.pop(); stack.push(new TargetPathTreeItem(this, object)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionToNumber.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionToNumber.java index acac38a2d..7e91e7771 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionToNumber.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionToNumber.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionToNumber extends Action { TreeItem object = stack.pop(); stack.push(new ToNumberTreeItem(this, object)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionToString.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionToString.java index 1b959d62b..fce6659c9 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionToString.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionToString.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionToString extends Action { TreeItem object = stack.pop(); stack.push(new ToStringTreeItem(this, object)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionTypeOf.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionTypeOf.java index 2ce32eb40..ea2b66694 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionTypeOf.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionTypeOf.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionTypeOf extends Action { TreeItem object = stack.pop(); stack.push(new TypeOfTreeItem(this, object)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf5/ActionWith.java b/trunk/src/com/jpexs/asdec/action/swf5/ActionWith.java index 214482895..e2b43e619 100644 --- a/trunk/src/com/jpexs/asdec/action/swf5/ActionWith.java +++ b/trunk/src/com/jpexs/asdec/action/swf5/ActionWith.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf5; import com.jpexs.asdec.SWFInputStream; @@ -65,4 +83,4 @@ public class ActionWith extends Action { public List getAllIfsOrJumps() { return Action.getActionsAllIfsOrJumps(actions); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf6/ActionEnumerate2.java b/trunk/src/com/jpexs/asdec/action/swf6/ActionEnumerate2.java index 101aa09c4..9b7d51e5e 100644 --- a/trunk/src/com/jpexs/asdec/action/swf6/ActionEnumerate2.java +++ b/trunk/src/com/jpexs/asdec/action/swf6/ActionEnumerate2.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf6; import com.jpexs.asdec.action.Action; @@ -23,4 +41,4 @@ public class ActionEnumerate2 extends Action { TreeItem object = stack.pop(); stack.push(new EnumerateTreeItem(this, object)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf6/ActionGreater.java b/trunk/src/com/jpexs/asdec/action/swf6/ActionGreater.java index 73afd5a0d..3718e050f 100644 --- a/trunk/src/com/jpexs/asdec/action/swf6/ActionGreater.java +++ b/trunk/src/com/jpexs/asdec/action/swf6/ActionGreater.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf6; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionGreater extends Action { TreeItem b = stack.pop(); stack.push(new GtTreeItem(this, b, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf6/ActionInstanceOf.java b/trunk/src/com/jpexs/asdec/action/swf6/ActionInstanceOf.java index 34babe4df..240500372 100644 --- a/trunk/src/com/jpexs/asdec/action/swf6/ActionInstanceOf.java +++ b/trunk/src/com/jpexs/asdec/action/swf6/ActionInstanceOf.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf6; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionInstanceOf extends Action { TreeItem b = stack.pop(); stack.push(new InstanceOfTreeItem(this, b, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf6/ActionStrictEquals.java b/trunk/src/com/jpexs/asdec/action/swf6/ActionStrictEquals.java index d7c82b2ca..bf85efbe5 100644 --- a/trunk/src/com/jpexs/asdec/action/swf6/ActionStrictEquals.java +++ b/trunk/src/com/jpexs/asdec/action/swf6/ActionStrictEquals.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf6; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionStrictEquals extends Action { TreeItem b = stack.pop(); stack.push(new StrictEqTreeItem(this, b, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf6/ActionStringGreater.java b/trunk/src/com/jpexs/asdec/action/swf6/ActionStringGreater.java index d23612772..59b5a0459 100644 --- a/trunk/src/com/jpexs/asdec/action/swf6/ActionStringGreater.java +++ b/trunk/src/com/jpexs/asdec/action/swf6/ActionStringGreater.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf6; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionStringGreater extends Action { TreeItem b = stack.pop(); stack.push(new GtTreeItem(this, b, a)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf7/ActionCastOp.java b/trunk/src/com/jpexs/asdec/action/swf7/ActionCastOp.java index b156ed76f..8c104578f 100644 --- a/trunk/src/com/jpexs/asdec/action/swf7/ActionCastOp.java +++ b/trunk/src/com/jpexs/asdec/action/swf7/ActionCastOp.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf7; import com.jpexs.asdec.action.Action; @@ -25,4 +43,4 @@ public class ActionCastOp extends Action { TreeItem constructor = stack.pop(); stack.push(new CastOpTreeItem(this, constructor, object)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf7/ActionDefineFunction2.java b/trunk/src/com/jpexs/asdec/action/swf7/ActionDefineFunction2.java index df5ca32b5..33f7ab0d3 100644 --- a/trunk/src/com/jpexs/asdec/action/swf7/ActionDefineFunction2.java +++ b/trunk/src/com/jpexs/asdec/action/swf7/ActionDefineFunction2.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf7; import com.jpexs.asdec.SWFInputStream; @@ -184,4 +202,4 @@ public class ActionDefineFunction2 extends Action { public List getAllIfsOrJumps() { return Action.getActionsAllIfsOrJumps(code); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf7/ActionExtends.java b/trunk/src/com/jpexs/asdec/action/swf7/ActionExtends.java index e75379ad3..cc1e9c748 100644 --- a/trunk/src/com/jpexs/asdec/action/swf7/ActionExtends.java +++ b/trunk/src/com/jpexs/asdec/action/swf7/ActionExtends.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf7; import com.jpexs.asdec.action.Action; @@ -26,4 +44,4 @@ public class ActionExtends extends Action { TreeItem subclass = stack.pop(); output.add(new ExtendsTreeItem(this, subclass, superclass)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf7/ActionImplementsOp.java b/trunk/src/com/jpexs/asdec/action/swf7/ActionImplementsOp.java index 63db3bf85..e4f2b3495 100644 --- a/trunk/src/com/jpexs/asdec/action/swf7/ActionImplementsOp.java +++ b/trunk/src/com/jpexs/asdec/action/swf7/ActionImplementsOp.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf7; import com.jpexs.asdec.action.Action; @@ -30,4 +48,4 @@ public class ActionImplementsOp extends Action { } output.add(new ImplementsOpTreeItem(this, subclass, superclasses)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf7/ActionThrow.java b/trunk/src/com/jpexs/asdec/action/swf7/ActionThrow.java index 4e74d8f15..222b45598 100644 --- a/trunk/src/com/jpexs/asdec/action/swf7/ActionThrow.java +++ b/trunk/src/com/jpexs/asdec/action/swf7/ActionThrow.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf7; import com.jpexs.asdec.action.Action; @@ -24,4 +42,4 @@ public class ActionThrow extends Action { TreeItem object = stack.pop(); output.add(new ThrowTreeItem(this, object)); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/swf7/ActionTry.java b/trunk/src/com/jpexs/asdec/action/swf7/ActionTry.java index 5c555f595..4e5f74da7 100644 --- a/trunk/src/com/jpexs/asdec/action/swf7/ActionTry.java +++ b/trunk/src/com/jpexs/asdec/action/swf7/ActionTry.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.swf7; import com.jpexs.asdec.SWFInputStream; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/AsciiToCharTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/AsciiToCharTreeItem.java index 7aec0b9ca..950324335 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/AsciiToCharTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/AsciiToCharTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -14,4 +32,4 @@ public class AsciiToCharTreeItem extends TreeItem { public String toString(ConstantPool constants) { return "ord(" + value.toString(constants) + ")"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/BreakTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/BreakTreeItem.java index 3abe6074c..409a21dfa 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/BreakTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/BreakTreeItem.java @@ -1,29 +1,43 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel; - -import com.jpexs.asdec.action.Action; - - -public class BreakTreeItem extends TreeItem { - public long loopPos; - public boolean isKnown; - - public BreakTreeItem(Action instruction, long loopPos) { - this(instruction, loopPos, true); - } - - public BreakTreeItem(Action instruction, long loopPos, boolean isKnown) { - super(instruction, NOPRECEDENCE); - this.loopPos = loopPos; - this.isKnown = isKnown; - } - - @Override - public String toString(ConstantPool constants) { - return hilight("break") + " loop" + loopPos + ";"; - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel; + +import com.jpexs.asdec.action.Action; + + +public class BreakTreeItem extends TreeItem { + public long loopPos; + public boolean isKnown; + + public BreakTreeItem(Action instruction, long loopPos) { + this(instruction, loopPos, true); + } + + public BreakTreeItem(Action instruction, long loopPos, boolean isKnown) { + super(instruction, NOPRECEDENCE); + this.loopPos = loopPos; + this.isKnown = isKnown; + } + + @Override + public String toString(ConstantPool constants) { + return hilight("break") + " loop" + loopPos + ";"; + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/CallFunctionTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/CallFunctionTreeItem.java index 5ef9a42a1..b04a85a4d 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/CallFunctionTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/CallFunctionTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/CallMethodTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/CallMethodTreeItem.java index a373d29af..d221e80e4 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/CallMethodTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/CallMethodTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -40,4 +58,4 @@ public class CallMethodTreeItem extends TreeItem { } return scriptObject.toString(constants) + "." + stripQuotes(methodName) + "(" + paramStr + ")"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/CallTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/CallTreeItem.java index 27d460976..c47a4e2e1 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/CallTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/CallTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -14,4 +32,4 @@ public class CallTreeItem extends TreeItem { public String toString(ConstantPool constants) { return stripQuotes(value) + "()"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/CastOpTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/CastOpTreeItem.java index 4a7e4220d..0c2986bc7 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/CastOpTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/CastOpTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/CharToAsciiTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/CharToAsciiTreeItem.java index e2c103b02..e92359bbf 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/CharToAsciiTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/CharToAsciiTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -14,4 +32,4 @@ public class CharToAsciiTreeItem extends TreeItem { public String toString(ConstantPool constants) { return "chr(" + value.toString(constants) + ")"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/CloneSpriteTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/CloneSpriteTreeItem.java index 09bd8b592..6f07bb5d0 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/CloneSpriteTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/CloneSpriteTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/ConstantPool.java b/trunk/src/com/jpexs/asdec/action/treemodel/ConstantPool.java index 59390dea3..ace9fcbe8 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/ConstantPool.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/ConstantPool.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import java.util.ArrayList; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/ContinueTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/ContinueTreeItem.java index 9108787f8..7e295cb92 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/ContinueTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/ContinueTreeItem.java @@ -1,30 +1,44 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel; - -import com.jpexs.asdec.action.Action; - - -public class ContinueTreeItem extends TreeItem { - public long loopPos; - public boolean isKnown; - public boolean isBreak; - - public ContinueTreeItem(Action instruction, long loopPos) { - this(instruction, loopPos, true); - } - - public ContinueTreeItem(Action instruction, long loopPos, boolean isKnown) { - super(instruction, NOPRECEDENCE); - this.loopPos = loopPos; - this.isKnown = isKnown; - } - - @Override - public String toString(ConstantPool constants) { - return hilight(isBreak ? "break" : "continue") + " " + (isKnown ? "loop" : "unk") + loopPos + ";"; - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel; + +import com.jpexs.asdec.action.Action; + + +public class ContinueTreeItem extends TreeItem { + public long loopPos; + public boolean isKnown; + public boolean isBreak; + + public ContinueTreeItem(Action instruction, long loopPos) { + this(instruction, loopPos, true); + } + + public ContinueTreeItem(Action instruction, long loopPos, boolean isKnown) { + super(instruction, NOPRECEDENCE); + this.loopPos = loopPos; + this.isKnown = isKnown; + } + + @Override + public String toString(ConstantPool constants) { + return hilight(isBreak ? "break" : "continue") + " " + (isKnown ? "loop" : "unk") + loopPos + ";"; + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/DecrementTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/DecrementTreeItem.java index 01d0c696e..2c5495e5e 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/DecrementTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/DecrementTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -14,4 +32,4 @@ public class DecrementTreeItem extends TreeItem { public String toString(ConstantPool constants) { return object.toString(constants) + "-1"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/DefineLocalTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/DefineLocalTreeItem.java index 8cf32f790..0f0f5421a 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/DefineLocalTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/DefineLocalTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/DeleteTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/DeleteTreeItem.java index 40309151d..58a230c42 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/DeleteTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/DeleteTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/DirectValueTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/DirectValueTreeItem.java index fae2b22a5..69d832817 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/DirectValueTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/DirectValueTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/EachTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/EachTreeItem.java index 0e7ecdbe9..8585536d7 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/EachTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/EachTreeItem.java @@ -1,26 +1,40 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel; - -import com.jpexs.asdec.action.Action; - - -public class EachTreeItem extends TreeItem { - public TreeItem object; - public TreeItem collection; - - public EachTreeItem(Action instruction, TreeItem object, TreeItem collection) { - super(instruction, NOPRECEDENCE); - this.object = object; - this.collection = collection; - } - - @Override - public String toString(ConstantPool constants) { - return hilight("each (") + object.toString(constants) + hilight(" in ") + collection.toString(constants) + ")"; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel; + +import com.jpexs.asdec.action.Action; + + +public class EachTreeItem extends TreeItem { + public TreeItem object; + public TreeItem collection; + + public EachTreeItem(Action instruction, TreeItem object, TreeItem collection) { + super(instruction, NOPRECEDENCE); + this.object = object; + this.collection = collection; + } + + @Override + public String toString(ConstantPool constants) { + return hilight("each (") + object.toString(constants) + hilight(" in ") + collection.toString(constants) + ")"; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/EnumerateTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/EnumerateTreeItem.java index b294df033..0bdc24d29 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/EnumerateTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/EnumerateTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/ExtendsTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/ExtendsTreeItem.java index eeda6f769..34535418b 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/ExtendsTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/ExtendsTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/FunctionTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/FunctionTreeItem.java index 6e0decfe1..3e6e858b0 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/FunctionTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/FunctionTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/GetMemberTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/GetMemberTreeItem.java index 80acf3c9a..b7b33c28e 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/GetMemberTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/GetMemberTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/GetPropertyTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/GetPropertyTreeItem.java index b24056417..6aa5f6d79 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/GetPropertyTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/GetPropertyTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/GetURL2TreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/GetURL2TreeItem.java index 4447896c6..7f9671c9c 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/GetURL2TreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/GetURL2TreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -30,4 +48,4 @@ public class GetURL2TreeItem extends TreeItem { this.loadTargetFlag = loadTargetFlag; this.loadVariablesFlag = loadVariablesFlag; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/GetURLTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/GetURLTreeItem.java index a891e0f6d..9219f413e 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/GetURLTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/GetURLTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/GetVariableTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/GetVariableTreeItem.java index 4630f553a..85bd057a8 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/GetVariableTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/GetVariableTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/GotoFrame2TreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/GotoFrame2TreeItem.java index a40b8c7d2..bef5c330b 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/GotoFrame2TreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/GotoFrame2TreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -22,4 +40,4 @@ public class GotoFrame2TreeItem extends TreeItem { if (playFlag) prefix = "gotoAndPlay"; return prefix + "(" + frame.toString(constants) + (sceneBiasFlag ? "," + sceneBias : "") + ");"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/GotoFrameTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/GotoFrameTreeItem.java index 6b532f94c..a28320504 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/GotoFrameTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/GotoFrameTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/GotoLabelTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/GotoLabelTreeItem.java index 0acf091ce..321691d6a 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/GotoLabelTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/GotoLabelTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -15,4 +33,4 @@ public class GotoLabelTreeItem extends TreeItem { public String toString(ConstantPool constants) { return "gotoAndStop(\"" + Helper.escapeString(label) + "\");"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/ImplementsOpTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/ImplementsOpTreeItem.java index 157c9e9c9..88ff10d3b 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/ImplementsOpTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/ImplementsOpTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -23,4 +41,4 @@ public class ImplementsOpTreeItem extends TreeItem { } return subclass.toString(constants) + " implements " + impStr; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/IncrementTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/IncrementTreeItem.java index b923a008c..9c888c434 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/IncrementTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/IncrementTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/InitArrayTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/InitArrayTreeItem.java index ecc9acf22..a2e01a04b 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/InitArrayTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/InitArrayTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/InitObjectTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/InitObjectTreeItem.java index 1567f874c..35bcc0f54 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/InitObjectTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/InitObjectTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -23,4 +41,4 @@ public class InitObjectTreeItem extends TreeItem { } return "{" + objStr + "}"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/MBAsciiToCharTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/MBAsciiToCharTreeItem.java index 4dd628c4b..4d9fd1275 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/MBAsciiToCharTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/MBAsciiToCharTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -14,4 +32,4 @@ public class MBAsciiToCharTreeItem extends TreeItem { public String toString(ConstantPool constants) { return "mbord(" + value.toString(constants) + ")"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/MBCharToAsciiTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/MBCharToAsciiTreeItem.java index e7c158ac8..01e1b51f5 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/MBCharToAsciiTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/MBCharToAsciiTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -14,4 +32,4 @@ public class MBCharToAsciiTreeItem extends TreeItem { public String toString(ConstantPool constants) { return "mbchr(" + value.toString(constants) + ")"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/MBStringExtractTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/MBStringExtractTreeItem.java index 94c1598f4..b80f42c98 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/MBStringExtractTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/MBStringExtractTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -18,4 +36,4 @@ public class MBStringExtractTreeItem extends TreeItem { public String toString(ConstantPool constants) { return "mbsubstring(" + value.toString(constants) + "," + index.toString(constants) + "," + count.toString(constants) + ")"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/NewMethodTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/NewMethodTreeItem.java index 6af33270f..e684f5a0d 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/NewMethodTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/NewMethodTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -40,4 +58,4 @@ public class NewMethodTreeItem extends TreeItem { } return "new " + scriptObject.toString(constants) + "." + methodName.toString(constants) + "(" + paramStr + ")"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/NewObjectTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/NewObjectTreeItem.java index 4cca8ee2a..c78ed5fac 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/NewObjectTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/NewObjectTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -23,4 +41,4 @@ public class NewObjectTreeItem extends TreeItem { } return "new " + stripQuotes(objectName) + "(" + paramStr + ")"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/RandomNumberTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/RandomNumberTreeItem.java index f3b81a7f3..8bd7ad684 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/RandomNumberTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/RandomNumberTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -14,4 +32,4 @@ public class RandomNumberTreeItem extends TreeItem { public String toString(ConstantPool constants) { return "random(" + maximum.toString(constants) + ")"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/RemoveSpriteTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/RemoveSpriteTreeItem.java index f17959118..8079fd405 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/RemoveSpriteTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/RemoveSpriteTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -14,4 +32,4 @@ public class RemoveSpriteTreeItem extends TreeItem { public String toString(ConstantPool constants) { return "removeMovieClip(" + target.toString(constants) + ");"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/ReturnTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/ReturnTreeItem.java index 1f9153d8d..6e83e5724 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/ReturnTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/ReturnTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/SetMemberTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/SetMemberTreeItem.java index 5c0179d10..87e3f4957 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/SetMemberTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/SetMemberTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -18,4 +36,4 @@ public class SetMemberTreeItem extends TreeItem { public String toString(ConstantPool constants) { return object.toString(constants) + "." + stripQuotes(objectName) + "=" + value.toString(constants) + ";"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/SetPropertyTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/SetPropertyTreeItem.java index 4c8639f1a..82d593b54 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/SetPropertyTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/SetPropertyTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -20,4 +38,4 @@ public class SetPropertyTreeItem extends TreeItem { return Action.propertyNames[propertyIndex] + "=" + value.toString(constants) + ";"; return target.toString(constants) + "." + Action.propertyNames[propertyIndex] + "=" + value.toString(constants) + ";"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/SetTarget2TreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/SetTarget2TreeItem.java index d1e6c93a4..aaf98392c 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/SetTarget2TreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/SetTarget2TreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -14,4 +32,4 @@ public class SetTarget2TreeItem extends TreeItem { public String toString(ConstantPool constants) { return "tellTarget(" + target.toString(constants) + ");"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/SetTargetTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/SetTargetTreeItem.java index d567ee770..6a476a584 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/SetTargetTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/SetTargetTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -15,4 +33,4 @@ public class SetTargetTreeItem extends TreeItem { public String toString(ConstantPool constants) { return "tellTarget(\"" + Helper.escapeString(target) + "\");"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/SetVariableTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/SetVariableTreeItem.java index 9825ab0a0..c2585544b 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/SetVariableTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/SetVariableTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -16,4 +34,4 @@ public class SetVariableTreeItem extends TreeItem { public String toString(ConstantPool constants) { return stripQuotes(name) + hilight("=") + value.toString(constants) + ";"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/SimpleActionTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/SimpleActionTreeItem.java index 0ad04d159..b9dec90e7 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/SimpleActionTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/SimpleActionTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/StartDragTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/StartDragTreeItem.java index 7888982e2..b28a739a0 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/StartDragTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/StartDragTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/StoreRegisterTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/StoreRegisterTreeItem.java index 1e2adeabc..2af3d2864 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/StoreRegisterTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/StoreRegisterTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/StringExtractTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/StringExtractTreeItem.java index ac759e4c4..58f540467 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/StringExtractTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/StringExtractTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -18,4 +36,4 @@ public class StringExtractTreeItem extends TreeItem { public String toString(ConstantPool constants) { return value.toString(constants) + ".substr(" + index.toString(constants) + "," + count.toString(constants) + ")"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/TargetPathTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/TargetPathTreeItem.java index 2a0b2d8af..48c1993a5 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/TargetPathTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/TargetPathTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/ThrowTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/ThrowTreeItem.java index ec117a521..278c6a25e 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/ThrowTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/ThrowTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/ToIntegerTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/ToIntegerTreeItem.java index aec0f65df..e275a5315 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/ToIntegerTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/ToIntegerTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/ToNumberTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/ToNumberTreeItem.java index bd8339821..d77e84015 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/ToNumberTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/ToNumberTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -14,4 +32,4 @@ public class ToNumberTreeItem extends TreeItem { public String toString(ConstantPool constants) { return value.toString(constants) + ".valueOf()"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/ToStringTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/ToStringTreeItem.java index 4ae69372c..3df64728e 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/ToStringTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/ToStringTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -14,4 +32,4 @@ public class ToStringTreeItem extends TreeItem { public String toString(ConstantPool constants) { return value.toString(constants) + ".toString()"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/TraceTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/TraceTreeItem.java index 0cb726c97..df25ae979 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/TraceTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/TraceTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -14,4 +32,4 @@ public class TraceTreeItem extends TreeItem { public String toString(ConstantPool constants) { return "trace(" + value.toString(constants) + ");"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/TreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/TreeItem.java index ab89159b9..c1c0087e2 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/TreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/TreeItem.java @@ -1,83 +1,97 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.helpers.Highlighting; - - -public abstract class TreeItem { - - public static final int PRECEDENCE_PRIMARY = 0; - public static final int PRECEDENCE_POSTFIX = 1; - public static final int PRECEDENCE_UNARY = 2; - public static final int PRECEDENCE_MULTIPLICATIVE = 3; - public static final int PRECEDENCE_ADDITIVE = 4; - public static final int PRECEDENCE_BITWISESHIFT = 5; - public static final int PRECEDENCE_RELATIONAL = 6; - public static final int PRECEDENCE_EQUALITY = 7; - public static final int PRECEDENCE_BITWISEAND = 8; - public static final int PRECEDENCE_BITWISEXOR = 9; - public static final int PRECEDENCE_BITWISEOR = 10; - public static final int PRECEDENCE_LOGICALAND = 11; - public static final int PRECEDENCE_LOGICALOR = 12; - public static final int PRECEDENCE_CONDITIONAL = 13; - public static final int PRECEDENCE_ASSIGMENT = 14; - public static final int PRECEDENCE_COMMA = 15; - public static final int NOPRECEDENCE = 16; - - - public int precedence = NOPRECEDENCE; - public Action instruction; - - public TreeItem(Action instruction, int precedence) { - this.instruction = instruction; - this.precedence = precedence; - } - - - public abstract String toString(ConstantPool constants); - - public String toString(){ - return toString(null); - } - - - protected String hilight(String str) { - if (instruction == null) - return str; - return Highlighting.hilighOffset(str, instruction.getAddress()); - } - - public boolean isFalse() { - return false; - } - - public boolean isTrue() { - return false; - } - - - protected boolean isEmptyString(TreeItem target){ - if(target instanceof DirectValueTreeItem){ - if(((DirectValueTreeItem)target).value instanceof String){ - - if(((DirectValueTreeItem)target).value.equals("")){ - return true; - } - } - } - return false; - } - - protected String stripQuotes(TreeItem target){ - if(target instanceof DirectValueTreeItem){ - if(((DirectValueTreeItem)target).value instanceof String){ - return (String)((DirectValueTreeItem)target).value; - } - } - return target.toString(); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.helpers.Highlighting; + + +public abstract class TreeItem { + + public static final int PRECEDENCE_PRIMARY = 0; + public static final int PRECEDENCE_POSTFIX = 1; + public static final int PRECEDENCE_UNARY = 2; + public static final int PRECEDENCE_MULTIPLICATIVE = 3; + public static final int PRECEDENCE_ADDITIVE = 4; + public static final int PRECEDENCE_BITWISESHIFT = 5; + public static final int PRECEDENCE_RELATIONAL = 6; + public static final int PRECEDENCE_EQUALITY = 7; + public static final int PRECEDENCE_BITWISEAND = 8; + public static final int PRECEDENCE_BITWISEXOR = 9; + public static final int PRECEDENCE_BITWISEOR = 10; + public static final int PRECEDENCE_LOGICALAND = 11; + public static final int PRECEDENCE_LOGICALOR = 12; + public static final int PRECEDENCE_CONDITIONAL = 13; + public static final int PRECEDENCE_ASSIGMENT = 14; + public static final int PRECEDENCE_COMMA = 15; + public static final int NOPRECEDENCE = 16; + + + public int precedence = NOPRECEDENCE; + public Action instruction; + + public TreeItem(Action instruction, int precedence) { + this.instruction = instruction; + this.precedence = precedence; + } + + + public abstract String toString(ConstantPool constants); + + public String toString(){ + return toString(null); + } + + + protected String hilight(String str) { + if (instruction == null) + return str; + return Highlighting.hilighOffset(str, instruction.getAddress()); + } + + public boolean isFalse() { + return false; + } + + public boolean isTrue() { + return false; + } + + + protected boolean isEmptyString(TreeItem target){ + if(target instanceof DirectValueTreeItem){ + if(((DirectValueTreeItem)target).value instanceof String){ + + if(((DirectValueTreeItem)target).value.equals("")){ + return true; + } + } + } + return false; + } + + protected String stripQuotes(TreeItem target){ + if(target instanceof DirectValueTreeItem){ + if(((DirectValueTreeItem)target).value instanceof String){ + return (String)((DirectValueTreeItem)target).value; + } + } + return target.toString(); + } +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/TypeOfTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/TypeOfTreeItem.java index 70d27e9b1..7909fb539 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/TypeOfTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/TypeOfTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -14,4 +32,4 @@ public class TypeOfTreeItem extends TreeItem { public String toString(ConstantPool constants) { return "typeof(" + value.toString(constants) + ")"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/UnsupportedTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/UnsupportedTreeItem.java index cb9a13056..ff923582a 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/UnsupportedTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/UnsupportedTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/VoidTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/VoidTreeItem.java index 4532ff5d3..2d47fcd88 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/VoidTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/VoidTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/WaitForFrame2TreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/WaitForFrame2TreeItem.java index 0c99d2a05..3398e9918 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/WaitForFrame2TreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/WaitForFrame2TreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -16,4 +34,4 @@ public class WaitForFrame2TreeItem extends TreeItem { public String toString(ConstantPool constants) { return "waitForFrame2(" + frame.toString(constants) + "," + skipCount + ");"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/WaitForFrameTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/WaitForFrameTreeItem.java index 16af01bf8..c2926cf21 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/WaitForFrameTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/WaitForFrameTreeItem.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.action.treemodel; import com.jpexs.asdec.action.Action; @@ -16,4 +34,4 @@ public class WaitForFrameTreeItem extends TreeItem { public String toString(ConstantPool constants) { return "waitForFrame(" + frame + "," + skipCount + ");"; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/Block.java b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/Block.java index 6e2948b84..80388f03f 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/Block.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/Block.java @@ -1,14 +1,28 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.clauses; - -import com.jpexs.asdec.action.treemodel.ContinueTreeItem; - -import java.util.List; - - -public interface Block { - public List getContinues(); -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.clauses; + +import com.jpexs.asdec.action.treemodel.ContinueTreeItem; + +import java.util.List; + + +public interface Block { + public List getContinues(); +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/DoWhileTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/DoWhileTreeItem.java index 0fe40dbef..1dcc3dfe1 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/DoWhileTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/DoWhileTreeItem.java @@ -1,53 +1,67 @@ -/* - * 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.TreeItem; - -import java.util.ArrayList; -import java.util.List; - - -public class DoWhileTreeItem extends LoopTreeItem implements Block { - - public List commands; - public TreeItem expression; - - public DoWhileTreeItem(Action instruction, int loopBreak, int loopContinue, List commands, TreeItem expression) { - super(instruction, loopBreak, loopContinue); - this.expression = expression; - this.commands = commands; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; - ret += hilight("do\r\n{") + "\r\n"; - for (TreeItem ti : commands) { - ret += ti.toString(constants) + "\r\n"; - } - ret += hilight("}\r\nwhile(") + expression.toString(constants) + 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; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +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.TreeItem; + +import java.util.ArrayList; +import java.util.List; + + +public class DoWhileTreeItem extends LoopTreeItem implements Block { + + public List commands; + public TreeItem expression; + + public DoWhileTreeItem(Action instruction, int loopBreak, int loopContinue, List commands, TreeItem expression) { + super(instruction, loopBreak, loopContinue); + this.expression = expression; + this.commands = commands; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret += "loop" + loopBreak + ":\r\n"; + ret += hilight("do\r\n{") + "\r\n"; + for (TreeItem ti : commands) { + ret += ti.toString(constants) + "\r\n"; + } + ret += hilight("}\r\nwhile(") + expression.toString(constants) + 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; + } +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForEachTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForEachTreeItem.java index f62995da3..9cd21d1ba 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForEachTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForEachTreeItem.java @@ -1,53 +1,67 @@ -/* - * 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 ForEachTreeItem extends LoopTreeItem implements Block { - - public EachTreeItem expression; - public List commands; - - public ForEachTreeItem(Action instruction, int loopBreak, int loopContinue, EachTreeItem expression, List commands) { - super(instruction, loopBreak, loopContinue); - this.expression = expression; - this.commands = commands; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; - ret += hilight("for ") + expression.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; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +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 ForEachTreeItem extends LoopTreeItem implements Block { + + public EachTreeItem expression; + public List commands; + + public ForEachTreeItem(Action instruction, int loopBreak, int loopContinue, EachTreeItem expression, List commands) { + super(instruction, loopBreak, loopContinue); + this.expression = expression; + this.commands = commands; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret += "loop" + loopBreak + ":\r\n"; + ret += hilight("for ") + expression.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; + } +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForInTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForInTreeItem.java index ddd50c4dc..058c1483b 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForInTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForInTreeItem.java @@ -1,55 +1,69 @@ -/* - * 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; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +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; + } +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForTreeItem.java index c590027bb..5416bc250 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/ForTreeItem.java @@ -1,79 +1,93 @@ -/* - * 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.TreeItem; - -import java.util.ArrayList; -import java.util.List; - - -public class ForTreeItem extends LoopTreeItem implements Block { - - public List firstCommands; - public TreeItem expression; - public List finalCommands; - public List commands; - - public ForTreeItem(Action instruction, long loopBreak, long loopContinue, List firstCommands, TreeItem expression, List finalCommands, List commands) { - super(instruction, loopBreak, loopContinue); - this.firstCommands = firstCommands; - this.expression = expression; - this.finalCommands = finalCommands; - this.commands = commands; - } - - private String stripSemicolon(String s) { - if (s.endsWith(";")) { - s = s.substring(0, s.length() - 1); - } - return s; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; - ret += hilight("for("); - for (int i = 0; i < firstCommands.size(); i++) { - if (i > 0) { - ret += ","; - } - ret += stripSemicolon(firstCommands.get(i).toString(constants)); - } - ret += ";"; - ret += expression.toString(constants); - ret += ";"; - for (int i = 0; i < finalCommands.size(); i++) { - if (i > 0) { - ret += ","; - } - ret += stripSemicolon(finalCommands.get(i).toString(constants)); - } - ret += hilight(")") + "\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; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +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.TreeItem; + +import java.util.ArrayList; +import java.util.List; + + +public class ForTreeItem extends LoopTreeItem implements Block { + + public List firstCommands; + public TreeItem expression; + public List finalCommands; + public List commands; + + public ForTreeItem(Action instruction, long loopBreak, long loopContinue, List firstCommands, TreeItem expression, List finalCommands, List commands) { + super(instruction, loopBreak, loopContinue); + this.firstCommands = firstCommands; + this.expression = expression; + this.finalCommands = finalCommands; + this.commands = commands; + } + + private String stripSemicolon(String s) { + if (s.endsWith(";")) { + s = s.substring(0, s.length() - 1); + } + return s; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret += "loop" + loopBreak + ":\r\n"; + ret += hilight("for("); + for (int i = 0; i < firstCommands.size(); i++) { + if (i > 0) { + ret += ","; + } + ret += stripSemicolon(firstCommands.get(i).toString(constants)); + } + ret += ";"; + ret += expression.toString(constants); + ret += ";"; + for (int i = 0; i < finalCommands.size(); i++) { + if (i > 0) { + ret += ","; + } + ret += stripSemicolon(finalCommands.get(i).toString(constants)); + } + ret += hilight(")") + "\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; + } +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/IfTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/IfTreeItem.java index d67f1972b..a48b5c9dc 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/IfTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/IfTreeItem.java @@ -1,68 +1,82 @@ -/* - * 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.TreeItem; - -import java.util.ArrayList; -import java.util.List; - - -public class IfTreeItem extends TreeItem implements Block { - public TreeItem expression; - public List onTrue; - public List onFalse; - - public IfTreeItem(Action instruction, TreeItem expression, List onTrue, List onFalse) { - super(instruction, NOPRECEDENCE); - this.expression = expression; - this.onTrue = onTrue; - this.onFalse = onFalse; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret = hilight("if(") + expression.toString(constants) + hilight(")\r\n{\r\n"); - for (TreeItem ti : onTrue) { - ret += ti.toString(constants) + "\r\n"; - } - ret += hilight("}"); - if (onFalse.size() > 0) { - ret += hilight("\r\nelse\r\n{\r\n"); - for (TreeItem ti : onFalse) { - ret += ti.toString(constants) + "\r\n"; - } - ret += hilight("}"); - } - return ret; - } - - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : onTrue) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - for (TreeItem ti : onFalse) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - return ret; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +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.TreeItem; + +import java.util.ArrayList; +import java.util.List; + + +public class IfTreeItem extends TreeItem implements Block { + public TreeItem expression; + public List onTrue; + public List onFalse; + + public IfTreeItem(Action instruction, TreeItem expression, List onTrue, List onFalse) { + super(instruction, NOPRECEDENCE); + this.expression = expression; + this.onTrue = onTrue; + this.onFalse = onFalse; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret = hilight("if(") + expression.toString(constants) + hilight(")\r\n{\r\n"); + for (TreeItem ti : onTrue) { + ret += ti.toString(constants) + "\r\n"; + } + ret += hilight("}"); + if (onFalse.size() > 0) { + ret += hilight("\r\nelse\r\n{\r\n"); + for (TreeItem ti : onFalse) { + ret += ti.toString(constants) + "\r\n"; + } + ret += hilight("}"); + } + return ret; + } + + public List getContinues() { + List ret = new ArrayList(); + for (TreeItem ti : onTrue) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + for (TreeItem ti : onFalse) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + return ret; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/LoopTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/LoopTreeItem.java index 351cb47e2..b2ef4d970 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/LoopTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/LoopTreeItem.java @@ -1,20 +1,34 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.clauses; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public abstract class LoopTreeItem extends TreeItem { - public long loopBreak; - public long loopContinue; - - public LoopTreeItem(Action instruction, long loopBreak, long loopContinue) { - super(instruction, NOPRECEDENCE); - this.loopBreak = loopBreak; - this.loopContinue = loopContinue; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.clauses; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public abstract class LoopTreeItem extends TreeItem { + public long loopBreak; + public long loopContinue; + + public LoopTreeItem(Action instruction, long loopBreak, long loopContinue) { + super(instruction, NOPRECEDENCE); + this.loopBreak = loopBreak; + this.loopContinue = loopContinue; + } +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/SwitchTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/SwitchTreeItem.java index 89709dab9..4fb17b8f3 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/SwitchTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/SwitchTreeItem.java @@ -1,84 +1,98 @@ -/* - * 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.TreeItem; - -import java.util.ArrayList; -import java.util.List; - - -public class SwitchTreeItem extends LoopTreeItem implements Block { - - public TreeItem switchedObject; - public List caseValues; - public List> caseCommands; - public List defaultCommands; - - public SwitchTreeItem(Action instruction, long switchBreak, TreeItem switchedObject, List caseValues, List> caseCommands, List defaultCommands) { - super(instruction, switchBreak, -1); - this.switchedObject = switchedObject; - this.caseValues = caseValues; - this.caseCommands = caseCommands; - this.defaultCommands = defaultCommands; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; - ret += hilight("switch(") + switchedObject.toString(constants) + hilight(")") + "\r\n{\r\n"; - for (int i = 0; i < caseValues.size(); i++) { - ret += "case " + caseValues.get(i).toString(constants) + ":\r\n"; - ret += Action.INDENTOPEN + "\r\n"; - for (int j = 0; j < caseCommands.get(i).size(); j++) { - ret += caseCommands.get(i).get(j).toString(constants) + "\r\n"; - } - ret += Action.INDENTCLOSE + "\r\n"; - } - if (defaultCommands != null) { - if (defaultCommands.size() > 0) { - ret += hilight("default") + ":\r\n"; - ret += Action.INDENTOPEN + "\r\n"; - for (int j = 0; j < defaultCommands.size(); j++) { - ret += defaultCommands.get(j).toString(constants) + "\r\n"; - } - ret += Action.INDENTCLOSE + "\r\n"; - } - } - ret += hilight("}") + "\r\n"; - ret += ":loop" + loopBreak; - return ret; - } - - public List getContinues() { - List ret = new ArrayList(); - - for (List onecase : caseCommands) { - for (TreeItem ti : onecase) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - } - if (defaultCommands != null) { - for (TreeItem ti : defaultCommands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - } - return ret; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +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.TreeItem; + +import java.util.ArrayList; +import java.util.List; + + +public class SwitchTreeItem extends LoopTreeItem implements Block { + + public TreeItem switchedObject; + public List caseValues; + public List> caseCommands; + public List defaultCommands; + + public SwitchTreeItem(Action instruction, long switchBreak, TreeItem switchedObject, List caseValues, List> caseCommands, List defaultCommands) { + super(instruction, switchBreak, -1); + this.switchedObject = switchedObject; + this.caseValues = caseValues; + this.caseCommands = caseCommands; + this.defaultCommands = defaultCommands; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret += "loop" + loopBreak + ":\r\n"; + ret += hilight("switch(") + switchedObject.toString(constants) + hilight(")") + "\r\n{\r\n"; + for (int i = 0; i < caseValues.size(); i++) { + ret += "case " + caseValues.get(i).toString(constants) + ":\r\n"; + ret += Action.INDENTOPEN + "\r\n"; + for (int j = 0; j < caseCommands.get(i).size(); j++) { + ret += caseCommands.get(i).get(j).toString(constants) + "\r\n"; + } + ret += Action.INDENTCLOSE + "\r\n"; + } + if (defaultCommands != null) { + if (defaultCommands.size() > 0) { + ret += hilight("default") + ":\r\n"; + ret += Action.INDENTOPEN + "\r\n"; + for (int j = 0; j < defaultCommands.size(); j++) { + ret += defaultCommands.get(j).toString(constants) + "\r\n"; + } + ret += Action.INDENTCLOSE + "\r\n"; + } + } + ret += hilight("}") + "\r\n"; + ret += ":loop" + loopBreak; + return ret; + } + + public List getContinues() { + List ret = new ArrayList(); + + for (List onecase : caseCommands) { + for (TreeItem ti : onecase) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + } + if (defaultCommands != null) { + for (TreeItem ti : defaultCommands) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + } + return ret; + } +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/TernarOpTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/TernarOpTreeItem.java index 568d6069c..10bab3500 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/TernarOpTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/TernarOpTreeItem.java @@ -1,30 +1,44 @@ -/* - * 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.TreeItem; - - -public class TernarOpTreeItem extends TreeItem { - public TreeItem expression; - public TreeItem onTrue; - public TreeItem onFalse; - - public TernarOpTreeItem(Action instruction, TreeItem expression, TreeItem onTrue, TreeItem onFalse) { - super(instruction, PRECEDENCE_CONDITIONAL); - this.expression = expression; - this.onTrue = onTrue; - this.onFalse = onFalse; - } - - @Override - public String toString(ConstantPool constants) { - return expression.toString(constants) + hilight("?") + onTrue.toString(constants) + hilight(":") + onFalse.toString(constants); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +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.TreeItem; + + +public class TernarOpTreeItem extends TreeItem { + public TreeItem expression; + public TreeItem onTrue; + public TreeItem onFalse; + + public TernarOpTreeItem(Action instruction, TreeItem expression, TreeItem onTrue, TreeItem onFalse) { + super(instruction, PRECEDENCE_CONDITIONAL); + this.expression = expression; + this.onTrue = onTrue; + this.onFalse = onFalse; + } + + @Override + public String toString(ConstantPool constants) { + return expression.toString(constants) + hilight("?") + onTrue.toString(constants) + hilight(":") + onFalse.toString(constants); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/TryTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/TryTreeItem.java index 3fbf301cb..7991bdcbb 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/TryTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/TryTreeItem.java @@ -1,88 +1,102 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.clauses; - -import com.jpexs.asdec.action.treemodel.ConstantPool; -import com.jpexs.asdec.action.treemodel.ContinueTreeItem; -import com.jpexs.asdec.action.treemodel.TreeItem; - -import java.util.ArrayList; -import java.util.List; - - -public class TryTreeItem extends TreeItem implements Block { - - public List tryCommands; - public List catchExceptions; - public List> catchCommands; - public List finallyCommands; - - public TryTreeItem(List tryCommands, List catchExceptions, List> catchCommands, List finallyCommands) { - super(null, NOPRECEDENCE); - this.tryCommands = tryCommands; - this.catchExceptions = catchExceptions; - this.catchCommands = catchCommands; - this.finallyCommands = finallyCommands; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "try\r\n{\r\n"; - for (TreeItem ti : tryCommands) { - ret += ti.toString(constants) + "\r\n"; - } - ret += "}"; - for (int e = 0; e < catchExceptions.size(); e++) { - ret += "\r\ncatch(" + catchExceptions.get(e).toString(constants) + ")\r\n{\r\n"; - List commands = catchCommands.get(e); - for (TreeItem ti : commands) { - ret += ti.toString(constants) + "\r\n"; - } - ret += "}"; - } - if (finallyCommands.size() > 0) { - ret += "\r\nfinally\r\n{\r\n"; - for (TreeItem ti : finallyCommands) { - ret += ti.toString(constants) + "\r\n"; - } - ret += "}"; - } - return ret; - } - - public List getContinues() { - List ret = new ArrayList(); - for (TreeItem ti : tryCommands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - if (finallyCommands != null) { - for (TreeItem ti : finallyCommands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - } - for (List commands : catchCommands) { - for (TreeItem ti : commands) { - if (ti instanceof ContinueTreeItem) { - ret.add((ContinueTreeItem) ti); - } - if (ti instanceof Block) { - ret.addAll(((Block) ti).getContinues()); - } - } - } - return ret; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.clauses; + +import com.jpexs.asdec.action.treemodel.ConstantPool; +import com.jpexs.asdec.action.treemodel.ContinueTreeItem; +import com.jpexs.asdec.action.treemodel.TreeItem; + +import java.util.ArrayList; +import java.util.List; + + +public class TryTreeItem extends TreeItem implements Block { + + public List tryCommands; + public List catchExceptions; + public List> catchCommands; + public List finallyCommands; + + public TryTreeItem(List tryCommands, List catchExceptions, List> catchCommands, List finallyCommands) { + super(null, NOPRECEDENCE); + this.tryCommands = tryCommands; + this.catchExceptions = catchExceptions; + this.catchCommands = catchCommands; + this.finallyCommands = finallyCommands; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret += "try\r\n{\r\n"; + for (TreeItem ti : tryCommands) { + ret += ti.toString(constants) + "\r\n"; + } + ret += "}"; + for (int e = 0; e < catchExceptions.size(); e++) { + ret += "\r\ncatch(" + catchExceptions.get(e).toString(constants) + ")\r\n{\r\n"; + List commands = catchCommands.get(e); + for (TreeItem ti : commands) { + ret += ti.toString(constants) + "\r\n"; + } + ret += "}"; + } + if (finallyCommands.size() > 0) { + ret += "\r\nfinally\r\n{\r\n"; + for (TreeItem ti : finallyCommands) { + ret += ti.toString(constants) + "\r\n"; + } + ret += "}"; + } + return ret; + } + + public List getContinues() { + List ret = new ArrayList(); + for (TreeItem ti : tryCommands) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + if (finallyCommands != null) { + for (TreeItem ti : finallyCommands) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + } + for (List commands : catchCommands) { + for (TreeItem ti : commands) { + if (ti instanceof ContinueTreeItem) { + ret.add((ContinueTreeItem) ti); + } + if (ti instanceof Block) { + ret.addAll(((Block) ti).getContinues()); + } + } + } + return ret; + } +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/WhileTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/WhileTreeItem.java index e736fa3aa..908bbf8c0 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/WhileTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/WhileTreeItem.java @@ -1,52 +1,66 @@ -/* - * 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.TreeItem; - -import java.util.ArrayList; -import java.util.List; - - -public class WhileTreeItem extends LoopTreeItem implements Block { - - public TreeItem expression; - public List commands; - - public WhileTreeItem(Action instruction, long loopBreak, long loopContinue, TreeItem expression, List commands) { - super(instruction, loopBreak, loopContinue); - this.expression = expression; - this.commands = commands; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret += "loop" + loopBreak + ":\r\n"; - ret += hilight("while(") + expression.toString(constants) + hilight(")") + "\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; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +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.TreeItem; + +import java.util.ArrayList; +import java.util.List; + + +public class WhileTreeItem extends LoopTreeItem implements Block { + + public TreeItem expression; + public List commands; + + public WhileTreeItem(Action instruction, long loopBreak, long loopContinue, TreeItem expression, List commands) { + super(instruction, loopBreak, loopContinue); + this.expression = expression; + this.commands = commands; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret += "loop" + loopBreak + ":\r\n"; + ret += hilight("while(") + expression.toString(constants) + hilight(")") + "\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; + } +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/WithTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/WithTreeItem.java index 559867cfa..90d47039c 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/clauses/WithTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/clauses/WithTreeItem.java @@ -1,44 +1,58 @@ -/* - * 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.TreeItem; - -import java.util.ArrayList; -import java.util.List; - - -public class WithTreeItem extends TreeItem { - public TreeItem scope; - public List items; - - public WithTreeItem(Action instruction, TreeItem scope, List items) { - super(instruction, NOPRECEDENCE); - this.scope = scope; - this.items = items; - } - - public WithTreeItem(Action instruction, TreeItem scope) { - super(instruction, NOPRECEDENCE); - this.scope = scope; - this.items = new ArrayList(); - } - - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - ret = hilight("with(") + scope.toString(constants) + hilight(")\r\n{\r\n"); - for (TreeItem ti : items) { - ret += ti.toString(constants) + "\r\n"; - } - ret += hilight("}"); - return ret; - } - -} \ No newline at end of file +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +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.TreeItem; + +import java.util.ArrayList; +import java.util.List; + + +public class WithTreeItem extends TreeItem { + public TreeItem scope; + public List items; + + public WithTreeItem(Action instruction, TreeItem scope, List items) { + super(instruction, NOPRECEDENCE); + this.scope = scope; + this.items = items; + } + + public WithTreeItem(Action instruction, TreeItem scope) { + super(instruction, NOPRECEDENCE); + this.scope = scope; + this.items = new ArrayList(); + } + + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + ret = hilight("with(") + scope.toString(constants) + hilight(")\r\n{\r\n"); + for (TreeItem ti : items) { + ret += ti.toString(constants) + "\r\n"; + } + ret += hilight("}"); + return ret; + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/AddTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/AddTreeItem.java index 324fee229..93b67ac4c 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/AddTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/AddTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class AddTreeItem extends BinaryOpTreeItem { - - public AddTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "+"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class AddTreeItem extends BinaryOpTreeItem { + + public AddTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "+"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/AndTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/AndTreeItem.java index 71e0ed639..2819c2e05 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/AndTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/AndTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class AndTreeItem extends BinaryOpTreeItem { - - public AndTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_LOGICALAND, leftSide, rightSide, "&&"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class AndTreeItem extends BinaryOpTreeItem { + + public AndTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_LOGICALAND, leftSide, rightSide, "&&"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/AsTypeTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/AsTypeTreeItem.java index 4250f21b0..118a34555 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/AsTypeTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/AsTypeTreeItem.java @@ -1,18 +1,32 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class AsTypeTreeItem extends BinaryOpTreeItem { - - public AsTypeTreeItem(Action instruction, TreeItem value, TreeItem type) { - super(instruction, PRECEDENCE_RELATIONAL, value, type, " as "); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class AsTypeTreeItem extends BinaryOpTreeItem { + + public AsTypeTreeItem(Action instruction, TreeItem value, TreeItem type) { + super(instruction, PRECEDENCE_RELATIONAL, value, type, " as "); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/BinaryOpTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/BinaryOpTreeItem.java index 27511e86a..f87a30a8e 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/BinaryOpTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/BinaryOpTreeItem.java @@ -1,43 +1,57 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.ConstantPool; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public abstract class BinaryOpTreeItem extends TreeItem { - - public TreeItem leftSide; - public TreeItem rightSide; - protected String operator = ""; - - public BinaryOpTreeItem(Action instruction, int precedence, TreeItem leftSide, TreeItem rightSide, String operator) { - super(instruction, precedence); - this.leftSide = leftSide; - this.rightSide = rightSide; - this.operator = operator; - } - - @Override - public String toString(ConstantPool constants) { - String ret = ""; - if (leftSide.precedence > precedence) { - ret += "(" + leftSide.toString(constants) + ")"; - } else { - ret += leftSide.toString(constants); - } - ret += hilight(operator); - if (rightSide.precedence > precedence) { - ret += "(" + rightSide.toString(constants) + ")"; - } else { - ret += rightSide.toString(constants); - } - return ret; - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.ConstantPool; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public abstract class BinaryOpTreeItem extends TreeItem { + + public TreeItem leftSide; + public TreeItem rightSide; + protected String operator = ""; + + public BinaryOpTreeItem(Action instruction, int precedence, TreeItem leftSide, TreeItem rightSide, String operator) { + super(instruction, precedence); + this.leftSide = leftSide; + this.rightSide = rightSide; + this.operator = operator; + } + + @Override + public String toString(ConstantPool constants) { + String ret = ""; + if (leftSide.precedence > precedence) { + ret += "(" + leftSide.toString(constants) + ")"; + } else { + ret += leftSide.toString(constants); + } + ret += hilight(operator); + if (rightSide.precedence > precedence) { + ret += "(" + rightSide.toString(constants) + ")"; + } else { + ret += rightSide.toString(constants); + } + return ret; + } + + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitAndTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitAndTreeItem.java index 337550301..da466d9c4 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitAndTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitAndTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class BitAndTreeItem extends BinaryOpTreeItem { - - public BitAndTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_BITWISEAND, leftSide, rightSide, "&"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class BitAndTreeItem extends BinaryOpTreeItem { + + public BitAndTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_BITWISEAND, leftSide, rightSide, "&"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitNotTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitNotTreeItem.java index 6e0a19676..16857d3fb 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitNotTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitNotTreeItem.java @@ -1,16 +1,30 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class BitNotTreeItem extends UnaryOpTreeItem { - - public BitNotTreeItem(Action instruction, TreeItem value) { - super(instruction, PRECEDENCE_UNARY, value, "~"); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class BitNotTreeItem extends UnaryOpTreeItem { + + public BitNotTreeItem(Action instruction, TreeItem value) { + super(instruction, PRECEDENCE_UNARY, value, "~"); + } +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitOrTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitOrTreeItem.java index 77449025a..74a313ceb 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitOrTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitOrTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class BitOrTreeItem extends BinaryOpTreeItem { - - public BitOrTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_BITWISEOR, leftSide, rightSide, "|"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class BitOrTreeItem extends BinaryOpTreeItem { + + public BitOrTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_BITWISEOR, leftSide, rightSide, "|"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitXorTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitXorTreeItem.java index 05811f0a6..b163dd8e4 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitXorTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/BitXorTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class BitXorTreeItem extends BinaryOpTreeItem { - - public BitXorTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_BITWISEXOR, leftSide, rightSide, "^"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class BitXorTreeItem extends BinaryOpTreeItem { + + public BitXorTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_BITWISEXOR, leftSide, rightSide, "^"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/DivideTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/DivideTreeItem.java index 76bdad8b6..0abaf7e63 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/DivideTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/DivideTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class DivideTreeItem extends BinaryOpTreeItem { - - public DivideTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "/"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class DivideTreeItem extends BinaryOpTreeItem { + + public DivideTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "/"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/EqTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/EqTreeItem.java index fe8c65589..2b8520ec4 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/EqTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/EqTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class EqTreeItem extends BinaryOpTreeItem { - - public EqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "=="); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class EqTreeItem extends BinaryOpTreeItem { + + public EqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "=="); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/GeTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/GeTreeItem.java index c2e30c659..b38dfdb2e 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/GeTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/GeTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class GeTreeItem extends BinaryOpTreeItem { - - public GeTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">="); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class GeTreeItem extends BinaryOpTreeItem { + + public GeTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">="); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/GtTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/GtTreeItem.java index 5bbcbbdd6..ac0285b7b 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/GtTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/GtTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class GtTreeItem extends BinaryOpTreeItem { - - public GtTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class GtTreeItem extends BinaryOpTreeItem { + + public GtTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, ">"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/InTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/InTreeItem.java index 4183558a5..d51ede798 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/InTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/InTreeItem.java @@ -1,18 +1,32 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class InTreeItem extends BinaryOpTreeItem { - - public InTreeItem(Action instruction, TreeItem name, TreeItem object) { - super(instruction, PRECEDENCE_RELATIONAL, name, object, " in "); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class InTreeItem extends BinaryOpTreeItem { + + public InTreeItem(Action instruction, TreeItem name, TreeItem object) { + super(instruction, PRECEDENCE_RELATIONAL, name, object, " in "); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/InstanceOfTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/InstanceOfTreeItem.java index d0ecb0611..5268c4efd 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/InstanceOfTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/InstanceOfTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class InstanceOfTreeItem extends BinaryOpTreeItem { - - public InstanceOfTreeItem(Action instruction, TreeItem value, TreeItem type) { - super(instruction, PRECEDENCE_RELATIONAL, value, type, " instanceof "); - } - -} \ No newline at end of file +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class InstanceOfTreeItem extends BinaryOpTreeItem { + + public InstanceOfTreeItem(Action instruction, TreeItem value, TreeItem type) { + super(instruction, PRECEDENCE_RELATIONAL, value, type, " instanceof "); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/IsTypeTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/IsTypeTreeItem.java index 38c0ad467..d1f67410e 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/IsTypeTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/IsTypeTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class IsTypeTreeItem extends BinaryOpTreeItem { - - public IsTypeTreeItem(Action instruction, TreeItem value, TreeItem type) { - super(instruction, PRECEDENCE_RELATIONAL, value, type, " is "); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class IsTypeTreeItem extends BinaryOpTreeItem { + + public IsTypeTreeItem(Action instruction, TreeItem value, TreeItem type) { + super(instruction, PRECEDENCE_RELATIONAL, value, type, " is "); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/LShiftTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/LShiftTreeItem.java index 4fdba1acd..032e4b6c7 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/LShiftTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/LShiftTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class LShiftTreeItem extends BinaryOpTreeItem { - - public LShiftTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, "<<"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class LShiftTreeItem extends BinaryOpTreeItem { + + public LShiftTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, "<<"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/LeTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/LeTreeItem.java index 9f5492525..b6be90018 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/LeTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/LeTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class LeTreeItem extends BinaryOpTreeItem { - - public LeTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<="); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class LeTreeItem extends BinaryOpTreeItem { + + public LeTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<="); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/LtTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/LtTreeItem.java index 8b2c5def6..07105743b 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/LtTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/LtTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class LtTreeItem extends BinaryOpTreeItem { - - public LtTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class LtTreeItem extends BinaryOpTreeItem { + + public LtTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/MBStringLengthTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/MBStringLengthTreeItem.java index 04e3bd726..15f790790 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/MBStringLengthTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/MBStringLengthTreeItem.java @@ -1,26 +1,40 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.ConstantPool; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class MBStringLengthTreeItem extends TreeItem { - public TreeItem value; - - public MBStringLengthTreeItem(Action instruction, TreeItem value) { - super(instruction, PRECEDENCE_PRIMARY); - this.value = value; - } - - @Override - public String toString(ConstantPool constants) { - String s = value.toString(constants); - if (value.precedence > precedence) s = "(" + s + ")"; - return hilight("mblength(") + s + ")"; - } -} \ No newline at end of file +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.ConstantPool; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class MBStringLengthTreeItem extends TreeItem { + public TreeItem value; + + public MBStringLengthTreeItem(Action instruction, TreeItem value) { + super(instruction, PRECEDENCE_PRIMARY); + this.value = value; + } + + @Override + public String toString(ConstantPool constants) { + String s = value.toString(constants); + if (value.precedence > precedence) s = "(" + s + ")"; + return hilight("mblength(") + s + ")"; + } +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/ModuloTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/ModuloTreeItem.java index 29f38b959..3937a1a94 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/ModuloTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/ModuloTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class ModuloTreeItem extends BinaryOpTreeItem { - - public ModuloTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "%"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class ModuloTreeItem extends BinaryOpTreeItem { + + public ModuloTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "%"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/MultiplyTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/MultiplyTreeItem.java index 08948b043..4d3222bef 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/MultiplyTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/MultiplyTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class MultiplyTreeItem extends BinaryOpTreeItem { - - public MultiplyTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "*"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class MultiplyTreeItem extends BinaryOpTreeItem { + + public MultiplyTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_MULTIPLICATIVE, leftSide, rightSide, "*"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/NegTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/NegTreeItem.java index 4291cace8..83e1bdc5c 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/NegTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/NegTreeItem.java @@ -1,16 +1,30 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class NegTreeItem extends UnaryOpTreeItem { - - public NegTreeItem(Action instruction, TreeItem value) { - super(instruction, PRECEDENCE_UNARY, value, "-"); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class NegTreeItem extends UnaryOpTreeItem { + + public NegTreeItem(Action instruction, TreeItem value) { + super(instruction, PRECEDENCE_UNARY, value, "-"); + } +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/NeqTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/NeqTreeItem.java index e0a6082d9..e32dd7973 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/NeqTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/NeqTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class NeqTreeItem extends BinaryOpTreeItem { - - public NeqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!="); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class NeqTreeItem extends BinaryOpTreeItem { + + public NeqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!="); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/NotTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/NotTreeItem.java index e5c65717f..11d926f54 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/NotTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/NotTreeItem.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class NotTreeItem extends UnaryOpTreeItem { - - public NotTreeItem(Action instruction, TreeItem value) { - super(instruction, PRECEDENCE_UNARY, value, "!"); - } - - @Override - public boolean isTrue() { - return !value.isTrue(); - } - - @Override - public boolean isFalse() { - return !value.isFalse(); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class NotTreeItem extends UnaryOpTreeItem { + + public NotTreeItem(Action instruction, TreeItem value) { + super(instruction, PRECEDENCE_UNARY, value, "!"); + } + + @Override + public boolean isTrue() { + return !value.isTrue(); + } + + @Override + public boolean isFalse() { + return !value.isFalse(); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/OrTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/OrTreeItem.java index f1bd0f959..5bc7da6a2 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/OrTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/OrTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class OrTreeItem extends BinaryOpTreeItem { - - public OrTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_LOGICALOR, leftSide, rightSide, "||"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class OrTreeItem extends BinaryOpTreeItem { + + public OrTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_LOGICALOR, leftSide, rightSide, "||"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/PreDecrementTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/PreDecrementTreeItem.java index 583743e84..96c7259e0 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/PreDecrementTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/PreDecrementTreeItem.java @@ -1,15 +1,29 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class PreDecrementTreeItem extends UnaryOpTreeItem { - public PreDecrementTreeItem(Action instruction, TreeItem object) { - super(instruction, PRECEDENCE_UNARY, object, "--"); - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class PreDecrementTreeItem extends UnaryOpTreeItem { + public PreDecrementTreeItem(Action instruction, TreeItem object) { + super(instruction, PRECEDENCE_UNARY, object, "--"); + } +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/PreIncrementTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/PreIncrementTreeItem.java index 01309c1e7..3535b0490 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/PreIncrementTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/PreIncrementTreeItem.java @@ -1,18 +1,32 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class PreIncrementTreeItem extends UnaryOpTreeItem { - - public PreIncrementTreeItem(Action instruction, TreeItem object) { - super(instruction, PRECEDENCE_UNARY, object, "++"); - } - - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class PreIncrementTreeItem extends UnaryOpTreeItem { + + public PreIncrementTreeItem(Action instruction, TreeItem object) { + super(instruction, PRECEDENCE_UNARY, object, "++"); + } + + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/RShiftTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/RShiftTreeItem.java index 781cc57b9..52acbc358 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/RShiftTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/RShiftTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class RShiftTreeItem extends BinaryOpTreeItem { - - public RShiftTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class RShiftTreeItem extends BinaryOpTreeItem { + + public RShiftTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/StrictEqTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/StrictEqTreeItem.java index c393be937..662d744f1 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/StrictEqTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/StrictEqTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class StrictEqTreeItem extends BinaryOpTreeItem { - - public StrictEqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "==="); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class StrictEqTreeItem extends BinaryOpTreeItem { + + public StrictEqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "==="); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/StrictNeqTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/StrictNeqTreeItem.java index 4ce5485d3..39ccf5977 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/StrictNeqTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/StrictNeqTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class StrictNeqTreeItem extends BinaryOpTreeItem { - - public StrictNeqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!=="); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class StrictNeqTreeItem extends BinaryOpTreeItem { + + public StrictNeqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "!=="); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringAddTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringAddTreeItem.java index ebc352aac..0a5ec513d 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringAddTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringAddTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class StringAddTreeItem extends BinaryOpTreeItem { - - public StringAddTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "+"); - } - -} \ No newline at end of file +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class StringAddTreeItem extends BinaryOpTreeItem { + + public StringAddTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "+"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringEqTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringEqTreeItem.java index 674ee14e2..b70c20e5d 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringEqTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringEqTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class StringEqTreeItem extends BinaryOpTreeItem { - - public StringEqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "=="); - } - -} \ No newline at end of file +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class StringEqTreeItem extends BinaryOpTreeItem { + + public StringEqTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_EQUALITY, leftSide, rightSide, "=="); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringLengthTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringLengthTreeItem.java index b28cacead..b0ce2a9bd 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringLengthTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringLengthTreeItem.java @@ -1,26 +1,40 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.ConstantPool; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class StringLengthTreeItem extends TreeItem { - public TreeItem value; - - public StringLengthTreeItem(Action instruction, TreeItem value) { - super(instruction, PRECEDENCE_PRIMARY); - this.value = value; - } - - @Override - public String toString(ConstantPool constants) { - String s = value.toString(constants); - if (value.precedence > precedence) s = "(" + s + ")"; - return s + hilight(".length"); - } -} \ No newline at end of file +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.ConstantPool; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class StringLengthTreeItem extends TreeItem { + public TreeItem value; + + public StringLengthTreeItem(Action instruction, TreeItem value) { + super(instruction, PRECEDENCE_PRIMARY); + this.value = value; + } + + @Override + public String toString(ConstantPool constants) { + String s = value.toString(constants); + if (value.precedence > precedence) s = "(" + s + ")"; + return s + hilight(".length"); + } +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringLtTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringLtTreeItem.java index 859077775..395249a19 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringLtTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/StringLtTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class StringLtTreeItem extends BinaryOpTreeItem { - - public StringLtTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<"); - } - -} \ No newline at end of file +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class StringLtTreeItem extends BinaryOpTreeItem { + + public StringLtTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_RELATIONAL, leftSide, rightSide, "<"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/SubtractTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/SubtractTreeItem.java index b3f5cb569..b6d8dbb3f 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/SubtractTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/SubtractTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class SubtractTreeItem extends BinaryOpTreeItem { - - public SubtractTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "-"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class SubtractTreeItem extends BinaryOpTreeItem { + + public SubtractTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_ADDITIVE, leftSide, rightSide, "-"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/URShiftTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/URShiftTreeItem.java index 86e7306e4..5d029d7e6 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/URShiftTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/URShiftTreeItem.java @@ -1,17 +1,31 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public class URShiftTreeItem extends BinaryOpTreeItem { - - public URShiftTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { - super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>>"); - } - -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public class URShiftTreeItem extends BinaryOpTreeItem { + + public URShiftTreeItem(Action instruction, TreeItem leftSide, TreeItem rightSide) { + super(instruction, PRECEDENCE_BITWISESHIFT, leftSide, rightSide, ">>>"); + } + +} diff --git a/trunk/src/com/jpexs/asdec/action/treemodel/operations/UnaryOpTreeItem.java b/trunk/src/com/jpexs/asdec/action/treemodel/operations/UnaryOpTreeItem.java index f63b4aa9e..e35e4214f 100644 --- a/trunk/src/com/jpexs/asdec/action/treemodel/operations/UnaryOpTreeItem.java +++ b/trunk/src/com/jpexs/asdec/action/treemodel/operations/UnaryOpTreeItem.java @@ -1,28 +1,42 @@ -/* - * Copyright (c) 2010. JPEXS - */ - -package com.jpexs.asdec.action.treemodel.operations; - -import com.jpexs.asdec.action.Action; -import com.jpexs.asdec.action.treemodel.ConstantPool; -import com.jpexs.asdec.action.treemodel.TreeItem; - - -public abstract class UnaryOpTreeItem extends TreeItem { - public TreeItem value; - public String operator; - - public UnaryOpTreeItem(Action instruction, int precedence, TreeItem value, String operator) { - super(instruction, precedence); - this.value = value; - this.operator = operator; - } - - @Override - public String toString(ConstantPool constants) { - String s = value.toString(constants); - if (value.precedence > precedence) s = "(" + s + ")"; - return hilight(operator) + s; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.action.treemodel.operations; + +import com.jpexs.asdec.action.Action; +import com.jpexs.asdec.action.treemodel.ConstantPool; +import com.jpexs.asdec.action.treemodel.TreeItem; + + +public abstract class UnaryOpTreeItem extends TreeItem { + public TreeItem value; + public String operator; + + public UnaryOpTreeItem(Action instruction, int precedence, TreeItem value, String operator) { + super(instruction, precedence); + this.value = value; + this.operator = operator; + } + + @Override + public String toString(ConstantPool constants) { + String s = value.toString(constants); + if (value.precedence > precedence) s = "(" + s + ")"; + return hilight(operator) + s; + } +} diff --git a/trunk/src/com/jpexs/asdec/gui/LoadingDialog.java b/trunk/src/com/jpexs/asdec/gui/LoadingDialog.java index bf717c1a1..53b166b99 100644 --- a/trunk/src/com/jpexs/asdec/gui/LoadingDialog.java +++ b/trunk/src/com/jpexs/asdec/gui/LoadingDialog.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.gui; import com.jpexs.asdec.Main; diff --git a/trunk/src/com/jpexs/asdec/gui/LoadingPanel.java b/trunk/src/com/jpexs/asdec/gui/LoadingPanel.java index 39e9322b5..86913dc6b 100644 --- a/trunk/src/com/jpexs/asdec/gui/LoadingPanel.java +++ b/trunk/src/com/jpexs/asdec/gui/LoadingPanel.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.gui; import javax.swing.*; @@ -44,4 +62,4 @@ public class LoadingPanel extends JPanel { super.paintComponent(g); g.drawImage(animationImage, getWidth() / 2 - iconWidth / 2, getHeight() / 2 - iconHeight / 2, getWidth() / 2 + iconWidth / 2, getHeight() / 2 + iconHeight / 2, pos * 100, 0, (pos + 1) * 100, 100, this); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/gui/ModeFrame.java b/trunk/src/com/jpexs/asdec/gui/ModeFrame.java index 549e1647e..bdf1be4b1 100644 --- a/trunk/src/com/jpexs/asdec/gui/ModeFrame.java +++ b/trunk/src/com/jpexs/asdec/gui/ModeFrame.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.gui; import com.jpexs.asdec.Main; diff --git a/trunk/src/com/jpexs/asdec/gui/View.java b/trunk/src/com/jpexs/asdec/gui/View.java index 9c69274b1..3f4b4b395 100644 --- a/trunk/src/com/jpexs/asdec/gui/View.java +++ b/trunk/src/com/jpexs/asdec/gui/View.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.gui; import javax.swing.*; diff --git a/trunk/src/com/jpexs/asdec/gui/proxy/ProxyFrame.java b/trunk/src/com/jpexs/asdec/gui/proxy/ProxyFrame.java index f4cd10dc6..14a569908 100644 --- a/trunk/src/com/jpexs/asdec/gui/proxy/ProxyFrame.java +++ b/trunk/src/com/jpexs/asdec/gui/proxy/ProxyFrame.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.gui.proxy; import com.jpexs.asdec.Main; diff --git a/trunk/src/com/jpexs/asdec/gui/proxy/SWFListModel.java b/trunk/src/com/jpexs/asdec/gui/proxy/SWFListModel.java index 7c1b18135..fb33f69f9 100644 --- a/trunk/src/com/jpexs/asdec/gui/proxy/SWFListModel.java +++ b/trunk/src/com/jpexs/asdec/gui/proxy/SWFListModel.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.gui.proxy; import com.jpexs.proxy.Replacement; diff --git a/trunk/src/com/jpexs/asdec/helpers/Helper.java b/trunk/src/com/jpexs/asdec/helpers/Helper.java index 67bff76e7..a24acc370 100644 --- a/trunk/src/com/jpexs/asdec/helpers/Helper.java +++ b/trunk/src/com/jpexs/asdec/helpers/Helper.java @@ -1,110 +1,128 @@ -package com.jpexs.asdec.helpers; - -/** - * Class with helper method - * - * @author JPEXS - */ -public class Helper { - /** - * Converts array of int values to string - * - * @param array Array of int values - * @return String representation of the array - */ - public static String intArrToString(int array[]) { - String s = "["; - for (int i = 0; i < array.length; i++) { - if (i > 0) { - s += ","; - } - s = s + array[i]; - } - s += "]"; - return s; - } - - - /** - * Converts array of byte values to string - * - * @param array Array of byte values - * @return String representation of the array - */ - public static String byteArrToString(byte array[]) { - String s = "["; - for (int i = 0; i < array.length; i++) { - if (i > 0) { - s += " "; - } - s = s + padZeros(Integer.toHexString(array[i] & 0xff), 2); - } - s += "]"; - return s; - } - - /** - * Adds zeros to beginning of the number to fill specified length. Returns as string - * - * @param number Number as string - * @param length Length of new string - * @return Number with added zeros - */ - public static String padZeros(String number, int length) { - int count = length - number.length(); - for (int i = 0; i < count; i++) { - number = "0" + number; - } - return number; - } - - /** - * Formats specified address to four numbers xxxx - * - * @param number Address to format - * @return String representation of the address - */ - public static String formatAddress(long number) { - return padZeros(Long.toHexString(number), 4); - } - - /** - * Adds space to text to fill specified width - * - * @param text Text to add spaces to - * @param width New width - * @return Text with appended spaces - */ - public static String padSpaceRight(String text, int width) { - int oldLen = text.length(); - for (int i = oldLen; i < width; i++) { - text += " "; - } - return text; - } - - /** - * Escapes string by adding backslashes - * - * @param s String to escape - * @return Escaped string - */ - public static String escapeString(String s) { - String ret = ""; - for (int i = 0; i < s.length(); i++) { - char c = s.charAt(i); - if (c == '\n') ret += "\\n"; - else if (c == '\r') ret += "\\r"; - else if (c == '\t') ret += "\\t"; - else if (c == '\b') ret += "\\b"; - else if (c == '\t') ret += "\\t"; - else if (c == '\f') ret += "\\f"; - else if (c == '\\') ret += "\\\\"; - else if (c == '"') ret += "\\\""; - else if (c == '\'') ret += "\\'"; - else ret += c; - - } - return ret; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.helpers; + +/** + * Class with helper method + * + * @author JPEXS + */ +public class Helper { + /** + * Converts array of int values to string + * + * @param array Array of int values + * @return String representation of the array + */ + public static String intArrToString(int array[]) { + String s = "["; + for (int i = 0; i < array.length; i++) { + if (i > 0) { + s += ","; + } + s = s + array[i]; + } + s += "]"; + return s; + } + + + /** + * Converts array of byte values to string + * + * @param array Array of byte values + * @return String representation of the array + */ + public static String byteArrToString(byte array[]) { + String s = "["; + for (int i = 0; i < array.length; i++) { + if (i > 0) { + s += " "; + } + s = s + padZeros(Integer.toHexString(array[i] & 0xff), 2); + } + s += "]"; + return s; + } + + /** + * Adds zeros to beginning of the number to fill specified length. Returns as string + * + * @param number Number as string + * @param length Length of new string + * @return Number with added zeros + */ + public static String padZeros(String number, int length) { + int count = length - number.length(); + for (int i = 0; i < count; i++) { + number = "0" + number; + } + return number; + } + + /** + * Formats specified address to four numbers xxxx + * + * @param number Address to format + * @return String representation of the address + */ + public static String formatAddress(long number) { + return padZeros(Long.toHexString(number), 4); + } + + /** + * Adds space to text to fill specified width + * + * @param text Text to add spaces to + * @param width New width + * @return Text with appended spaces + */ + public static String padSpaceRight(String text, int width) { + int oldLen = text.length(); + for (int i = oldLen; i < width; i++) { + text += " "; + } + return text; + } + + /** + * Escapes string by adding backslashes + * + * @param s String to escape + * @return Escaped string + */ + public static String escapeString(String s) { + String ret = ""; + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + if (c == '\n') ret += "\\n"; + else if (c == '\r') ret += "\\r"; + else if (c == '\t') ret += "\\t"; + else if (c == '\b') ret += "\\b"; + else if (c == '\t') ret += "\\t"; + else if (c == '\f') ret += "\\f"; + else if (c == '\\') ret += "\\\\"; + else if (c == '"') ret += "\\\""; + else if (c == '\'') ret += "\\'"; + else ret += c; + + } + return ret; + } +} diff --git a/trunk/src/com/jpexs/asdec/helpers/Highlighting.java b/trunk/src/com/jpexs/asdec/helpers/Highlighting.java index 4ca952c6d..30ba1d055 100644 --- a/trunk/src/com/jpexs/asdec/helpers/Highlighting.java +++ b/trunk/src/com/jpexs/asdec/helpers/Highlighting.java @@ -1,184 +1,202 @@ -package com.jpexs.asdec.helpers; - -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Pattern; - -/** - * Provides methods for highlighting positions of instructions in the text. - * - * @author JPEXS - */ -public class Highlighting { - /** - * Starting position - */ - public int startPos; - /** - * Length of highlighted text - */ - public int len; - /** - * Offset of instruction or trait - */ - public long offset; - - /** - * Returns a string representation of the object - * - * @return a string representation of the object. - */ - @Override - public String toString() { - return "" + startPos + "-" + (startPos + len) + " ofs" + offset; - } - - /** - * Constructor - * - * @param startPos Starting position - * @param len Length of highlighted text - * @param offset Offset of instruction or trait - */ - public Highlighting(int startPos, int len, long offset) { - this.startPos = startPos; - this.len = len; - this.offset = offset; - } - - - private static final String OFSOPEN = "[OFS"; - private static final String OFSCLOSE = "]"; - private static final String OFSEND = "[/OFS]"; - - private static final String TRAITOPEN = "[TRAIT"; - private static final String TRAITCLOSE = "]"; - private static final String TRAITEND = "[/TRAIT]"; - - - /** - * Highlights specified text as instruction by adding special tags - * - * @param text Text to highlight - * @param offset Offset of instruction - * @return Highlighted text - */ - public static String hilighOffset(String text, long offset) { - return OFSOPEN + offset + OFSCLOSE + text + OFSEND; - } - - /** - * Highlights specified text as trait by adding special tags - * - * @param text Text to highlight - * @param offset Offset of trait - * @return Highlighted text - */ - public static String hilighTrait(String text, long offset) { - return TRAITOPEN + offset + TRAITCLOSE + text + TRAITEND; - } - - /** - * Strips all highlights from the text - * - * @param text Text to strip highlights in - * @return Text with no highlights - */ - public static String stripHilights(String text) { - text = stripInstrHilights(text); - text = stripTraitHilights(text); - return text; - } - - /** - * Strips instruction highlights from the text - * - * @param text Text to strip instruction highlights in - * @return Text with no instruction highlights - */ - public static String stripInstrHilights(String text) { - text = text.replaceAll(Pattern.quote(OFSOPEN) + "[0-9]+" + Pattern.quote(OFSCLOSE), ""); - text = text.replace(OFSEND, ""); - return text; - } - - /** - * Strips trait highlights from the text - * - * @param text Text to strip trait highlights in - * @return Text with no trait highlights - */ - public static String stripTraitHilights(String text) { - text = text.replaceAll(Pattern.quote(TRAITOPEN) + "[0-9]+" + Pattern.quote(TRAITCLOSE), ""); - text = text.replace(TRAITEND, ""); - return text; - } - - /** - * Gets all trait highlight objects from specified text - * - * @param text Text to get highlights from - * @return List of trait highlights - */ - public static List getTraitHighlights(String text) { - text = text.replace("\r\n", "\n"); - text = stripInstrHilights(text); - List ret = new ArrayList(); - int pos = 0; - while (true) { - int openpos = text.indexOf(TRAITOPEN); - if (openpos == -1) break; - int closepos = text.indexOf(TRAITCLOSE, openpos); - int enpos = text.indexOf(TRAITEND, openpos); - int textlen = enpos - closepos - TRAITCLOSE.length(); - - int nextopenpos = text.indexOf(TRAITOPEN, openpos + 1); - if (nextopenpos != -1) { - if (nextopenpos < closepos) { - System.err.println(text); - throw new RuntimeException("Crossed highlight"); - } - } - long offset = Long.parseLong(text.substring(openpos + TRAITOPEN.length(), closepos)); - Highlighting hl = new Highlighting(pos + openpos, textlen, offset); - pos += openpos + textlen; - text = text.substring(enpos + TRAITEND.length()); - ret.add(hl); - } - return ret; - } - - /** - * Gets all instruction highlight objects from specified text - * - * @param text Text to get highlights from - * @return List of instruction highlights - */ - public static List getInstrHighlights(String text) { - text = text.replace("\r\n", "\n"); - text = stripTraitHilights(text); - List ret = new ArrayList(); - int pos = 0; - while (true) { - int openpos = text.indexOf(OFSOPEN); - if (openpos == -1) break; - int closepos = text.indexOf(OFSCLOSE, openpos); - int enpos = text.indexOf(OFSEND, openpos); - int textlen = enpos - closepos - OFSCLOSE.length(); - - int nextopenpos = text.indexOf(OFSOPEN, openpos + 1); - if (nextopenpos != -1) { - if (nextopenpos < closepos) { - System.err.println(text); - throw new RuntimeException("Crossed highlight"); - } - } - long offset = Long.parseLong(text.substring(openpos + OFSOPEN.length(), closepos)); - Highlighting hl = new Highlighting(pos + openpos, textlen, offset); - pos += openpos + textlen; - text = text.substring(enpos + OFSEND.length()); - ret.add(hl); - } - return ret; - } -} +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.helpers; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; + +/** + * Provides methods for highlighting positions of instructions in the text. + * + * @author JPEXS + */ +public class Highlighting { + /** + * Starting position + */ + public int startPos; + /** + * Length of highlighted text + */ + public int len; + /** + * Offset of instruction or trait + */ + public long offset; + + /** + * Returns a string representation of the object + * + * @return a string representation of the object. + */ + @Override + public String toString() { + return "" + startPos + "-" + (startPos + len) + " ofs" + offset; + } + + /** + * Constructor + * + * @param startPos Starting position + * @param len Length of highlighted text + * @param offset Offset of instruction or trait + */ + public Highlighting(int startPos, int len, long offset) { + this.startPos = startPos; + this.len = len; + this.offset = offset; + } + + + private static final String OFSOPEN = "[OFS"; + private static final String OFSCLOSE = "]"; + private static final String OFSEND = "[/OFS]"; + + private static final String TRAITOPEN = "[TRAIT"; + private static final String TRAITCLOSE = "]"; + private static final String TRAITEND = "[/TRAIT]"; + + + /** + * Highlights specified text as instruction by adding special tags + * + * @param text Text to highlight + * @param offset Offset of instruction + * @return Highlighted text + */ + public static String hilighOffset(String text, long offset) { + return OFSOPEN + offset + OFSCLOSE + text + OFSEND; + } + + /** + * Highlights specified text as trait by adding special tags + * + * @param text Text to highlight + * @param offset Offset of trait + * @return Highlighted text + */ + public static String hilighTrait(String text, long offset) { + return TRAITOPEN + offset + TRAITCLOSE + text + TRAITEND; + } + + /** + * Strips all highlights from the text + * + * @param text Text to strip highlights in + * @return Text with no highlights + */ + public static String stripHilights(String text) { + text = stripInstrHilights(text); + text = stripTraitHilights(text); + return text; + } + + /** + * Strips instruction highlights from the text + * + * @param text Text to strip instruction highlights in + * @return Text with no instruction highlights + */ + public static String stripInstrHilights(String text) { + text = text.replaceAll(Pattern.quote(OFSOPEN) + "[0-9]+" + Pattern.quote(OFSCLOSE), ""); + text = text.replace(OFSEND, ""); + return text; + } + + /** + * Strips trait highlights from the text + * + * @param text Text to strip trait highlights in + * @return Text with no trait highlights + */ + public static String stripTraitHilights(String text) { + text = text.replaceAll(Pattern.quote(TRAITOPEN) + "[0-9]+" + Pattern.quote(TRAITCLOSE), ""); + text = text.replace(TRAITEND, ""); + return text; + } + + /** + * Gets all trait highlight objects from specified text + * + * @param text Text to get highlights from + * @return List of trait highlights + */ + public static List getTraitHighlights(String text) { + text = text.replace("\r\n", "\n"); + text = stripInstrHilights(text); + List ret = new ArrayList(); + int pos = 0; + while (true) { + int openpos = text.indexOf(TRAITOPEN); + if (openpos == -1) break; + int closepos = text.indexOf(TRAITCLOSE, openpos); + int enpos = text.indexOf(TRAITEND, openpos); + int textlen = enpos - closepos - TRAITCLOSE.length(); + + int nextopenpos = text.indexOf(TRAITOPEN, openpos + 1); + if (nextopenpos != -1) { + if (nextopenpos < closepos) { + System.err.println(text); + throw new RuntimeException("Crossed highlight"); + } + } + long offset = Long.parseLong(text.substring(openpos + TRAITOPEN.length(), closepos)); + Highlighting hl = new Highlighting(pos + openpos, textlen, offset); + pos += openpos + textlen; + text = text.substring(enpos + TRAITEND.length()); + ret.add(hl); + } + return ret; + } + + /** + * Gets all instruction highlight objects from specified text + * + * @param text Text to get highlights from + * @return List of instruction highlights + */ + public static List getInstrHighlights(String text) { + text = text.replace("\r\n", "\n"); + text = stripTraitHilights(text); + List ret = new ArrayList(); + int pos = 0; + while (true) { + int openpos = text.indexOf(OFSOPEN); + if (openpos == -1) break; + int closepos = text.indexOf(OFSCLOSE, openpos); + int enpos = text.indexOf(OFSEND, openpos); + int textlen = enpos - closepos - OFSCLOSE.length(); + + int nextopenpos = text.indexOf(OFSOPEN, openpos + 1); + if (nextopenpos != -1) { + if (nextopenpos < closepos) { + System.err.println(text); + throw new RuntimeException("Crossed highlight"); + } + } + long offset = Long.parseLong(text.substring(openpos + OFSOPEN.length(), closepos)); + Highlighting hl = new Highlighting(pos + openpos, textlen, offset); + pos += openpos + textlen; + text = text.substring(enpos + OFSEND.length()); + ret.add(hl); + } + return ret; + } +} diff --git a/trunk/src/com/jpexs/asdec/tags/ASMSource.java b/trunk/src/com/jpexs/asdec/tags/ASMSource.java index b34ef52f3..11eaedb35 100644 --- a/trunk/src/com/jpexs/asdec/tags/ASMSource.java +++ b/trunk/src/com/jpexs/asdec/tags/ASMSource.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.tags; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/tags/Container.java b/trunk/src/com/jpexs/asdec/tags/Container.java index 1a329b8d1..236d42bd1 100644 --- a/trunk/src/com/jpexs/asdec/tags/Container.java +++ b/trunk/src/com/jpexs/asdec/tags/Container.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.tags; import java.util.List; diff --git a/trunk/src/com/jpexs/asdec/tags/DefineButton2Tag.java b/trunk/src/com/jpexs/asdec/tags/DefineButton2Tag.java index 02778aae3..4a6edf556 100644 --- a/trunk/src/com/jpexs/asdec/tags/DefineButton2Tag.java +++ b/trunk/src/com/jpexs/asdec/tags/DefineButton2Tag.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.tags; import com.jpexs.asdec.Main; diff --git a/trunk/src/com/jpexs/asdec/tags/DefineButtonTag.java b/trunk/src/com/jpexs/asdec/tags/DefineButtonTag.java index 9fee1cb7c..eefde9e97 100644 --- a/trunk/src/com/jpexs/asdec/tags/DefineButtonTag.java +++ b/trunk/src/com/jpexs/asdec/tags/DefineButtonTag.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.tags; import com.jpexs.asdec.Main; @@ -135,4 +153,4 @@ public class DefineButtonTag extends Tag implements ASMSource { public List getActions() { return actions; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/tags/DefineSpriteTag.java b/trunk/src/com/jpexs/asdec/tags/DefineSpriteTag.java index 88b1d1451..dafbb7302 100644 --- a/trunk/src/com/jpexs/asdec/tags/DefineSpriteTag.java +++ b/trunk/src/com/jpexs/asdec/tags/DefineSpriteTag.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.tags; import com.jpexs.asdec.Main; diff --git a/trunk/src/com/jpexs/asdec/tags/DoABCTag.java b/trunk/src/com/jpexs/asdec/tags/DoABCTag.java index b0dd2b9e0..efc6deb8c 100644 --- a/trunk/src/com/jpexs/asdec/tags/DoABCTag.java +++ b/trunk/src/com/jpexs/asdec/tags/DoABCTag.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.tags; import com.jpexs.asdec.Main; diff --git a/trunk/src/com/jpexs/asdec/tags/DoActionTag.java b/trunk/src/com/jpexs/asdec/tags/DoActionTag.java index baf9443be..760954b68 100644 --- a/trunk/src/com/jpexs/asdec/tags/DoActionTag.java +++ b/trunk/src/com/jpexs/asdec/tags/DoActionTag.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.tags; import com.jpexs.asdec.SWFInputStream; @@ -94,4 +112,4 @@ public class DoActionTag extends Tag implements ASMSource { public List getActions() { return actions; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/tags/DoInitActionTag.java b/trunk/src/com/jpexs/asdec/tags/DoInitActionTag.java index b47444622..c21b85d20 100644 --- a/trunk/src/com/jpexs/asdec/tags/DoInitActionTag.java +++ b/trunk/src/com/jpexs/asdec/tags/DoInitActionTag.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.tags; import com.jpexs.asdec.SWFInputStream; @@ -116,4 +134,4 @@ public class DoInitActionTag extends Tag implements ASMSource { public List getActions() { return actions; } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/tags/ExportAssetsTag.java b/trunk/src/com/jpexs/asdec/tags/ExportAssetsTag.java index dbb9cb179..95665885e 100644 --- a/trunk/src/com/jpexs/asdec/tags/ExportAssetsTag.java +++ b/trunk/src/com/jpexs/asdec/tags/ExportAssetsTag.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.tags; import com.jpexs.asdec.SWFInputStream; diff --git a/trunk/src/com/jpexs/asdec/tags/PlaceObject2Tag.java b/trunk/src/com/jpexs/asdec/tags/PlaceObject2Tag.java index c735fa5bf..72d249de9 100644 --- a/trunk/src/com/jpexs/asdec/tags/PlaceObject2Tag.java +++ b/trunk/src/com/jpexs/asdec/tags/PlaceObject2Tag.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.tags; import com.jpexs.asdec.Main; diff --git a/trunk/src/com/jpexs/asdec/tags/PlaceObject3Tag.java b/trunk/src/com/jpexs/asdec/tags/PlaceObject3Tag.java index e41b05e68..02db23e47 100644 --- a/trunk/src/com/jpexs/asdec/tags/PlaceObject3Tag.java +++ b/trunk/src/com/jpexs/asdec/tags/PlaceObject3Tag.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.tags; import com.jpexs.asdec.Main; @@ -299,4 +317,4 @@ public class PlaceObject3Tag extends Tag implements Container { if (!placeFlagHasClipActions) return 0; return clipActions.clipActionRecords.size(); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/tags/ShowFrameTag.java b/trunk/src/com/jpexs/asdec/tags/ShowFrameTag.java index aa3bf25c5..38442993b 100644 --- a/trunk/src/com/jpexs/asdec/tags/ShowFrameTag.java +++ b/trunk/src/com/jpexs/asdec/tags/ShowFrameTag.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.tags; /** diff --git a/trunk/src/com/jpexs/asdec/tags/Tag.java b/trunk/src/com/jpexs/asdec/tags/Tag.java index 9c2b5b615..3004c8db3 100644 --- a/trunk/src/com/jpexs/asdec/tags/Tag.java +++ b/trunk/src/com/jpexs/asdec/tags/Tag.java @@ -1,65 +1,83 @@ -package com.jpexs.asdec.tags; - -/** - * Represents Tag inside SWF file - */ -public class Tag { - /** - * Identifier of tag type - */ - protected int id; - /** - * Data in the tag - */ - protected byte data[]; - - /** - * If true, then Tag is written to the stream as longer than 0x3f even if it is not - */ - public boolean forceWriteAsLong = false; - - /** - * Returns identifier of tag type - * - * @return Identifier of tag type - */ - public int getId() { - return id; - } - - /** - * Constructor - * - * @param id Tag type identifier - * @param data Bytes of data - */ - public Tag(int id, byte[] data) { - this.id = id; - this.data = data; - } - - /** - * Gets data bytes - * - * @param version SWF version - * @return Bytes of data - */ - public byte[] getData(int version) { - return data; - } - - /** - * Returns string representation of the object - * - * @return String representation of the object - */ - @Override - public String toString() { - return "Tag id:" + id; - } - - public final long getOrigDataLength() { - return data.length; - } - -} \ No newline at end of file +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.jpexs.asdec.tags; + +/** + * Represents Tag inside SWF file + */ +public class Tag { + /** + * Identifier of tag type + */ + protected int id; + /** + * Data in the tag + */ + protected byte data[]; + + /** + * If true, then Tag is written to the stream as longer than 0x3f even if it is not + */ + public boolean forceWriteAsLong = false; + + /** + * Returns identifier of tag type + * + * @return Identifier of tag type + */ + public int getId() { + return id; + } + + /** + * Constructor + * + * @param id Tag type identifier + * @param data Bytes of data + */ + public Tag(int id, byte[] data) { + this.id = id; + this.data = data; + } + + /** + * Gets data bytes + * + * @param version SWF version + * @return Bytes of data + */ + public byte[] getData(int version) { + return data; + } + + /** + * Returns string representation of the object + * + * @return String representation of the object + */ + @Override + public String toString() { + return "Tag id:" + id; + } + + public final long getOrigDataLength() { + return data.length; + } + +} diff --git a/trunk/src/com/jpexs/asdec/types/ARGB.java b/trunk/src/com/jpexs/asdec/types/ARGB.java index 0695d04ff..1489b8e91 100644 --- a/trunk/src/com/jpexs/asdec/types/ARGB.java +++ b/trunk/src/com/jpexs/asdec/types/ARGB.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types; /** @@ -22,4 +40,4 @@ public class ARGB { * Blue color value */ public int blue; -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/types/BUTTONCONDACTION.java b/trunk/src/com/jpexs/asdec/types/BUTTONCONDACTION.java index fae61f67a..ce0414f3e 100644 --- a/trunk/src/com/jpexs/asdec/types/BUTTONCONDACTION.java +++ b/trunk/src/com/jpexs/asdec/types/BUTTONCONDACTION.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/types/BUTTONRECORD.java b/trunk/src/com/jpexs/asdec/types/BUTTONRECORD.java index 9a17fac5e..798d4e073 100644 --- a/trunk/src/com/jpexs/asdec/types/BUTTONRECORD.java +++ b/trunk/src/com/jpexs/asdec/types/BUTTONRECORD.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types; import com.jpexs.asdec.types.filters.FILTER; diff --git a/trunk/src/com/jpexs/asdec/types/CLIPACTIONRECORD.java b/trunk/src/com/jpexs/asdec/types/CLIPACTIONRECORD.java index f6e65ff99..672c2c50d 100644 --- a/trunk/src/com/jpexs/asdec/types/CLIPACTIONRECORD.java +++ b/trunk/src/com/jpexs/asdec/types/CLIPACTIONRECORD.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types; import com.jpexs.asdec.action.Action; diff --git a/trunk/src/com/jpexs/asdec/types/CLIPACTIONS.java b/trunk/src/com/jpexs/asdec/types/CLIPACTIONS.java index a85fafc67..e8dbf3d9f 100644 --- a/trunk/src/com/jpexs/asdec/types/CLIPACTIONS.java +++ b/trunk/src/com/jpexs/asdec/types/CLIPACTIONS.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types; import java.util.List; diff --git a/trunk/src/com/jpexs/asdec/types/CLIPEVENTFLAGS.java b/trunk/src/com/jpexs/asdec/types/CLIPEVENTFLAGS.java index 6fb626812..23196d0c9 100644 --- a/trunk/src/com/jpexs/asdec/types/CLIPEVENTFLAGS.java +++ b/trunk/src/com/jpexs/asdec/types/CLIPEVENTFLAGS.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types; /** diff --git a/trunk/src/com/jpexs/asdec/types/CXFORMWITHALPHA.java b/trunk/src/com/jpexs/asdec/types/CXFORMWITHALPHA.java index d67acad09..f54cf934b 100644 --- a/trunk/src/com/jpexs/asdec/types/CXFORMWITHALPHA.java +++ b/trunk/src/com/jpexs/asdec/types/CXFORMWITHALPHA.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types; /** diff --git a/trunk/src/com/jpexs/asdec/types/MATRIX.java b/trunk/src/com/jpexs/asdec/types/MATRIX.java index eaedc71ff..db92c97b6 100644 --- a/trunk/src/com/jpexs/asdec/types/MATRIX.java +++ b/trunk/src/com/jpexs/asdec/types/MATRIX.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types; /** diff --git a/trunk/src/com/jpexs/asdec/types/RECT.java b/trunk/src/com/jpexs/asdec/types/RECT.java index f0d05b645..6adb6da32 100644 --- a/trunk/src/com/jpexs/asdec/types/RECT.java +++ b/trunk/src/com/jpexs/asdec/types/RECT.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types; /** diff --git a/trunk/src/com/jpexs/asdec/types/RGBA.java b/trunk/src/com/jpexs/asdec/types/RGBA.java index f9217e979..73349060a 100644 --- a/trunk/src/com/jpexs/asdec/types/RGBA.java +++ b/trunk/src/com/jpexs/asdec/types/RGBA.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types; /** diff --git a/trunk/src/com/jpexs/asdec/types/filters/BEVELFILTER.java b/trunk/src/com/jpexs/asdec/types/filters/BEVELFILTER.java index d022d3f4a..8be74a267 100644 --- a/trunk/src/com/jpexs/asdec/types/filters/BEVELFILTER.java +++ b/trunk/src/com/jpexs/asdec/types/filters/BEVELFILTER.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types.filters; import com.jpexs.asdec.types.RGBA; diff --git a/trunk/src/com/jpexs/asdec/types/filters/BLURFILTER.java b/trunk/src/com/jpexs/asdec/types/filters/BLURFILTER.java index 42f93dd57..516ec0a87 100644 --- a/trunk/src/com/jpexs/asdec/types/filters/BLURFILTER.java +++ b/trunk/src/com/jpexs/asdec/types/filters/BLURFILTER.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types.filters; /** diff --git a/trunk/src/com/jpexs/asdec/types/filters/COLORMATRIXFILTER.java b/trunk/src/com/jpexs/asdec/types/filters/COLORMATRIXFILTER.java index bd021af15..752461874 100644 --- a/trunk/src/com/jpexs/asdec/types/filters/COLORMATRIXFILTER.java +++ b/trunk/src/com/jpexs/asdec/types/filters/COLORMATRIXFILTER.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types.filters; /** diff --git a/trunk/src/com/jpexs/asdec/types/filters/CONVOLUTIONFILTER.java b/trunk/src/com/jpexs/asdec/types/filters/CONVOLUTIONFILTER.java index 94e1e9cac..bd9936da9 100644 --- a/trunk/src/com/jpexs/asdec/types/filters/CONVOLUTIONFILTER.java +++ b/trunk/src/com/jpexs/asdec/types/filters/CONVOLUTIONFILTER.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types.filters; import com.jpexs.asdec.types.RGBA; diff --git a/trunk/src/com/jpexs/asdec/types/filters/DROPSHADOWFILTER.java b/trunk/src/com/jpexs/asdec/types/filters/DROPSHADOWFILTER.java index 0fd093daf..6551eb71b 100644 --- a/trunk/src/com/jpexs/asdec/types/filters/DROPSHADOWFILTER.java +++ b/trunk/src/com/jpexs/asdec/types/filters/DROPSHADOWFILTER.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types.filters; import com.jpexs.asdec.types.RGBA; diff --git a/trunk/src/com/jpexs/asdec/types/filters/FILTER.java b/trunk/src/com/jpexs/asdec/types/filters/FILTER.java index d7d005638..2ae5560a3 100644 --- a/trunk/src/com/jpexs/asdec/types/filters/FILTER.java +++ b/trunk/src/com/jpexs/asdec/types/filters/FILTER.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types.filters; /** diff --git a/trunk/src/com/jpexs/asdec/types/filters/GLOWFILTER.java b/trunk/src/com/jpexs/asdec/types/filters/GLOWFILTER.java index 3ab6b136f..7d6552780 100644 --- a/trunk/src/com/jpexs/asdec/types/filters/GLOWFILTER.java +++ b/trunk/src/com/jpexs/asdec/types/filters/GLOWFILTER.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types.filters; import com.jpexs.asdec.types.RGBA; diff --git a/trunk/src/com/jpexs/asdec/types/filters/GRADIENTBEVELFILTER.java b/trunk/src/com/jpexs/asdec/types/filters/GRADIENTBEVELFILTER.java index 559b9993e..d2a1e8c24 100644 --- a/trunk/src/com/jpexs/asdec/types/filters/GRADIENTBEVELFILTER.java +++ b/trunk/src/com/jpexs/asdec/types/filters/GRADIENTBEVELFILTER.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types.filters; import com.jpexs.asdec.types.RGBA; @@ -60,4 +78,4 @@ public class GRADIENTBEVELFILTER extends FILTER { public GRADIENTBEVELFILTER() { super(7); } -} \ No newline at end of file +} diff --git a/trunk/src/com/jpexs/asdec/types/filters/GRADIENTGLOWFILTER.java b/trunk/src/com/jpexs/asdec/types/filters/GRADIENTGLOWFILTER.java index 423ccfbbb..1b4224d64 100644 --- a/trunk/src/com/jpexs/asdec/types/filters/GRADIENTGLOWFILTER.java +++ b/trunk/src/com/jpexs/asdec/types/filters/GRADIENTGLOWFILTER.java @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2010 JPEXS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + package com.jpexs.asdec.types.filters; import com.jpexs.asdec.types.RGBA; @@ -63,4 +81,4 @@ public class GRADIENTGLOWFILTER extends FILTER { public GRADIENTGLOWFILTER() { super(4); } -} \ No newline at end of file +}