001: /*
002: * $Id: Actions.java,v 1.3 2002/06/17 03:13:05 skavish Exp $
003: *
004: * ==========================================================================
005: *
006: * The JGenerator Software License, Version 1.0
007: *
008: * Copyright (c) 2000 Dmitry Skavish (skavish@usa.net). All rights reserved.
009: *
010: * Redistribution and use in source and binary forms, with or without
011: * modification, are permitted provided that the following conditions are met:
012: *
013: * 1. Redistributions of source code must retain the above copyright
014: * notice, this list of conditions and the following disclaimer.
015: *
016: * 2. Redistributions in binary form must reproduce the above copyright
017: * notice, this list of conditions and the following disclaimer in
018: * the documentation and/or other materials provided with the
019: * distribution.
020: *
021: * 3. The end-user documentation included with the redistribution, if
022: * any, must include the following acknowlegement:
023: * "This product includes software developed by Dmitry Skavish
024: * (skavish@usa.net, http://www.flashgap.com/)."
025: * Alternately, this acknowlegement may appear in the software itself,
026: * if and wherever such third-party acknowlegements normally appear.
027: *
028: * 4. The name "The JGenerator" must not be used to endorse or promote
029: * products derived from this software without prior written permission.
030: * For written permission, please contact skavish@usa.net.
031: *
032: * 5. Products derived from this software may not be called "The JGenerator"
033: * nor may "The JGenerator" appear in their names without prior written
034: * permission of Dmitry Skavish.
035: *
036: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
037: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
038: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
039: * DISCLAIMED. IN NO EVENT SHALL DMITRY SKAVISH OR THE OTHER
040: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
042: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
043: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
044: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
045: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
046: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
047: * SUCH DAMAGE.
048: *
049: */
050:
051: package org.openlaszlo.iv.flash.api.action;
052:
053: import java.io.PrintStream;
054: import org.openlaszlo.iv.flash.util.*;
055: import org.openlaszlo.iv.flash.parser.*;
056: import org.openlaszlo.iv.flash.api.*;
057:
058: /**
059: * Enumeration of all known actions
060: */
061: public class Actions {
062:
063: public static final int None = 0x00;
064: public static final int NextFrame = 0x04;
065: public static final int PrevFrame = 0x05;
066: public static final int Play = 0x06;
067: public static final int Stop = 0x07;
068: public static final int ToggleQuality = 0x08;
069: public static final int StopSounds = 0x09;
070: public static final int Add = 0x0A;
071: public static final int Subtract = 0x0B;
072: public static final int Multiply = 0x0C;
073: public static final int Divide = 0x0D;
074: public static final int Equal = 0x0E;
075: public static final int LessThan = 0x0F;
076: public static final int LogicalAnd = 0x10;
077: public static final int LogicalOr = 0x11;
078: public static final int LogicalNot = 0x12;
079: public static final int StringEqual = 0x13;
080: public static final int StringLength = 0x14;
081: public static final int SubString = 0x15;
082: public static final int Pop = 0x17;
083: public static final int Int = 0x18;
084: public static final int Eval = 0x1C;
085: public static final int SetVariable = 0x1D;
086: public static final int SetTargetExpression = 0x20;
087: public static final int StringConcat = 0x21;
088: public static final int GetProperty = 0x22;
089: public static final int SetProperty = 0x23;
090: public static final int DuplicateClip = 0x24;
091: public static final int RemoveClip = 0x25;
092: public static final int Trace = 0x26;
093: public static final int StartDragMovie = 0x27;
094: public static final int StopDragMovie = 0x28;
095: public static final int StringLessThan = 0x29;
096: public static final int Random = 0x30;
097: public static final int MBLength = 0x31;
098: public static final int Ord = 0x32;
099: public static final int Chr = 0x33;
100: public static final int GetTimer = 0x34;
101: public static final int MBSubString = 0x35;
102: public static final int MBOrd = 0x36;
103: public static final int MBChr = 0x37;
104: public static final int GotoFrame = 0x81; // frame num (WORD)
105: public static final int GetURL = 0x83; // url (STR), window (STR)
106: public static final int WaitForFrame = 0x8A; // frame needed (WORD), actions to skip (BYTE)
107: public static final int SetTarget = 0x8B; // name (STR)
108: public static final int GotoLabel = 0x8C; // name (STR)
109: public static final int WaitForFrameExpression = 0x8D; // frame needed on stack, actions to skip (BYTE)
110: public static final int PushData = 0x96;
111: public static final int Jump = 0x99;
112: public static final int GetURL2 = 0x9A;
113: public static final int JumpIfTrue = 0x9D;
114: public static final int CallFrame = 0x9E;
115: public static final int GotoExpression = 0x9F;
116:
117: // Flash 5 actions
118: public static final int Delete = 0x3A;
119: public static final int Delete2 = 0x3B;
120: public static final int DefineLocal = 0x3C;
121: public static final int CallFunction = 0x3D;
122: public static final int Return = 0x3E;
123: public static final int Modulo = 0x3F;
124: public static final int NewObject = 0x40;
125: public static final int DefineLocal2 = 0x41;
126: public static final int InitArray = 0x42;
127: public static final int InitObject = 0x43;
128: public static final int TypeOf = 0x44;
129: public static final int TargetPath = 0x45;
130: public static final int Enumerate = 0x46;
131: public static final int Add2 = 0x47;
132: public static final int Less2 = 0x48;
133: public static final int Equals2 = 0x49;
134: public static final int ObjectToNumber = 0x4A;
135: public static final int ObjectToString = 0x4B;
136: public static final int PushDuplicate = 0x4C;
137: public static final int StackSwap = 0x4D;
138: public static final int GetMember = 0x4E;
139: public static final int SetMember = 0x4F;
140: public static final int Increment = 0x50;
141: public static final int Decrement = 0x51;
142: public static final int CallMethod = 0x52;
143: public static final int NewMethod = 0x53;
144: public static final int BitAnd = 0x60;
145: public static final int BitOr = 0x61;
146: public static final int BitXor = 0x62;
147: public static final int BitLShift = 0x63;
148: public static final int BitRShift = 0x64;
149: public static final int BitURShift = 0x65;
150: public static final int StoreRegister = 0x87; // register number (byte)
151: public static final int ConstantPool = 0x88; // num (WORD), pool (STR*num)
152: public static final int With = 0x94; // withBlock (STR)
153: public static final int DefineFunction = 0x9B; // name (STR), parmsNum (WORD), parms (STR*parmsNum), codeSize (WORD), code (UI8*codeSize)
154:
155: public static final String[] actionsNames = { "None", "NextFrame",
156: "PrevFrame", "Play", "Stop", "ToggleQuality", "StopSounds",
157: "Add", "Subtract", "Multiply", "Divide", "Equal",
158: "LessThan", "LogicalAnd", "LogicalOr", "LogicalNot",
159: "StringEqual", "StringLength", "SubString", "Pop", "Int",
160: "Eval", "SetVariable", "SetTargetExpression",
161: "StringConcat", "GetProperty", "SetProperty",
162: "DuplicateClip", "RemoveClip", "Trace", "StartDragMovie",
163: "StopDragMovie", "StringLessThan", "Random", "MBLength",
164: "Ord", "Chr", "GetTimer", "MBSubString", "MBOrd", "MBChr",
165: "GotoFrame", "GetURL", "WaitForFrame", "SetTarget",
166: "GotoLabel", "WaitForFrameExpression", "PushData", "Jump",
167: "GetURL2", "JumpIfTrue", "CallFrame", "GotoExpression",
168: "Delete", "Delete2", "DefineLocal", "CallFunction",
169: "Return", "Modulo", "NewObject", "DefineLocal2",
170: "InitArray", "InitObject", "TypeOf", "TargetPath",
171: "Enumerate", "Add2", "Less2", "Equals2", "ObjectToNumber",
172: "ObjectToString", "PushDuplicate", "StackSwap",
173: "GetMember", "SetMember", "Increment", "Decrement",
174: "CallMethod", "NewMethod", "BitAnd", "BitOr", "BitXor",
175: "BitLShift", "BitRShift", "BitURShift", "StoreRegister",
176: "ConstantPool", "With", "DefineFunction", };
177:
178: // names and indexes have to be in the same order
179: public static final int[] actionsIndexes = { None, NextFrame,
180: PrevFrame, Play, Stop, ToggleQuality, StopSounds, Add,
181: Subtract, Multiply, Divide, Equal, LessThan, LogicalAnd,
182: LogicalOr, LogicalNot, StringEqual, StringLength,
183: SubString, Pop, Int, Eval, SetVariable,
184: SetTargetExpression, StringConcat, GetProperty,
185: SetProperty, DuplicateClip, RemoveClip, Trace,
186: StartDragMovie, StopDragMovie, StringLessThan, Random,
187: MBLength, Ord, Chr, GetTimer, MBSubString, MBOrd, MBChr,
188: GotoFrame, GetURL, WaitForFrame, SetTarget, GotoLabel,
189: WaitForFrameExpression, PushData, Jump, GetURL2,
190: JumpIfTrue, CallFrame, GotoExpression, Delete, Delete2,
191: DefineLocal, CallFunction, Return, Modulo, NewObject,
192: DefineLocal2, InitArray, InitObject, TypeOf, TargetPath,
193: Enumerate, Add2, Less2, Equals2, ObjectToNumber,
194: ObjectToString, PushDuplicate, StackSwap, GetMember,
195: SetMember, Increment, Decrement, CallMethod, NewMethod,
196: BitAnd, BitOr, BitXor, BitLShift, BitRShift, BitURShift,
197: StoreRegister, ConstantPool, With, DefineFunction, };
198:
199: public static String getActionName(int action) {
200: for (int i = 0; i < actionsIndexes.length; i++) {
201: if (action == actionsIndexes[i])
202: return actionsNames[i];
203: }
204: return "<unknown>";
205: }
206:
207: }
|