Home | History | Annotate | Download | only in animator
      1 #ifndef SkScriptRuntime_DEFINED
      2 #define SkScriptRuntime_DEFINED
      3 
      4 #include "SkOperand2.h"
      5 #include "SkTDArray_Experimental.h"
      6 #include "SkTDStack.h"
      7 
      8 class SkScriptCallBack;
      9 
     10 typedef SkLongArray(SkString*) SkTDStringArray;
     11 typedef SkLongArray(SkScriptCallBack*) SkTDScriptCallBackArray;
     12 
     13 class SkScriptRuntime {
     14 public:
     15 	enum SkError {
     16 		kNoError,
     17 		kArrayIndexOutOfBounds,
     18 		kCouldNotFindReferencedID,
     19 		kFunctionCallFailed,
     20 		kMemberOpFailed,
     21 		kPropertyOpFailed
     22 	};
     23 
     24 	SkScriptRuntime(SkTDScriptCallBackArray& callBackArray) : fCallBackArray(callBackArray)
     25 		{  }
     26 	~SkScriptRuntime();
     27 	bool executeTokens(unsigned char* opCode);
     28 	bool getResult(SkOperand2* result);
     29 	void untrack(SkOpArray* array);
     30 	void untrack(SkString* string);
     31 private:
     32 	void track(SkOpArray* array);
     33 	void track(SkString* string);
     34 	SkTDScriptCallBackArray& fCallBackArray;
     35 	SkError fError;
     36 	SkTDStack<SkOperand2> fRunStack;
     37 	SkLongArray(SkOpArray*) fTrackArray;
     38 	SkTDStringArray fTrackString;
     39 	// illegal
     40 	SkScriptRuntime& operator=(const SkScriptRuntime&);
     41 };
     42 
     43 #endif // SkScriptRuntime_DEFINED