Shinichiro Hamaji | 1d545aa | 2015-06-23 15:29:13 +0900 | [diff] [blame] | 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 | |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 15 | #ifndef FUNC_H_ |
| 16 | #define FUNC_H_ |
| 17 | |
Shinichiro Hamaji | c9b0aca | 2015-07-31 16:47:56 +0900 | [diff] [blame] | 18 | #include <memory> |
| 19 | #include <string> |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 20 | #include <vector> |
| 21 | |
Shinichiro Hamaji | 645cca7 | 2015-09-24 17:04:21 +0900 | [diff] [blame] | 22 | #include "expr.h" |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 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; |
Shinichiro Hamaji | fead3b7 | 2015-06-18 15:31:15 +0900 | [diff] [blame] | 30 | int min_arity; |
| 31 | // For all parameters. |
| 32 | bool trim_space; |
| 33 | // Only for the first parameter. |
| 34 | bool trim_right_space_1st; |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | void InitFuncTable(); |
| 38 | void QuitFuncTable(); |
| 39 | |
| 40 | FuncInfo* GetFuncInfo(StringPiece name); |
| 41 | |
Shinichiro Hamaji | c9b0aca | 2015-07-31 16:47:56 +0900 | [diff] [blame] | 42 | struct FindCommand; |
| 43 | |
Shinichiro Hamaji | 4db9edc | 2015-08-13 16:43:02 +0900 | [diff] [blame] | 44 | struct CommandResult { |
Shinichiro Hamaji | c9b0aca | 2015-07-31 16:47:56 +0900 | [diff] [blame] | 45 | string cmd; |
| 46 | unique_ptr<FindCommand> find; |
| 47 | string result; |
| 48 | }; |
| 49 | |
Shinichiro Hamaji | 4db9edc | 2015-08-13 16:43:02 +0900 | [diff] [blame] | 50 | const vector<CommandResult*>& GetShellCommandResults(); |
Shinichiro Hamaji | c9b0aca | 2015-07-31 16:47:56 +0900 | [diff] [blame] | 51 | |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 52 | #endif // FUNC_H_ |