blob: 5e86333fd96579d91edbc3e02d7431106947931d [file] [log] [blame]
Shinichiro Hamaji5f86e1a2015-06-29 14:25:39 +09001// Copyright 2015 Google Inc. All rights reserved
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef COMMAND_H_
16#define COMMAND_H_
17
Shinichiro Hamaji5f86e1a2015-06-29 14:25:39 +090018#include <vector>
19
Shinichiro Hamajie7992752015-06-29 18:38:35 +090020#include "symtab.h"
Shinichiro Hamaji5f86e1a2015-06-29 14:25:39 +090021
22using namespace std;
23
24struct DepNode;
25class Evaluator;
26
27struct Command {
Dan Willemsen3ce083f2017-10-11 22:17:48 -070028 explicit Command(Symbol o) : output(o), echo(true), ignore_error(false) {}
Shinichiro Hamajie7992752015-06-29 18:38:35 +090029 Symbol output;
Shinichiro Hamajifb415ad2015-08-14 17:19:34 +090030 string cmd;
Shinichiro Hamaji5f86e1a2015-06-29 14:25:39 +090031 bool echo;
32 bool ignore_error;
Shinichiro Hamaji5f86e1a2015-06-29 14:25:39 +090033};
34
35class CommandEvaluator {
36 public:
37 explicit CommandEvaluator(Evaluator* ev);
38 void Eval(DepNode* n, vector<Command*>* commands);
39 const DepNode* current_dep_node() const { return current_dep_node_; }
40
41 private:
42 Evaluator* ev_;
43 DepNode* current_dep_node_;
44};
45
46#endif // COMMAND_H_