mirror of
https://github.com/weechat/weechat.git
synced 2026-07-10 11:43:13 +02:00
api: add argument "options" in function string_eval_expression, add option "-c" for command /eval (to evaluate a condition)
This commit is contained in:
@@ -463,19 +463,22 @@ weechat_ruby_api_string_input_for_buffer (VALUE class, VALUE string)
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_string_eval_expression (VALUE class, VALUE expr,
|
||||
VALUE pointers, VALUE extra_vars)
|
||||
VALUE pointers, VALUE extra_vars,
|
||||
VALUE options)
|
||||
{
|
||||
char *c_expr, *result;
|
||||
struct t_hashtable *c_pointers, *c_extra_vars;
|
||||
struct t_hashtable *c_pointers, *c_extra_vars, *c_options;
|
||||
VALUE return_value;
|
||||
|
||||
API_FUNC(1, "string_eval_expression", API_RETURN_EMPTY);
|
||||
if (NIL_P (expr) || NIL_P (pointers) || NIL_P (extra_vars))
|
||||
if (NIL_P (expr) || NIL_P (pointers) || NIL_P (extra_vars)
|
||||
|| NIL_P (options))
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
Check_Type (expr, T_STRING);
|
||||
Check_Type (pointers, T_HASH);
|
||||
Check_Type (extra_vars, T_HASH);
|
||||
Check_Type (options, T_HASH);
|
||||
|
||||
c_expr = StringValuePtr (expr);
|
||||
c_pointers = weechat_ruby_hash_to_hashtable (pointers,
|
||||
@@ -486,13 +489,20 @@ weechat_ruby_api_string_eval_expression (VALUE class, VALUE expr,
|
||||
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_STRING);
|
||||
c_options = weechat_ruby_hash_to_hashtable (options,
|
||||
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_STRING);
|
||||
|
||||
result = weechat_string_eval_expression (c_expr, c_pointers, c_extra_vars);
|
||||
result = weechat_string_eval_expression (c_expr, c_pointers, c_extra_vars,
|
||||
c_options);
|
||||
|
||||
if (c_pointers)
|
||||
weechat_hashtable_free (c_pointers);
|
||||
if (c_extra_vars)
|
||||
weechat_hashtable_free (c_extra_vars);
|
||||
if (c_options)
|
||||
weechat_hashtable_free (c_options);
|
||||
|
||||
API_RETURN_STRING_FREE(result);
|
||||
}
|
||||
@@ -5945,7 +5955,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
|
||||
API_DEF_FUNC(string_remove_color, 2);
|
||||
API_DEF_FUNC(string_is_command_char, 1);
|
||||
API_DEF_FUNC(string_input_for_buffer, 1);
|
||||
API_DEF_FUNC(string_eval_expression, 3);
|
||||
API_DEF_FUNC(string_eval_expression, 4);
|
||||
API_DEF_FUNC(mkdir_home, 2);
|
||||
API_DEF_FUNC(mkdir, 2);
|
||||
API_DEF_FUNC(mkdir_parents, 2);
|
||||
|
||||
Reference in New Issue
Block a user