180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/*
380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2011 Google Inc.
480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru *
580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be
680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file.
780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */
880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef SkScriptRuntime_DEFINED
980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SkScriptRuntime_DEFINED
1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkOperand2.h"
1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkTDArray_Experimental.h"
1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#include "SkTDStack.h"
1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkScriptCallBack;
1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querutypedef SkLongArray(SkString*) SkTDStringArray;
1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querutypedef SkLongArray(SkScriptCallBack*) SkTDScriptCallBackArray;
1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruclass SkScriptRuntime {
2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic:
2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    enum SkError {
2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kNoError,
2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kArrayIndexOutOfBounds,
2580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kCouldNotFindReferencedID,
2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kFunctionCallFailed,
2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kMemberOpFailed,
2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        kPropertyOpFailed
2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    };
3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkScriptRuntime(SkTDScriptCallBackArray& callBackArray) : fCallBackArray(callBackArray)
3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru        {  }
3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    ~SkScriptRuntime();
3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    bool executeTokens(unsigned char* opCode);
3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    bool getResult(SkOperand2* result);
3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void untrack(SkOpArray* array);
3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void untrack(SkString* string);
3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate:
3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void track(SkOpArray* array);
4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    void track(SkString* string);
4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkTDScriptCallBackArray& fCallBackArray;
4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkError fError;
4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkTDStack<SkOperand2> fRunStack;
4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkLongArray(SkOpArray*) fTrackArray;
4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkTDStringArray fTrackString;
4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    // illegal
4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru    SkScriptRuntime& operator=(const SkScriptRuntime&);
4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru};
4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru
5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif // SkScriptRuntime_DEFINED
51