Home | History | Annotate | Download | only in kati
      1 // 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 
     18 #include <vector>
     19 
     20 #include "symtab.h"
     21 
     22 using namespace std;
     23 
     24 struct DepNode;
     25 class Evaluator;
     26 
     27 struct Command {
     28   explicit Command(Symbol o)
     29       : output(o), echo(true), ignore_error(false) {
     30   }
     31   Symbol output;
     32   string cmd;
     33   bool echo;
     34   bool ignore_error;
     35 };
     36 
     37 class CommandEvaluator {
     38  public:
     39   explicit CommandEvaluator(Evaluator* ev);
     40   void Eval(DepNode* n, vector<Command*>* commands);
     41   const DepNode* current_dep_node() const { return current_dep_node_; }
     42 
     43  private:
     44   Evaluator* ev_;
     45   DepNode* current_dep_node_;
     46 };
     47 
     48 #endif  // COMMAND_H_
     49