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 FUNC_H_
16 #define FUNC_H_
17 
18 #include <memory>
19 #include <string>
20 #include <vector>
21 
22 #include "expr.h"
23 
24 using namespace std;
25 
26 struct FuncInfo {
27   const char* name;
28   void (*func)(const vector<Value*>& args, Evaluator* ev, string* s);
29   int arity;
30   int min_arity;
31   // For all parameters.
32   bool trim_space;
33   // Only for the first parameter.
34   bool trim_right_space_1st;
35 };
36 
37 void InitFuncTable();
38 void QuitFuncTable();
39 
40 FuncInfo* GetFuncInfo(StringPiece name);
41 
42 struct FindCommand;
43 
44 struct CommandResult {
45   string cmd;
46   unique_ptr<FindCommand> find;
47   string result;
48 };
49 
50 const vector<CommandResult*>& GetShellCommandResults();
51 
52 #endif  // FUNC_H_
53