@awayfl/avm1
Version:
Virtual machine for executing AS1 and AS2 code
214 lines • 7.05 kB
TypeScript
import { AVM1ActionsData, AVM1Context } from './context';
import { ArgumentAssignment, ArgumentAssignmentType, ParsedAction } from './parser';
import { AVM1EvalFunction } from './runtime';
import { AVM1NativeActions } from './lib/AVM1Globals';
import { AVM1Object } from './runtime/AVM1Object';
import { AVM1Function } from './runtime/AVM1Function';
import { FrameScriptManager } from '@awayjs/scene';
export declare const Debugger: {
pause: boolean;
breakpoints: {};
};
export declare const MAX_AVM1_HANG_TIMEOUT = 1000;
export declare const CHECK_AVM1_HANG_EVERY = 1000;
export declare enum AVM1ScopeListItemFlags {
DEFAULT = 0,
TARGET = 1,
REPLACE_TARGET = 2
}
export declare class AVM1ScopeListItem {
scope: AVM1Object;
previousScopeItem: AVM1ScopeListItem;
flags: AVM1ScopeListItemFlags;
replaceTargetBy: AVM1Object;
constructor(scope: AVM1Object, previousScopeItem: AVM1ScopeListItem);
}
export declare class GlobalPropertiesScope extends AVM1Object {
constructor(context: AVM1Context, thisArg: AVM1Object);
}
export declare class AVM1CallFrame {
previousFrame: AVM1CallFrame;
currentThis: AVM1Object;
fn: AVM1Function;
args: any[];
ectx: ExecutionContext;
inSequence: boolean;
calleeThis: AVM1Object;
calleeSuper: AVM1Object;
calleeFn: AVM1Function;
calleeArgs: any[];
constructor(previousFrame: AVM1CallFrame, currentThis: AVM1Object, fn: AVM1Function, args: any[], ectx: ExecutionContext);
setCallee(thisArg: AVM1Object, superArg: AVM1Object, fn: AVM1Function, args: any[]): void;
resetCallee(): void;
}
export declare class AVM1ContextImpl extends AVM1Context {
initialScope: AVM1ScopeListItem;
isActive: boolean;
executionProhibited: boolean;
abortExecutionAt: number;
actionTracer: ActionTracer;
stackDepth: number;
frame: AVM1CallFrame;
isTryCatchListening: boolean;
errorsIgnored: number;
deferScriptExecution: boolean;
actions: AVM1NativeActions;
constructor(swfVersion: number);
_getExecutionContext(): ExecutionContext;
resolveTarget(target: any): any;
resolveRoot(): any;
checkTimeout(): void;
pushCallFrame(thisArg: AVM1Object, fn: AVM1Function, args: any[], ectx: ExecutionContext): AVM1CallFrame;
popCallFrame(): AVM1CallFrame;
executeActions(actionsData: AVM1ActionsData, scopeObj: any): void;
executeFunction(fn: AVM1Function, thisArg: any, args: any[]): any;
}
export declare class ExecutionContext {
static MAX_CACHED_EXECUTIONCONTEXTS: number;
static cache: ExecutionContext[];
static alInitStatic(): void;
framescriptmanager: FrameScriptManager;
context: AVM1ContextImpl;
actions: AVM1NativeActions;
scopeList: AVM1ScopeListItem;
constantPool: any[];
registers: any[];
stack: any[];
frame: AVM1CallFrame;
isSwfVersion5: boolean;
isSwfVersion7: boolean;
recoveringFromError: boolean;
isEndOfActions: boolean;
constructor(context: AVM1ContextImpl, scopeList: AVM1ScopeListItem, constantPool: any[], registerCount: number);
reset(scopeList: AVM1ScopeListItem, constantPool: any[], registerCount: number): void;
clean(): void;
pushScope(newScopeList?: AVM1ScopeListItem): ExecutionContext;
dispose(): void;
static create(context: AVM1ContextImpl, scopeList: AVM1ScopeListItem, constantPool: any[], registerCount: number): ExecutionContext;
}
export declare class AVM1InterpretedFunction extends AVM1EvalFunction {
functionName: string;
actionsData: AVM1ActionsData;
parametersNames: string[];
registersAllocation: ArgumentAssignment[];
suppressArguments: ArgumentAssignmentType;
scopeList: AVM1ScopeListItem;
constantPool: any[];
skipArguments: boolean[];
registersLength: number;
constructor(context: AVM1ContextImpl, ectx: ExecutionContext, actionsData: AVM1ActionsData, functionName: string, parametersNames: string[], registersCount: number, registersAllocation: ArgumentAssignment[], suppressArguments: ArgumentAssignmentType);
alCall(thisArg: any, args?: any[]): any;
}
export declare function generateActionCalls(): {
ActionGotoFrame: any;
ActionGetURL: any;
ActionNextFrame: any;
ActionPreviousFrame: any;
ActionPlay: any;
ActionStop: any;
ActionToggleQuality: any;
ActionStopSounds: any;
ActionWaitForFrame: any;
ActionSetTarget: any;
ActionGoToLabel: any;
ActionPush: any;
ActionPop: any;
ActionAdd: any;
ActionSubtract: any;
ActionMultiply: any;
ActionDivide: any;
ActionEquals: any;
ActionLess: any;
ActionAnd: any;
ActionOr: any;
ActionNot: any;
ActionStringEquals: any;
ActionStringLength: any;
ActionMBStringLength: any;
ActionStringAdd: any;
ActionStringExtract: any;
ActionMBStringExtract: any;
ActionStringLess: any;
ActionToInteger: any;
ActionCharToAscii: any;
ActionMBCharToAscii: any;
ActionAsciiToChar: any;
ActionMBAsciiToChar: any;
ActionJump: any;
ActionIf: any;
ActionCall: any;
ActionGetVariable: any;
ActionSetVariable: any;
ActionGetURL2: any;
ActionGotoFrame2: any;
ActionSetTarget2: any;
ActionGetProperty: any;
ActionSetProperty: any;
ActionCloneSprite: any;
ActionRemoveSprite: any;
ActionStartDrag: any;
ActionEndDrag: any;
ActionWaitForFrame2: any;
ActionTrace: any;
ActionGetTime: any;
ActionRandomNumber: any;
ActionCallFunction: any;
ActionCallMethod: any;
ActionConstantPool: any;
ActionDefineFunction: any;
ActionDefineLocal: any;
ActionDefineLocal2: any;
ActionDelete: any;
ActionDelete2: any;
ActionEnumerate: any;
ActionEquals2: any;
ActionGetMember: any;
ActionInitArray: any;
ActionInitObject: any;
ActionNewMethod: any;
ActionNewObject: any;
ActionSetMember: any;
ActionTargetPath: any;
ActionWith: any;
ActionToNumber: any;
ActionToString: any;
ActionTypeOf: any;
ActionAdd2: any;
ActionLess2: any;
ActionModulo: any;
ActionBitAnd: any;
ActionBitLShift: any;
ActionBitOr: any;
ActionBitRShift: any;
ActionBitURShift: any;
ActionBitXor: any;
ActionDecrement: any;
ActionIncrement: any;
ActionPushDuplicate: any;
ActionReturn: any;
ActionStackSwap: any;
ActionStoreRegister: any;
ActionInstanceOf: any;
ActionEnumerate2: any;
ActionStrictEquals: any;
ActionGreater: any;
ActionStringGreater: any;
ActionDefineFunction2: any;
ActionExtends: any;
ActionCastOp: any;
ActionImplementsOp: any;
ActionTry: any;
ActionThrow: any;
ActionFSCommand2: any;
ActionStrictMode: any;
};
export declare class ActionTracer {
private _indentation;
private _indentStringCache;
private _getIndentString;
print(parsedAction: ParsedAction, stack: any[]): void;
indent(): void;
unindent(): void;
message(msg: string): void;
}
//# sourceMappingURL=interpreter.d.ts.map