File: VCSScrpt.hxx

package info (click to toggle)
stella 0.7-2
  • links: PTS
  • area: non-free
  • in suites: hamm, slink
  • size: 864 kB
  • ctags: 1,158
  • sloc: cpp: 6,615; ansic: 492; makefile: 224; asm: 31
file content (76 lines) | stat: -rw-r--r-- 2,164 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//============================================================================
//
//    SSSS    tt          lll  lll              
//   SS  SS   tt           ll   ll                
//   SS     tttttt  eeee   ll   ll   aaaa    "An Atari 2600 VCS Emulator"
//    SSSS    tt   ee  ee  ll   ll      aa      
//       SS   tt   eeeeee  ll   ll   aaaaa   Copyright (c) 1995,1996,1997
//   SS  SS   tt   ee      ll   ll  aa  aa         Bradford W. Mott
//    SSSS     ttt  eeeee llll llll  aaaaa    
//
//============================================================================

#ifndef VCSSCRIPT_HXX
#define VCSSCRIPT_HXX

class Properties;

#include "machine.hxx"

/**
  Objects of this class are VCS-Script interpreters.  They can read
  in a VCS-Script file, parse it, and evalute it.

  The parser has been hacked together pretty quickly and I'm sure it
  has several problems, however, it seems to behave pretty good
  on "correct" input.

  @author  Bradford W. Mott
  @version $Id: VCSScrpt.hxx,v 1.1 1997/05/17 19:04:13 bwmott Exp $
*/
class VCSScript
{
  public:
    /// Construct VCSScript object
    VCSScript();

    /// Destructor
    ~VCSScript();

  public:
    /// Evaluate the specified script using the supplied environment
    void evaluate(istream& stream, Properties& env);

  private:
    // Get the next token but don't discard it.  Answer true iff a valid
    // token was read.
    bool peekToken(char* token);

    // Set token to the next token and remove the token.
    // Answer true iff everything is okay.
    bool nextToken(char* token);

    // Skip the next list and any sub-lists within that list
    void skip(int level = 0);

    // Evalute the boolean expression that follows
    bool evaluateBooleanExpression(Properties& env);

    // Run the next statement
    void run(Properties& env);

  private:
    // File stream used to read script file with
    istream* myStream;

    // Buffer for a single token
    char myToken[256];

    // Indicates if the string in myToken is a valid token
    bool myTokenValid;

    // Indicates the current line number in the script file being processed
    uLong myLineNumber;
};
#endif