static script_return_t script_lib_math_double_from_double_function (script_state_t *state, void *user_data) { double (*function)(double) = user_data; double value = script_obj_hash_get_number (state->local, "value"); double reply_double = function (value); return script_return_obj (script_obj_new_number (reply_double)); }
void script_lib_plymouth_on_boot_progress (script_state_t *state, script_lib_plymouth_data_t *data, double duration, double progress) { script_obj_t *duration_obj = script_obj_new_number (duration); script_obj_t *progress_obj = script_obj_new_number (progress); script_return_t ret = script_execute_object (state, data->script_boot_progress_func, NULL, duration_obj, progress_obj, NULL); script_obj_unref (ret.object); script_obj_unref (duration_obj); script_obj_unref (progress_obj); }
void script_lib_plymouth_on_display_password (script_state_t *state, script_lib_plymouth_data_t *data, const char *prompt, int bullets) { script_obj_t *prompt_obj = script_obj_new_string (prompt); script_obj_t *bullets_obj = script_obj_new_number (bullets); script_return_t ret = script_execute_object (state, data->script_display_password_func, NULL, prompt_obj, bullets_obj, NULL); script_obj_unref (prompt_obj); script_obj_unref (bullets_obj); script_obj_unref (ret.object); }
static script_return_t script_lib_math_random (script_state_t *state, void *user_data) { double reply_double = random() / ((double)RAND_MAX + 1); return script_return_obj (script_obj_new_number (reply_double)); }