1 /*****************************************************************************\
2 script.h : Interface for Scripter classes
4 Copyright (c) 1996 - 2001, Hewlett-Packard Co.
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
10 1. Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15 3. Neither the name of Hewlett-Packard nor the names of its
16 contributors may be used to endorse or promote products derived
17 from this software without specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
20 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
22 NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24 TO, PATENT INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
25 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 \*****************************************************************************/
37 Scripter(SystemServices* pSS);
40 unsigned int TokenCount;
41 unsigned int ReplayTokenCount;
44 char ScriptFileName[200];
45 unsigned int fontcount;
52 virtual BOOL OpenDebugStreamR(const char* filename)=0;
53 virtual BOOL CloseDebugStreamR()=0;
54 virtual BOOL OpenDebugStreamW(const char* filename)=0;
55 virtual BOOL CloseDebugStreamW()=0;
56 virtual BOOL PutDebugToken(const int token)=0;
57 virtual BOOL PutDebugInt(const int data)=0;
58 virtual BOOL PutDebugByte(const BYTE data)=0;
59 virtual BOOL PutDebugStream(const BYTE* stream,const int len)=0;
60 virtual BOOL PutDebugString(const char* str,const int len)=0;
61 virtual BOOL GetDebugToken(int& token)=0;
62 virtual BOOL GetDebugInt(int& data)=0;
63 virtual BOOL GetDebugString(char*& str,int& len)=0;
64 virtual BOOL GetDebugStream(const unsigned int buffersize, BYTE*& buffer)=0;
65 virtual BOOL GetDebugByte(BYTE& data)=0;
67 BOOL ParseVer(char* str);
70 class AsciiScripter : public Scripter
73 AsciiScripter(SystemServices* pSS);
76 virtual BOOL OpenDebugStreamR(const char* filename);
77 virtual BOOL CloseDebugStreamR();
78 virtual BOOL OpenDebugStreamW(const char* filename);
79 virtual BOOL CloseDebugStreamW();
80 virtual BOOL PutDebugToken(const int token);
81 virtual BOOL PutDebugInt(const int data);
82 virtual BOOL PutDebugByte(const BYTE data);
83 virtual BOOL PutDebugString(const char* str,const int len);
84 virtual BOOL PutDebugStream(const BYTE* stream,const int len);
85 virtual BOOL GetDebugToken(int& token);
86 virtual BOOL GetDebugInt(int& data);
87 virtual BOOL GetDebugByte(BYTE& data);
88 virtual BOOL GetDebugString(char*& str,int& len);
89 virtual BOOL GetDebugStream(const unsigned int buffersize, BYTE*& buffer );
91 void ReadRLE(int instreamlen, BYTE* outstream);
92 void ReadRaw(int instreamlen, BYTE* outstream);
98 char tempStr[TEMPLEN];
100 char TokString[25][40]; // 25=# of tokens in harness.h; table set in ProtoServices cons.
101 unsigned int TokCount[25];
105 class BinaryScripter : public AsciiScripter
108 BinaryScripter(SystemServices* pSS);
111 BOOL OpenDebugStreamR(const char* filename);
112 BOOL OpenDebugStreamW(const char* filename);
113 BOOL PutDebugToken(const int token);
114 BOOL PutDebugInt(const int data);
115 BOOL PutDebugByte(const BYTE data);
116 BOOL PutDebugString(const char* str,const int len);
117 BOOL PutDebugStream(const BYTE* stream,const int len);
118 BOOL GetDebugToken(int& token);
119 BOOL GetDebugInt(int& data);
120 BOOL GetDebugString(char*& str,int& len);
121 BOOL GetDebugStream(const unsigned int buffersize, BYTE*& buffer );
122 BOOL GetDebugByte(BYTE& data);