blob: 01f7205b2fbe30faaea1105771356c375227e57a (
plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/********************* */
/** command.cpp
** Original author: mdeters
** Major contributors: dejan
** Minor contributors (to current version): none
** This file is part of the CVC4 prototype.
** Copyright (c) 2009, 2010 The Analysis of Computer Systems Group (ACSys)
** Courant Institute of Mathematical Sciences
** New York University
** See the file COPYING in the top-level source directory for licensing
** information.
**
** Implementation of command objects.
**/
#include "expr/command.h"
#include "smt/smt_engine.h"
using namespace std;
namespace CVC4 {
ostream& operator<<(ostream& out, const Command* command) {
if (command == NULL) {
out << "null";
} else {
command->toStream(out);
}
return out;
}
CommandSequence::~CommandSequence() {
for(unsigned i = d_index; i < d_commandSequence.size(); ++i) {
delete d_commandSequence[i];
}
}
void CommandSequence::invoke(SmtEngine* smtEngine) {
for(; d_index < d_commandSequence.size(); ++d_index) {
d_commandSequence[d_index]->invoke(smtEngine);
delete d_commandSequence[d_index];
}
}
void CheckSatCommand::toStream(ostream& out) const {
if(d_expr.isNull()) {
out << "CheckSat()";
} else {
out << "CheckSat(" << d_expr << ")";
}
}
void CommandSequence::toStream(ostream& out) const {
out << "CommandSequence[" << endl;
for(unsigned i = d_index; i < d_commandSequence.size(); ++i) {
out << *d_commandSequence[i] << endl;
}
out << "]";
}
void DeclarationCommand::toStream(std::ostream& out) const {
out << "Declare(";
bool first = true;
for(unsigned i = 0; i < d_declaredSymbols.size(); ++i) {
if(!first) {
out << ", ";
}
out << d_declaredSymbols[i];
first = false;
}
out << ")";
}
void PushCommand::invoke(SmtEngine* smtEngine) {
smtEngine->push();
}
void PushCommand::toStream(ostream& out) const {
out << "Push()";
}
void PopCommand::invoke(SmtEngine* smtEngine) {
smtEngine->pop();
}
void PopCommand::toStream(ostream& out) const {
out << "Pop()";
}
}/* CVC4 namespace */
|