27 #define DEFINE_WFL_FUNCTION(name, min_args, max_args) \
28 class name##_function : public function_expression \
31 explicit name##_function(const args_list& args) \
32 : function_expression(#name, args, min_args, max_args) \
37 variant execute(const formula_callable& variables, formula_debugger* fdb) const; \
40 variant name##_function::execute( \
41 [[maybe_unused]] const formula_callable& variables, [[maybe_unused]] formula_debugger* fdb) const
47 #define DECLARE_WFL_FUNCTION(name) \
48 functions_table.add_function(#name, std::make_shared<builtin_formula_function<name##_function>>(#name))
60 static std::string
get();
91 virtual std::string
str()
const = 0;
111 if(min_args >= 0 &&
args_.size() <
static_cast<std::size_t
>(min_args)) {
115 if(max_args >= 0 &&
args_.size() >
static_cast<std::size_t
>(max_args)) {
120 virtual std::string
str()
const;
159 const std::vector<std::string>& arg_names);
198 const std::vector<std::string>& args)
225 return std::make_shared<T>(args);
248 static std::shared_ptr<function_symbol_table>
get_builtins();
251 std::shared_ptr<function_symbol_table>
parent;
284 virtual std::string
str()
const
297 return arg_->evaluate(variables, fdb);
Class that manages AIs for all sides and manages AI redeployment.
action_function_symbol_table(std::shared_ptr< function_symbol_table > parent=nullptr)
const args_list & args() const
virtual std::string str() const
std::vector< expression_ptr > args_list
function_expression(const std::string &name, const args_list &args, int min_args=-1, int max_args=-1)
static std::shared_ptr< function_symbol_table > get_builtins()
expression_ptr create_function(const std::string &fn, const std::vector< expression_ptr > &args) const
void add_function(const std::string &name, formula_function_ptr &&fcn)
std::set< std::string > get_function_names() const
std::shared_ptr< function_symbol_table > parent
function_symbol_table(builtins_tag_t)
functions_map custom_formulas_
function_symbol_table(std::shared_ptr< function_symbol_table > parent=nullptr)
key_value_pair(const variant &key, const variant &value)
void serialize_to_string(std::string &str) const override
variant get_value(const std::string &key) const override
void get_inputs(formula_input_vector &inputs) const override
std::vector< formula_input > formula_input_vector
std::shared_ptr< const formula > const_formula_ptr
std::shared_ptr< formula_expression > expression_ptr
std::map< std::string, formula_function_ptr > functions_map
variant evaluate_arg_callback(formula_debugger &fdb, const formula_expression &expression, const formula_callable &variables)
std::shared_ptr< function_expression > function_expression_ptr
std::shared_ptr< formula_function > formula_function_ptr
Provides debugging information for error messages.
call_stack_manager(const std::string &str)
call_stack_manager & operator=(const call_stack_manager &)=delete
call_stack_manager(const call_stack_manager &)=delete