ScummVM API documentation
instruction.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 // Based on Phantasma code by Thomas Harte (2013),
23 // available at https://github.com/TomHarte/Phantasma/ (MIT)
24 
25 #ifndef FREESCAPE_INSTRUCTION_H
26 #define FREESCAPE_INSTRUCTION_H
27 
28 #include "common/array.h"
29 #include "freescape/language/token.h"
30 
31 namespace Freescape {
32 
33 class FCLInstruction;
34 typedef Common::Array<FCLInstruction> FCLInstructionVector;
35 
37 public:
39  FCLInstruction(Token::Type type);
40  void setSource(int32 source);
41  void setAdditional(int32 additional);
42  void setDestination(int32 destination);
43 
44  Token::Type getType() const;
45 
46  bool isConditional() const {
47  Token::Type type = getType();
48  return type == Token::Type::BITNOTEQ || type == Token::Type::VARNOTEQ || \
49  type == Token::Type::IFGTEQ || type == Token::Type::IFLTEQ || \
50  type == Token::Type::VAREQ || _type == Token::Type::INVISQ;
51  }
52 
53  void setBranches(FCLInstructionVector *thenBranch, FCLInstructionVector *elseBranch);
54 
55  FCLInstruction duplicate();
56 
57  int32 _source;
58  int32 _additional;
59  int32 _destination;
60 
61  FCLInstructionVector *_thenInstructions;
62  FCLInstructionVector *_elseInstructions;
63 
64 private:
65  enum Token::Type _type;
66 };
67 
68 } // End of namespace Freescape
69 
70 #endif // FREESCAPE_INSTRUCTION_H
Definition: area.h:36
Definition: instruction.h:36