diff --git a/.github/workflows/generate_pkg.yml b/.github/workflows/generate_pkg.yml index 0a770b7..e6b8cd4 100644 --- a/.github/workflows/generate_pkg.yml +++ b/.github/workflows/generate_pkg.yml @@ -15,6 +15,22 @@ jobs: - uses: dtolnay/rust-toolchain@nightly + - name: check wrapper file generation + run: | + cargo run --manifest-path ./savvy-cli/Cargo.toml -- update ./R-package/ + + # If there's any change, exit with non-zero status + # (the code is derived from https://stackoverflow.com/a/3879077) + git add ./R-package/ + git update-index --refresh + if ! git diff-index --quiet HEAD -- ./R-package/; then + echo + echo "some change on wrapper file generation was detected!" + echo + git diff ./R-package/ + exit 1 + fi + - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b69bd6..0185c7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ ## [Unreleased] (ReleaseDate) +### New features + +* savvy CLI can handle function definitions with `#[cfg()]` switch (See [#333](https://github.com/yutannihilation/savvy/issues/333) + for more details). + ## [v0.8.2] (2024-12-25) ### New features diff --git a/Cargo.toml b/Cargo.toml index 14ea7df..1d880e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +13,8 @@ exclude = ["/book", "/R-package", "README.qmd"] rust-version = "1.65.0" [dependencies] -savvy-ffi = { version = "0.8.2", path = "./savvy-ffi" } -savvy-macro = { version = "0.8.2", path = "./savvy-macro" } +savvy-ffi = { version = "0.8.3-rc.4", path = "./savvy-ffi" } +savvy-macro = { version = "0.8.3-rc.4", path = "./savvy-macro" } once_cell = "1" num-complex = { version = "0.4.5", optional = true } @@ -69,7 +69,7 @@ members = ["savvy-macro", "savvy-bindgen", "savvy-cli", "savvy-ffi", "xtask"] resolver = "2" [workspace.package] -version = "0.8.2" +version = "0.8.3-rc.4" edition = "2021" authors = ["Hiroaki Yutani"] license = "MIT" diff --git a/R-package/R/000-wrappers.R b/R-package/R/000-wrappers.R index 7bc8446..412c359 100644 --- a/R-package/R/000-wrappers.R +++ b/R-package/R/000-wrappers.R @@ -38,17 +38,8 @@ NULL } -`is_built_with_debug` <- function() { - .Call(savvy_is_built_with_debug__impl) -} - -#' Convert Input To Upper-Case -#' -#' @param x A character vector. -#' @returns A character vector with upper case version of the input. -#' @export -`to_upper` <- function(`x`) { - .Call(savvy_to_upper__impl, `x`) +`abs_complex` <- function(`x`) { + .Call(savvy_abs_complex__impl, `x`) } #' Add suffix @@ -61,231 +52,181 @@ NULL .Call(savvy_add_suffix__impl, `x`, `y`) } -#' Multiply Input By Two -#' -#' @param x An integer vector. -#' @returns An integer vector with values multiplied by 2. -#' @export -`times_two_int` <- function(`x`) { - .Call(savvy_times_two_int__impl, `x`) -} -#' Multiply Input By Another Input -#' -#' @param x An integer vector. -#' @param y An integer to multiply. -#' @returns An integer vector with values multiplied by `y`. -#' @export -`times_any_int` <- function(`x`, `y`) { - .Call(savvy_times_any_int__impl, `x`, `y`) +`altint` <- function() { + .Call(savvy_altint__impl) } -#' Multiply Input By Two -#' -#' @param x A numeric vector. -#' @returns A numeric vector with values multiplied by 2. -#' @export -`times_two_real` <- function(`x`) { - .Call(savvy_times_two_real__impl, `x`) -} -#' Multiply Input By Another Input -#' -#' @param x A real vector. -#' @param y A real to multiply. -#' @returns A real vector with values multiplied by `y`. -#' @export -`times_any_real` <- function(`x`, `y`) { - .Call(savvy_times_any_real__impl, `x`, `y`) +`altlist` <- function() { + .Call(savvy_altlist__impl) } -#' Flip Input -#' -#' @param x A logical vector. -#' @returns A logical vector with filled values (`NA` is converted to `TRUE`). -#' @export -`flip_logical` <- function(`x`) { - .Call(savvy_flip_logical__impl, `x`) + +`altlogical` <- function() { + .Call(savvy_altlogical__impl) } -`flip_logical_expert_only` <- function(`x`) { - .Call(savvy_flip_logical_expert_only__impl, `x`) +`altraw` <- function() { + .Call(savvy_altraw__impl) } -#' Or operation -#' -#' @param x A logical vector. -#' @param y A logical value. -#' @returns A logical vector with filled values (`NA` is converted to `TRUE`). -#' @export -`or_logical` <- function(`x`, `y`) { - .Call(savvy_or_logical__impl, `x`, `y`) -} -#' Reverse bits -#' -#' @param x A raw vector. -`reverse_bits` <- function(`x`) { - .Call(savvy_reverse_bits__impl, `x`) +`altreal` <- function() { + .Call(savvy_altreal__impl) } -#' Reverse bits -#' -#' @param x A raw vector. -`reverse_bit_scalar` <- function(`x`) { - .Call(savvy_reverse_bit_scalar__impl, `x`) -} -#' Print the content of list -#' -#' @param x A list vector. -#' @returns `NULL` -#' @export -`print_list` <- function(`x`) { - invisible(.Call(savvy_print_list__impl, `x`)) +`altstring` <- function() { + .Call(savvy_altstring__impl) } -`list_with_no_values` <- function() { - .Call(savvy_list_with_no_values__impl) +`call_with_args` <- function(`fun`) { + .Call(savvy_call_with_args__impl, `fun`) } -`list_with_no_names` <- function() { - .Call(savvy_list_with_no_names__impl) +`default_value_enum` <- function(`x` = NULL) { + `x` <- .savvy_extract_ptr(`x`, "FooEnum") + .Call(savvy_default_value_enum__impl, `x`) } -`list_with_names_and_values` <- function() { - .Call(savvy_list_with_names_and_values__impl) +`default_value_scalar` <- function(`x` = NULL) { + .Call(savvy_default_value_scalar__impl, `x`) } -`external_person_new` <- function() { - .savvy_wrap_Person(.Call(savvy_external_person_new__impl)) +`default_value_struct` <- function(`x` = NULL) { + `x` <- .savvy_extract_ptr(`x`, "FooWithDefault") + .Call(savvy_default_value_struct__impl, `x`) } -`get_name_external` <- function(`x`) { - `x` <- .savvy_extract_ptr(`x`, "Person") - .Call(savvy_get_name_external__impl, `x`) +`default_value_vec` <- function(`x` = NULL) { + .Call(savvy_default_value_vec__impl, `x`) } -`set_name_external` <- function(`x`, `name`) { - `x` <- .savvy_extract_ptr(`x`, "Person") - invisible(.Call(savvy_set_name_external__impl, `x`, `name`)) +`do_call` <- function(`fun`, `args`) { + .Call(savvy_do_call__impl, `fun`, `args`) } -`altint` <- function() { - .Call(savvy_altint__impl) +`error_conversion` <- function() { + invisible(.Call(savvy_error_conversion__impl)) } -`print_altint` <- function(`x`) { - invisible(.Call(savvy_print_altint__impl, `x`)) +`external_person_new` <- function() { + .savvy_wrap_Person(.Call(savvy_external_person_new__impl)) } -`tweak_altint` <- function(`x`) { - invisible(.Call(savvy_tweak_altint__impl, `x`)) +`filter_complex_without_im` <- function(`x`) { + .Call(savvy_filter_complex_without_im__impl, `x`) } -`altreal` <- function() { - .Call(savvy_altreal__impl) +`filter_integer_odd` <- function(`x`) { + .Call(savvy_filter_integer_odd__impl, `x`) } -`print_altreal` <- function(`x`) { - invisible(.Call(savvy_print_altreal__impl, `x`)) +`filter_logical_duplicates` <- function(`x`) { + .Call(savvy_filter_logical_duplicates__impl, `x`) } -`tweak_altreal` <- function(`x`) { - invisible(.Call(savvy_tweak_altreal__impl, `x`)) +`filter_real_negative` <- function(`x`) { + .Call(savvy_filter_real_negative__impl, `x`) } -`altlogical` <- function() { - .Call(savvy_altlogical__impl) +`filter_string_ascii` <- function(`x`) { + .Call(savvy_filter_string_ascii__impl, `x`) } -`print_altlogical` <- function(`x`) { - invisible(.Call(savvy_print_altlogical__impl, `x`)) +`first_complex` <- function(`x`) { + .Call(savvy_first_complex__impl, `x`) } - -`tweak_altlogical` <- function(`x`) { - invisible(.Call(savvy_tweak_altlogical__impl, `x`)) +#' Flip Input +#' +#' @param x A logical vector. +#' @returns A logical vector with filled values (`NA` is converted to `TRUE`). +#' @export +`flip_logical` <- function(`x`) { + .Call(savvy_flip_logical__impl, `x`) } -`altraw` <- function() { - .Call(savvy_altraw__impl) +`flip_logical_expert_only` <- function(`x`) { + .Call(savvy_flip_logical_expert_only__impl, `x`) } -`print_altraw` <- function(`x`) { - invisible(.Call(savvy_print_altraw__impl, `x`)) +`fn_w_cfg` <- function(`x`) { + invisible(.Call(savvy_fn_w_cfg__impl, `x`)) } -`tweak_altraw` <- function(`x`) { - invisible(.Call(savvy_tweak_altraw__impl, `x`)) +`foo_a` <- function() { + .savvy_wrap_FooEnum(.Call(savvy_foo_a__impl)) } -`altstring` <- function() { - .Call(savvy_altstring__impl) +`fun_mod1` <- function() { + invisible(.Call(savvy_fun_mod1__impl)) } -`print_altstring` <- function(`x`) { - invisible(.Call(savvy_print_altstring__impl, `x`)) +`fun_mod1_1_foo` <- function() { + invisible(.Call(savvy_fun_mod1_1_foo__impl)) } -`tweak_altstring` <- function(`x`) { - invisible(.Call(savvy_tweak_altstring__impl, `x`)) +`get_altrep_class_name` <- function(`x`) { + invisible(.Call(savvy_get_altrep_class_name__impl, `x`)) } -`altlist` <- function() { - .Call(savvy_altlist__impl) +`get_altrep_package_name` <- function(`x`) { + invisible(.Call(savvy_get_altrep_package_name__impl, `x`)) } -`print_altlist` <- function(`x`) { - invisible(.Call(savvy_print_altlist__impl, `x`)) +`get_args` <- function(`args`) { + .Call(savvy_get_args__impl, `args`) } -`tweak_altlist` <- function(`x`) { - invisible(.Call(savvy_tweak_altlist__impl, `x`)) +`get_attr_int` <- function(`x`, `attr`) { + .Call(savvy_get_attr_int__impl, `x`, `attr`) } -`get_altrep_class_name` <- function(`x`) { - invisible(.Call(savvy_get_altrep_class_name__impl, `x`)) +`get_class_int` <- function(`x`) { + .Call(savvy_get_class_int__impl, `x`) } -`get_altrep_package_name` <- function(`x`) { - invisible(.Call(savvy_get_altrep_package_name__impl, `x`)) +`get_dim_int` <- function(`x`) { + .Call(savvy_get_dim_int__impl, `x`) } -`print_altint_by_weird_way` <- function(`x`) { - invisible(.Call(savvy_print_altint_by_weird_way__impl, `x`)) +`get_foo_value` <- function() { + .Call(savvy_get_foo_value__impl) } -`get_class_int` <- function(`x`) { - .Call(savvy_get_class_int__impl, `x`) +`get_name_external` <- function(`x`) { + `x` <- .savvy_extract_ptr(`x`, "Person") + .Call(savvy_get_name_external__impl, `x`) } @@ -294,33 +235,38 @@ NULL } -`get_dim_int` <- function(`x`) { - .Call(savvy_get_dim_int__impl, `x`) +`get_var_in_env` <- function(`name`, `env` = NULL) { + .Call(savvy_get_var_in_env__impl, `name`, `env`) } -`get_attr_int` <- function(`x`, `attr`) { - .Call(savvy_get_attr_int__impl, `x`, `attr`) +`is_built_with_debug` <- function() { + .Call(savvy_is_built_with_debug__impl) } -`set_class_int` <- function() { - .Call(savvy_set_class_int__impl) +`list_with_names_and_values` <- function() { + .Call(savvy_list_with_names_and_values__impl) } -`set_names_int` <- function() { - .Call(savvy_set_names_int__impl) +`list_with_no_names` <- function() { + .Call(savvy_list_with_no_names__impl) } -`set_dim_int` <- function() { - .Call(savvy_set_dim_int__impl) +`list_with_no_values` <- function() { + .Call(savvy_list_with_no_values__impl) } -`set_attr_int` <- function(`attr`, `value`) { - .Call(savvy_set_attr_int__impl, `attr`, `value`) +`must_panic` <- function() { + invisible(.Call(savvy_must_panic__impl)) +} + + +`new_bool` <- function(`size`) { + .Call(savvy_new_bool__impl, `size`) } @@ -329,13 +275,13 @@ NULL } -`first_complex` <- function(`x`) { - .Call(savvy_first_complex__impl, `x`) +`new_int` <- function(`size`) { + .Call(savvy_new_int__impl, `size`) } -`abs_complex` <- function(`x`) { - .Call(savvy_abs_complex__impl, `x`) +`new_real` <- function(`size`) { + .Call(savvy_new_real__impl, `size`) } @@ -345,84 +291,100 @@ NULL .savvy_wrap_ValuePair(.Call(savvy_new_value_pair__impl, `a`, `b`)) } - -`scalar_input_int` <- function(`x`) { - invisible(.Call(savvy_scalar_input_int__impl, `x`)) +#' Or operation +#' +#' @param x A logical vector. +#' @param y A logical value. +#' @returns A logical vector with filled values (`NA` is converted to `TRUE`). +#' @export +`or_logical` <- function(`x`, `y`) { + .Call(savvy_or_logical__impl, `x`, `y`) } -`scalar_input_real` <- function(`x`) { - invisible(.Call(savvy_scalar_input_real__impl, `x`)) +`print_altint` <- function(`x`) { + invisible(.Call(savvy_print_altint__impl, `x`)) } -`scalar_input_logical` <- function(`x`) { - invisible(.Call(savvy_scalar_input_logical__impl, `x`)) +`print_altint_by_weird_way` <- function(`x`) { + invisible(.Call(savvy_print_altint_by_weird_way__impl, `x`)) } -`scalar_input_string` <- function(`x`) { - invisible(.Call(savvy_scalar_input_string__impl, `x`)) +`print_altlist` <- function(`x`) { + invisible(.Call(savvy_print_altlist__impl, `x`)) } -`scalar_output_int` <- function() { - .Call(savvy_scalar_output_int__impl) +`print_altlogical` <- function(`x`) { + invisible(.Call(savvy_print_altlogical__impl, `x`)) } -`scalar_output_int2` <- function() { - .Call(savvy_scalar_output_int2__impl) +`print_altraw` <- function(`x`) { + invisible(.Call(savvy_print_altraw__impl, `x`)) } -`scalar_output_real` <- function() { - .Call(savvy_scalar_output_real__impl) +`print_altreal` <- function(`x`) { + invisible(.Call(savvy_print_altreal__impl, `x`)) } -`scalar_output_real2` <- function() { - .Call(savvy_scalar_output_real2__impl) +`print_altstring` <- function(`x`) { + invisible(.Call(savvy_print_altstring__impl, `x`)) } -`scalar_output_logical` <- function() { - .Call(savvy_scalar_output_logical__impl) +`print_foo_enum` <- function(`x`) { + `x` <- .savvy_extract_ptr(`x`, "FooEnum") + invisible(.Call(savvy_print_foo_enum__impl, `x`)) } -`scalar_output_logical2` <- function() { - .Call(savvy_scalar_output_logical2__impl) +`print_foo_enum_ref` <- function(`x`) { + `x` <- .savvy_extract_ptr(`x`, "FooEnum") + invisible(.Call(savvy_print_foo_enum_ref__impl, `x`)) } +#' Print the content of list +#' +#' @param x A list vector. +#' @returns `NULL` +#' @export +`print_list` <- function(`x`) { + invisible(.Call(savvy_print_list__impl, `x`)) +} -`scalar_output_string` <- function() { - .Call(savvy_scalar_output_string__impl) + +`print_numeric` <- function(`x`) { + invisible(.Call(savvy_print_numeric__impl, `x`)) } -`scalar_output_string2` <- function() { - .Call(savvy_scalar_output_string2__impl) +`fn` <- function(`struct`) { + invisible(.Call(savvy_fn__impl, `struct`)) } -`scalar_output_complex` <- function() { - .Call(savvy_scalar_output_complex__impl) +`raise_error` <- function() { + .Call(savvy_raise_error__impl) } -`scalar_output_complex2` <- function() { - .Call(savvy_scalar_output_complex2__impl) +`rep_bool_slice` <- function(`x`) { + .Call(savvy_rep_bool_slice__impl, `x`) } -`sum_int` <- function(`x`) { - .Call(savvy_sum_int__impl, `x`) +`rep_bool_vec` <- function(`x`) { + .Call(savvy_rep_bool_vec__impl, `x`) } -`sum_real` <- function(`x`) { - .Call(savvy_sum_real__impl, `x`) +`rep_int_slice` <- function(`x`) { + .Call(savvy_rep_int_slice__impl, `x`) } @@ -431,8 +393,8 @@ NULL } -`rep_int_slice` <- function(`x`) { - .Call(savvy_rep_int_slice__impl, `x`) +`rep_real_slice` <- function(`x`) { + .Call(savvy_rep_real_slice__impl, `x`) } @@ -441,217 +403,260 @@ NULL } -`rep_real_slice` <- function(`x`) { - .Call(savvy_rep_real_slice__impl, `x`) +`rep_str_slice` <- function(`x`) { + .Call(savvy_rep_str_slice__impl, `x`) } -`rep_bool_vec` <- function(`x`) { - .Call(savvy_rep_bool_vec__impl, `x`) +`rep_str_vec` <- function(`x`) { + .Call(savvy_rep_str_vec__impl, `x`) } +#' Reverse bits +#' +#' @param x A raw vector. +`reverse_bit_scalar` <- function(`x`) { + .Call(savvy_reverse_bit_scalar__impl, `x`) +} -`rep_bool_slice` <- function(`x`) { - .Call(savvy_rep_bool_slice__impl, `x`) +#' Reverse bits +#' +#' @param x A raw vector. +`reverse_bits` <- function(`x`) { + .Call(savvy_reverse_bits__impl, `x`) } -`rep_str_vec` <- function(`x`) { - .Call(savvy_rep_str_vec__impl, `x`) +`safe_stop` <- function() { + invisible(.Call(savvy_safe_stop__impl)) } -`rep_str_slice` <- function(`x`) { - .Call(savvy_rep_str_slice__impl, `x`) +`safe_warn` <- function() { + invisible(.Call(savvy_safe_warn__impl)) } -`print_foo_enum` <- function(`x`) { - `x` <- .savvy_extract_ptr(`x`, "FooEnum") - invisible(.Call(savvy_print_foo_enum__impl, `x`)) +`scalar_input_int` <- function(`x`) { + invisible(.Call(savvy_scalar_input_int__impl, `x`)) } -`print_foo_enum_ref` <- function(`x`) { - `x` <- .savvy_extract_ptr(`x`, "FooEnum") - invisible(.Call(savvy_print_foo_enum_ref__impl, `x`)) +`scalar_input_logical` <- function(`x`) { + invisible(.Call(savvy_scalar_input_logical__impl, `x`)) } -`foo_a` <- function() { - .savvy_wrap_FooEnum(.Call(savvy_foo_a__impl)) +`scalar_input_real` <- function(`x`) { + invisible(.Call(savvy_scalar_input_real__impl, `x`)) } -`get_var_in_env` <- function(`name`, `env` = NULL) { - .Call(savvy_get_var_in_env__impl, `name`, `env`) +`scalar_input_string` <- function(`x`) { + invisible(.Call(savvy_scalar_input_string__impl, `x`)) } -`var_exists_in_env` <- function(`name`, `env` = NULL) { - .Call(savvy_var_exists_in_env__impl, `name`, `env`) +`scalar_output_complex` <- function() { + .Call(savvy_scalar_output_complex__impl) } -`set_var_in_env` <- function(`name`, `value`, `env` = NULL) { - invisible(.Call(savvy_set_var_in_env__impl, `name`, `value`, `env`)) +`scalar_output_complex2` <- function() { + .Call(savvy_scalar_output_complex2__impl) } -`get_foo_value` <- function() { - .Call(savvy_get_foo_value__impl) +`scalar_output_int` <- function() { + .Call(savvy_scalar_output_int__impl) } -`safe_stop` <- function() { - invisible(.Call(savvy_safe_stop__impl)) +`scalar_output_int2` <- function() { + .Call(savvy_scalar_output_int2__impl) } -`raise_error` <- function() { - .Call(savvy_raise_error__impl) +`scalar_output_logical` <- function() { + .Call(savvy_scalar_output_logical__impl) } -`must_panic` <- function() { - invisible(.Call(savvy_must_panic__impl)) +`scalar_output_logical2` <- function() { + .Call(savvy_scalar_output_logical2__impl) } -`safe_warn` <- function() { - invisible(.Call(savvy_safe_warn__impl)) +`scalar_output_real` <- function() { + .Call(savvy_scalar_output_real__impl) } -`error_conversion` <- function() { - invisible(.Call(savvy_error_conversion__impl)) +`scalar_output_real2` <- function() { + .Call(savvy_scalar_output_real2__impl) } -`do_call` <- function(`fun`, `args`) { - .Call(savvy_do_call__impl, `fun`, `args`) +`scalar_output_string` <- function() { + .Call(savvy_scalar_output_string__impl) } -`call_with_args` <- function(`fun`) { - .Call(savvy_call_with_args__impl, `fun`) +`scalar_output_string2` <- function() { + .Call(savvy_scalar_output_string2__impl) } -`get_args` <- function(`args`) { - .Call(savvy_get_args__impl, `args`) +`set_attr_int` <- function(`attr`, `value`) { + .Call(savvy_set_attr_int__impl, `attr`, `value`) } -`new_int` <- function(`size`) { - .Call(savvy_new_int__impl, `size`) +`set_class_int` <- function() { + .Call(savvy_set_class_int__impl) } -`new_real` <- function(`size`) { - .Call(savvy_new_real__impl, `size`) +`set_dim_int` <- function() { + .Call(savvy_set_dim_int__impl) } -`new_bool` <- function(`size`) { - .Call(savvy_new_bool__impl, `size`) +`set_name_external` <- function(`x`, `name`) { + `x` <- .savvy_extract_ptr(`x`, "Person") + invisible(.Call(savvy_set_name_external__impl, `x`, `name`)) } -`times_two_numeric_f64` <- function(`x`) { - .Call(savvy_times_two_numeric_f64__impl, `x`) +`set_names_int` <- function() { + .Call(savvy_set_names_int__impl) } -`times_two_numeric_i32` <- function(`x`) { - .Call(savvy_times_two_numeric_i32__impl, `x`) +`set_var_in_env` <- function(`name`, `value`, `env` = NULL) { + invisible(.Call(savvy_set_var_in_env__impl, `name`, `value`, `env`)) } -`usize_to_string` <- function(`x`) { - .Call(savvy_usize_to_string__impl, `x`) +`sum_int` <- function(`x`) { + .Call(savvy_sum_int__impl, `x`) } -`times_two_numeric_f64_scalar` <- function(`x`) { - .Call(savvy_times_two_numeric_f64_scalar__impl, `x`) +`sum_real` <- function(`x`) { + .Call(savvy_sum_real__impl, `x`) } +#' Multiply Input By Another Input +#' +#' @param x An integer vector. +#' @param y An integer to multiply. +#' @returns An integer vector with values multiplied by `y`. +#' @export +`times_any_int` <- function(`x`, `y`) { + .Call(savvy_times_any_int__impl, `x`, `y`) +} -`times_two_numeric_i32_scalar` <- function(`x`) { - .Call(savvy_times_two_numeric_i32_scalar__impl, `x`) +#' Multiply Input By Another Input +#' +#' @param x A real vector. +#' @param y A real to multiply. +#' @returns A real vector with values multiplied by `y`. +#' @export +`times_any_real` <- function(`x`, `y`) { + .Call(savvy_times_any_real__impl, `x`, `y`) +} + +#' Multiply Input By Two +#' +#' @param x An integer vector. +#' @returns An integer vector with values multiplied by 2. +#' @export +`times_two_int` <- function(`x`) { + .Call(savvy_times_two_int__impl, `x`) } -`usize_to_string_scalar` <- function(`x`) { - .Call(savvy_usize_to_string_scalar__impl, `x`) +`times_two_numeric_f64` <- function(`x`) { + .Call(savvy_times_two_numeric_f64__impl, `x`) } -`print_numeric` <- function(`x`) { - invisible(.Call(savvy_print_numeric__impl, `x`)) +`times_two_numeric_f64_scalar` <- function(`x`) { + .Call(savvy_times_two_numeric_f64_scalar__impl, `x`) } -`default_value_scalar` <- function(`x` = NULL) { - .Call(savvy_default_value_scalar__impl, `x`) +`times_two_numeric_i32` <- function(`x`) { + .Call(savvy_times_two_numeric_i32__impl, `x`) } -`default_value_vec` <- function(`x` = NULL) { - .Call(savvy_default_value_vec__impl, `x`) +`times_two_numeric_i32_scalar` <- function(`x`) { + .Call(savvy_times_two_numeric_i32_scalar__impl, `x`) } +#' Multiply Input By Two +#' +#' @param x A numeric vector. +#' @returns A numeric vector with values multiplied by 2. +#' @export +`times_two_real` <- function(`x`) { + .Call(savvy_times_two_real__impl, `x`) +} -`default_value_struct` <- function(`x` = NULL) { - `x` <- .savvy_extract_ptr(`x`, "FooWithDefault") - .Call(savvy_default_value_struct__impl, `x`) +#' Convert Input To Upper-Case +#' +#' @param x A character vector. +#' @returns A character vector with upper case version of the input. +#' @export +`to_upper` <- function(`x`) { + .Call(savvy_to_upper__impl, `x`) } -`default_value_enum` <- function(`x` = NULL) { - `x` <- .savvy_extract_ptr(`x`, "FooEnum") - .Call(savvy_default_value_enum__impl, `x`) +`tweak_altint` <- function(`x`) { + invisible(.Call(savvy_tweak_altint__impl, `x`)) } -`filter_integer_odd` <- function(`x`) { - .Call(savvy_filter_integer_odd__impl, `x`) +`tweak_altlist` <- function(`x`) { + invisible(.Call(savvy_tweak_altlist__impl, `x`)) } -`filter_real_negative` <- function(`x`) { - .Call(savvy_filter_real_negative__impl, `x`) +`tweak_altlogical` <- function(`x`) { + invisible(.Call(savvy_tweak_altlogical__impl, `x`)) } -`filter_complex_without_im` <- function(`x`) { - .Call(savvy_filter_complex_without_im__impl, `x`) +`tweak_altraw` <- function(`x`) { + invisible(.Call(savvy_tweak_altraw__impl, `x`)) } -`filter_logical_duplicates` <- function(`x`) { - .Call(savvy_filter_logical_duplicates__impl, `x`) +`tweak_altreal` <- function(`x`) { + invisible(.Call(savvy_tweak_altreal__impl, `x`)) } -`filter_string_ascii` <- function(`x`) { - .Call(savvy_filter_string_ascii__impl, `x`) +`tweak_altstring` <- function(`x`) { + invisible(.Call(savvy_tweak_altstring__impl, `x`)) } -`fn` <- function(`struct`) { - invisible(.Call(savvy_fn__impl, `struct`)) +`usize_to_string` <- function(`x`) { + .Call(savvy_usize_to_string__impl, `x`) } -`fun_mod1` <- function() { - invisible(.Call(savvy_fun_mod1__impl)) +`usize_to_string_scalar` <- function(`x`) { + .Call(savvy_usize_to_string_scalar__impl, `x`) } -`fun_mod1_1_foo` <- function() { - invisible(.Call(savvy_fun_mod1_1_foo__impl)) +`var_exists_in_env` <- function(`name`, `env` = NULL) { + .Call(savvy_var_exists_in_env__impl, `name`, `env`) } ### wrapper functions for Enum @@ -807,14 +812,14 @@ class(`FooEnum`) <- c("FooEnum__bundle", "savvy_savvyExamples__sealed") ### associated functions for FooWithDefault -`FooWithDefault`$`new` <- function(`default_value`) { - .savvy_wrap_FooWithDefault(.Call(savvy_FooWithDefault_new__impl, `default_value`)) -} - `FooWithDefault`$`default_value_associated_fn` <- function(`x` = NULL) { .Call(savvy_FooWithDefault_default_value_associated_fn__impl, `x`) } +`FooWithDefault`$`new` <- function(`default_value`) { + .savvy_wrap_FooWithDefault(.Call(savvy_FooWithDefault_new__impl, `default_value`)) +} + class(`FooWithDefault`) <- c("FooWithDefault__bundle", "savvy_savvyExamples__sealed") @@ -831,24 +836,24 @@ class(`FooWithDefault`) <- c("FooWithDefault__bundle", "savvy_savvyExamples__sea } } -`Person_set_name` <- function(self) { - function(`name`) { - invisible(.Call(savvy_Person_set_name__impl, `self`, `name`)) - } -} - `Person_name` <- function(self) { function() { .Call(savvy_Person_name__impl, `self`) } } +`Person_set_name` <- function(self) { + function(`name`) { + invisible(.Call(savvy_Person_set_name__impl, `self`, `name`)) + } +} + `.savvy_wrap_Person` <- function(ptr) { e <- new.env(parent = emptyenv()) e$.ptr <- ptr e$`another_person` <- `Person_another_person`(ptr) - e$`set_name` <- `Person_set_name`(ptr) e$`name` <- `Person_name`(ptr) + e$`set_name` <- `Person_set_name`(ptr) class(e) <- c("Person", "savvy_savvyExamples__sealed") e @@ -862,6 +867,10 @@ class(`FooWithDefault`) <- c("FooWithDefault__bundle", "savvy_savvyExamples__sea ### associated functions for Person +`Person`$`associated_function` <- function() { + .Call(savvy_Person_associated_function__impl) +} + `Person`$`new` <- function() { .savvy_wrap_Person(.Call(savvy_Person_new__impl)) } @@ -878,10 +887,6 @@ class(`FooWithDefault`) <- c("FooWithDefault__bundle", "savvy_savvyExamples__sea .savvy_wrap_Person(.Call(savvy_Person_new_with_name__impl, `name`)) } -`Person`$`associated_function` <- function() { - .Call(savvy_Person_associated_function__impl) -} - class(`Person`) <- c("Person__bundle", "savvy_savvyExamples__sealed") @@ -922,15 +927,43 @@ class(`Person2`) <- c("Person2__bundle", "savvy_savvyExamples__sealed") cat('Person2') } -### wrapper functions for Value +### wrapper functions for StructWithConfig -`Value_pair` <- function(self) { - function(`b`) { - `b` <- .savvy_extract_ptr(`b`, "Value") - .savvy_wrap_ValuePair(.Call(savvy_Value_pair__impl, `self`, `b`)) +`StructWithConfig_new_method` <- function(self) { + function(`x`) { + .savvy_wrap_StructWithConfig(.Call(savvy_StructWithConfig_new_method__impl, `self`, `x`)) } } +`.savvy_wrap_StructWithConfig` <- function(ptr) { + e <- new.env(parent = emptyenv()) + e$.ptr <- ptr + e$`new_method` <- `StructWithConfig_new_method`(ptr) + + class(e) <- c("StructWithConfig", "savvy_savvyExamples__sealed") + e +} + + + +`StructWithConfig` <- new.env(parent = emptyenv()) + +### associated functions for StructWithConfig + +`StructWithConfig`$`new_associated_fn` <- function(`x`) { + .savvy_wrap_StructWithConfig(.Call(savvy_StructWithConfig_new_associated_fn__impl, `x`)) +} + + +class(`StructWithConfig`) <- c("StructWithConfig__bundle", "savvy_savvyExamples__sealed") + +#' @export +`print.StructWithConfig__bundle` <- function(x, ...) { + cat('StructWithConfig') +} + +### wrapper functions for Value + `Value_get` <- function(self) { function() { .Call(savvy_Value_get__impl, `self`) @@ -943,12 +976,19 @@ class(`Person2`) <- c("Person2__bundle", "savvy_savvyExamples__sealed") } } +`Value_pair` <- function(self) { + function(`b`) { + `b` <- .savvy_extract_ptr(`b`, "Value") + .savvy_wrap_ValuePair(.Call(savvy_Value_pair__impl, `self`, `b`)) + } +} + `.savvy_wrap_Value` <- function(ptr) { e <- new.env(parent = emptyenv()) e$.ptr <- ptr - e$`pair` <- `Value_pair`(ptr) e$`get` <- `Value_get`(ptr) e$`get2` <- `Value_get2`(ptr) + e$`pair` <- `Value_pair`(ptr) class(e) <- c("Value", "savvy_savvyExamples__sealed") e @@ -1033,14 +1073,14 @@ class(`ValuePair`) <- c("ValuePair__bundle", "savvy_savvyExamples__sealed") ### associated functions for struct -`struct`$`new` <- function() { - .savvy_wrap_struct(.Call(savvy_struct_new__impl)) -} - `struct`$`fn` <- function(`fn`) { invisible(.Call(savvy_struct_fn__impl, `fn`)) } +`struct`$`new` <- function() { + .savvy_wrap_struct(.Call(savvy_struct_new__impl)) +} + class(`struct`) <- c("struct__bundle", "savvy_savvyExamples__sealed") diff --git a/R-package/src/init.c b/R-package/src/init.c index ab78352..3b832d4 100644 --- a/R-package/src/init.c +++ b/R-package/src/init.c @@ -34,13 +34,8 @@ SEXP handle_result(SEXP res_) { return (SEXP)res; } -SEXP savvy_is_built_with_debug__impl(void) { - SEXP res = savvy_is_built_with_debug__ffi(); - return handle_result(res); -} - -SEXP savvy_to_upper__impl(SEXP c_arg__x) { - SEXP res = savvy_to_upper__ffi(c_arg__x); +SEXP savvy_abs_complex__impl(SEXP c_arg__x) { + SEXP res = savvy_abs_complex__ffi(c_arg__x); return handle_result(res); } @@ -49,68 +44,68 @@ SEXP savvy_add_suffix__impl(SEXP c_arg__x, SEXP c_arg__y) { return handle_result(res); } -SEXP savvy_times_two_int__impl(SEXP c_arg__x) { - SEXP res = savvy_times_two_int__ffi(c_arg__x); +SEXP savvy_altint__impl(void) { + SEXP res = savvy_altint__ffi(); return handle_result(res); } -SEXP savvy_times_any_int__impl(SEXP c_arg__x, SEXP c_arg__y) { - SEXP res = savvy_times_any_int__ffi(c_arg__x, c_arg__y); +SEXP savvy_altlist__impl(void) { + SEXP res = savvy_altlist__ffi(); return handle_result(res); } -SEXP savvy_times_two_real__impl(SEXP c_arg__x) { - SEXP res = savvy_times_two_real__ffi(c_arg__x); +SEXP savvy_altlogical__impl(void) { + SEXP res = savvy_altlogical__ffi(); return handle_result(res); } -SEXP savvy_times_any_real__impl(SEXP c_arg__x, SEXP c_arg__y) { - SEXP res = savvy_times_any_real__ffi(c_arg__x, c_arg__y); +SEXP savvy_altraw__impl(void) { + SEXP res = savvy_altraw__ffi(); return handle_result(res); } -SEXP savvy_flip_logical__impl(SEXP c_arg__x) { - SEXP res = savvy_flip_logical__ffi(c_arg__x); +SEXP savvy_altreal__impl(void) { + SEXP res = savvy_altreal__ffi(); return handle_result(res); } -SEXP savvy_flip_logical_expert_only__impl(SEXP c_arg__x) { - SEXP res = savvy_flip_logical_expert_only__ffi(c_arg__x); +SEXP savvy_altstring__impl(void) { + SEXP res = savvy_altstring__ffi(); return handle_result(res); } -SEXP savvy_or_logical__impl(SEXP c_arg__x, SEXP c_arg__y) { - SEXP res = savvy_or_logical__ffi(c_arg__x, c_arg__y); +SEXP savvy_call_with_args__impl(SEXP c_arg__fun) { + SEXP res = savvy_call_with_args__ffi(c_arg__fun); return handle_result(res); } -SEXP savvy_reverse_bits__impl(SEXP c_arg__x) { - SEXP res = savvy_reverse_bits__ffi(c_arg__x); +SEXP savvy_default_value_enum__impl(SEXP c_arg__x) { + SEXP res = savvy_default_value_enum__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_reverse_bit_scalar__impl(SEXP c_arg__x) { - SEXP res = savvy_reverse_bit_scalar__ffi(c_arg__x); +SEXP savvy_default_value_scalar__impl(SEXP c_arg__x) { + SEXP res = savvy_default_value_scalar__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_print_list__impl(SEXP c_arg__x) { - SEXP res = savvy_print_list__ffi(c_arg__x); +SEXP savvy_default_value_struct__impl(SEXP c_arg__x) { + SEXP res = savvy_default_value_struct__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_list_with_no_values__impl(void) { - SEXP res = savvy_list_with_no_values__ffi(); +SEXP savvy_default_value_vec__impl(SEXP c_arg__x) { + SEXP res = savvy_default_value_vec__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_list_with_no_names__impl(void) { - SEXP res = savvy_list_with_no_names__ffi(); +SEXP savvy_do_call__impl(SEXP c_arg__fun, SEXP c_arg__args) { + SEXP res = savvy_do_call__ffi(c_arg__fun, c_arg__args); return handle_result(res); } -SEXP savvy_list_with_names_and_values__impl(void) { - SEXP res = savvy_list_with_names_and_values__ffi(); +SEXP savvy_error_conversion__impl(void) { + SEXP res = savvy_error_conversion__ffi(); return handle_result(res); } @@ -119,163 +114,158 @@ SEXP savvy_external_person_new__impl(void) { return handle_result(res); } -SEXP savvy_get_name_external__impl(SEXP c_arg__x) { - SEXP res = savvy_get_name_external__ffi(c_arg__x); - return handle_result(res); -} - -SEXP savvy_set_name_external__impl(SEXP c_arg__x, SEXP c_arg__name) { - SEXP res = savvy_set_name_external__ffi(c_arg__x, c_arg__name); +SEXP savvy_filter_complex_without_im__impl(SEXP c_arg__x) { + SEXP res = savvy_filter_complex_without_im__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_altint__impl(void) { - SEXP res = savvy_altint__ffi(); +SEXP savvy_filter_integer_odd__impl(SEXP c_arg__x) { + SEXP res = savvy_filter_integer_odd__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_print_altint__impl(SEXP c_arg__x) { - SEXP res = savvy_print_altint__ffi(c_arg__x); +SEXP savvy_filter_logical_duplicates__impl(SEXP c_arg__x) { + SEXP res = savvy_filter_logical_duplicates__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_tweak_altint__impl(SEXP c_arg__x) { - SEXP res = savvy_tweak_altint__ffi(c_arg__x); +SEXP savvy_filter_real_negative__impl(SEXP c_arg__x) { + SEXP res = savvy_filter_real_negative__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_altreal__impl(void) { - SEXP res = savvy_altreal__ffi(); +SEXP savvy_filter_string_ascii__impl(SEXP c_arg__x) { + SEXP res = savvy_filter_string_ascii__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_print_altreal__impl(SEXP c_arg__x) { - SEXP res = savvy_print_altreal__ffi(c_arg__x); +SEXP savvy_first_complex__impl(SEXP c_arg__x) { + SEXP res = savvy_first_complex__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_tweak_altreal__impl(SEXP c_arg__x) { - SEXP res = savvy_tweak_altreal__ffi(c_arg__x); +SEXP savvy_flip_logical__impl(SEXP c_arg__x) { + SEXP res = savvy_flip_logical__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_altlogical__impl(void) { - SEXP res = savvy_altlogical__ffi(); +SEXP savvy_flip_logical_expert_only__impl(SEXP c_arg__x) { + SEXP res = savvy_flip_logical_expert_only__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_print_altlogical__impl(SEXP c_arg__x) { - SEXP res = savvy_print_altlogical__ffi(c_arg__x); +SEXP savvy_fn_w_cfg__impl(SEXP c_arg__x) { + SEXP res = savvy_fn_w_cfg__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_tweak_altlogical__impl(SEXP c_arg__x) { - SEXP res = savvy_tweak_altlogical__ffi(c_arg__x); +SEXP savvy_foo_a__impl(void) { + SEXP res = savvy_foo_a__ffi(); return handle_result(res); } -SEXP savvy_altraw__impl(void) { - SEXP res = savvy_altraw__ffi(); +SEXP savvy_fun_mod1__impl(void) { + SEXP res = savvy_fun_mod1__ffi(); return handle_result(res); } -SEXP savvy_print_altraw__impl(SEXP c_arg__x) { - SEXP res = savvy_print_altraw__ffi(c_arg__x); +SEXP savvy_fun_mod1_1_foo__impl(void) { + SEXP res = savvy_fun_mod1_1_foo__ffi(); return handle_result(res); } -SEXP savvy_tweak_altraw__impl(SEXP c_arg__x) { - SEXP res = savvy_tweak_altraw__ffi(c_arg__x); +SEXP savvy_get_altrep_class_name__impl(SEXP c_arg__x) { + SEXP res = savvy_get_altrep_class_name__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_altstring__impl(void) { - SEXP res = savvy_altstring__ffi(); +SEXP savvy_get_altrep_package_name__impl(SEXP c_arg__x) { + SEXP res = savvy_get_altrep_package_name__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_print_altstring__impl(SEXP c_arg__x) { - SEXP res = savvy_print_altstring__ffi(c_arg__x); +SEXP savvy_get_args__impl(SEXP c_arg__args) { + SEXP res = savvy_get_args__ffi(c_arg__args); return handle_result(res); } -SEXP savvy_tweak_altstring__impl(SEXP c_arg__x) { - SEXP res = savvy_tweak_altstring__ffi(c_arg__x); +SEXP savvy_get_attr_int__impl(SEXP c_arg__x, SEXP c_arg__attr) { + SEXP res = savvy_get_attr_int__ffi(c_arg__x, c_arg__attr); return handle_result(res); } -SEXP savvy_altlist__impl(void) { - SEXP res = savvy_altlist__ffi(); +SEXP savvy_get_class_int__impl(SEXP c_arg__x) { + SEXP res = savvy_get_class_int__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_print_altlist__impl(SEXP c_arg__x) { - SEXP res = savvy_print_altlist__ffi(c_arg__x); +SEXP savvy_get_dim_int__impl(SEXP c_arg__x) { + SEXP res = savvy_get_dim_int__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_tweak_altlist__impl(SEXP c_arg__x) { - SEXP res = savvy_tweak_altlist__ffi(c_arg__x); +SEXP savvy_get_foo_value__impl(void) { + SEXP res = savvy_get_foo_value__ffi(); return handle_result(res); } -SEXP savvy_init_altrep_class__impl(DllInfo* c_arg__dll_info) { - SEXP res = savvy_init_altrep_class__ffi(c_arg__dll_info); +SEXP savvy_get_name_external__impl(SEXP c_arg__x) { + SEXP res = savvy_get_name_external__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_get_altrep_class_name__impl(SEXP c_arg__x) { - SEXP res = savvy_get_altrep_class_name__ffi(c_arg__x); +SEXP savvy_get_names_int__impl(SEXP c_arg__x) { + SEXP res = savvy_get_names_int__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_get_altrep_package_name__impl(SEXP c_arg__x) { - SEXP res = savvy_get_altrep_package_name__ffi(c_arg__x); +SEXP savvy_get_var_in_env__impl(SEXP c_arg__name, SEXP c_arg__env) { + SEXP res = savvy_get_var_in_env__ffi(c_arg__name, c_arg__env); return handle_result(res); } -SEXP savvy_print_altint_by_weird_way__impl(SEXP c_arg__x) { - SEXP res = savvy_print_altint_by_weird_way__ffi(c_arg__x); +SEXP savvy_init_altrep_class__impl(DllInfo* c_arg__dll_info) { + SEXP res = savvy_init_altrep_class__ffi(c_arg__dll_info); return handle_result(res); } -SEXP savvy_get_class_int__impl(SEXP c_arg__x) { - SEXP res = savvy_get_class_int__ffi(c_arg__x); +SEXP savvy_init_foo_value__impl(DllInfo* c_arg__dll) { + SEXP res = savvy_init_foo_value__ffi(c_arg__dll); return handle_result(res); } -SEXP savvy_get_names_int__impl(SEXP c_arg__x) { - SEXP res = savvy_get_names_int__ffi(c_arg__x); +SEXP savvy_init_logger__impl(DllInfo* c_arg__dll_info) { + SEXP res = savvy_init_logger__ffi(c_arg__dll_info); return handle_result(res); } -SEXP savvy_get_dim_int__impl(SEXP c_arg__x) { - SEXP res = savvy_get_dim_int__ffi(c_arg__x); +SEXP savvy_is_built_with_debug__impl(void) { + SEXP res = savvy_is_built_with_debug__ffi(); return handle_result(res); } -SEXP savvy_get_attr_int__impl(SEXP c_arg__x, SEXP c_arg__attr) { - SEXP res = savvy_get_attr_int__ffi(c_arg__x, c_arg__attr); +SEXP savvy_list_with_names_and_values__impl(void) { + SEXP res = savvy_list_with_names_and_values__ffi(); return handle_result(res); } -SEXP savvy_set_class_int__impl(void) { - SEXP res = savvy_set_class_int__ffi(); +SEXP savvy_list_with_no_names__impl(void) { + SEXP res = savvy_list_with_no_names__ffi(); return handle_result(res); } -SEXP savvy_set_names_int__impl(void) { - SEXP res = savvy_set_names_int__ffi(); +SEXP savvy_list_with_no_values__impl(void) { + SEXP res = savvy_list_with_no_values__ffi(); return handle_result(res); } -SEXP savvy_set_dim_int__impl(void) { - SEXP res = savvy_set_dim_int__ffi(); +SEXP savvy_must_panic__impl(void) { + SEXP res = savvy_must_panic__ffi(); return handle_result(res); } -SEXP savvy_set_attr_int__impl(SEXP c_arg__attr, SEXP c_arg__value) { - SEXP res = savvy_set_attr_int__ffi(c_arg__attr, c_arg__value); +SEXP savvy_new_bool__impl(SEXP c_arg__size) { + SEXP res = savvy_new_bool__ffi(c_arg__size); return handle_result(res); } @@ -284,13 +274,13 @@ SEXP savvy_new_complex__impl(SEXP c_arg__size) { return handle_result(res); } -SEXP savvy_first_complex__impl(SEXP c_arg__x) { - SEXP res = savvy_first_complex__ffi(c_arg__x); +SEXP savvy_new_int__impl(SEXP c_arg__size) { + SEXP res = savvy_new_int__ffi(c_arg__size); return handle_result(res); } -SEXP savvy_abs_complex__impl(SEXP c_arg__x) { - SEXP res = savvy_abs_complex__ffi(c_arg__x); +SEXP savvy_new_real__impl(SEXP c_arg__size) { + SEXP res = savvy_new_real__ffi(c_arg__size); return handle_result(res); } @@ -299,83 +289,88 @@ SEXP savvy_new_value_pair__impl(SEXP c_arg__a, SEXP c_arg__b) { return handle_result(res); } -SEXP savvy_scalar_input_int__impl(SEXP c_arg__x) { - SEXP res = savvy_scalar_input_int__ffi(c_arg__x); +SEXP savvy_or_logical__impl(SEXP c_arg__x, SEXP c_arg__y) { + SEXP res = savvy_or_logical__ffi(c_arg__x, c_arg__y); return handle_result(res); } -SEXP savvy_scalar_input_real__impl(SEXP c_arg__x) { - SEXP res = savvy_scalar_input_real__ffi(c_arg__x); +SEXP savvy_print_altint__impl(SEXP c_arg__x) { + SEXP res = savvy_print_altint__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_scalar_input_logical__impl(SEXP c_arg__x) { - SEXP res = savvy_scalar_input_logical__ffi(c_arg__x); +SEXP savvy_print_altint_by_weird_way__impl(SEXP c_arg__x) { + SEXP res = savvy_print_altint_by_weird_way__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_scalar_input_string__impl(SEXP c_arg__x) { - SEXP res = savvy_scalar_input_string__ffi(c_arg__x); +SEXP savvy_print_altlist__impl(SEXP c_arg__x) { + SEXP res = savvy_print_altlist__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_scalar_output_int__impl(void) { - SEXP res = savvy_scalar_output_int__ffi(); +SEXP savvy_print_altlogical__impl(SEXP c_arg__x) { + SEXP res = savvy_print_altlogical__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_scalar_output_int2__impl(void) { - SEXP res = savvy_scalar_output_int2__ffi(); +SEXP savvy_print_altraw__impl(SEXP c_arg__x) { + SEXP res = savvy_print_altraw__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_scalar_output_real__impl(void) { - SEXP res = savvy_scalar_output_real__ffi(); +SEXP savvy_print_altreal__impl(SEXP c_arg__x) { + SEXP res = savvy_print_altreal__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_scalar_output_real2__impl(void) { - SEXP res = savvy_scalar_output_real2__ffi(); +SEXP savvy_print_altstring__impl(SEXP c_arg__x) { + SEXP res = savvy_print_altstring__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_scalar_output_logical__impl(void) { - SEXP res = savvy_scalar_output_logical__ffi(); +SEXP savvy_print_foo_enum__impl(SEXP c_arg__x) { + SEXP res = savvy_print_foo_enum__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_scalar_output_logical2__impl(void) { - SEXP res = savvy_scalar_output_logical2__ffi(); +SEXP savvy_print_foo_enum_ref__impl(SEXP c_arg__x) { + SEXP res = savvy_print_foo_enum_ref__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_scalar_output_string__impl(void) { - SEXP res = savvy_scalar_output_string__ffi(); +SEXP savvy_print_list__impl(SEXP c_arg__x) { + SEXP res = savvy_print_list__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_scalar_output_string2__impl(void) { - SEXP res = savvy_scalar_output_string2__ffi(); +SEXP savvy_print_numeric__impl(SEXP c_arg__x) { + SEXP res = savvy_print_numeric__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_scalar_output_complex__impl(void) { - SEXP res = savvy_scalar_output_complex__ffi(); +SEXP savvy_fn__impl(SEXP c_arg__struct) { + SEXP res = savvy_fn__ffi(c_arg__struct); return handle_result(res); } -SEXP savvy_scalar_output_complex2__impl(void) { - SEXP res = savvy_scalar_output_complex2__ffi(); +SEXP savvy_raise_error__impl(void) { + SEXP res = savvy_raise_error__ffi(); return handle_result(res); } -SEXP savvy_sum_int__impl(SEXP c_arg__x) { - SEXP res = savvy_sum_int__ffi(c_arg__x); +SEXP savvy_rep_bool_slice__impl(SEXP c_arg__x) { + SEXP res = savvy_rep_bool_slice__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_sum_real__impl(SEXP c_arg__x) { - SEXP res = savvy_sum_real__ffi(c_arg__x); +SEXP savvy_rep_bool_vec__impl(SEXP c_arg__x) { + SEXP res = savvy_rep_bool_vec__ffi(c_arg__x); + return handle_result(res); +} + +SEXP savvy_rep_int_slice__impl(SEXP c_arg__x) { + SEXP res = savvy_rep_int_slice__ffi(c_arg__x); return handle_result(res); } @@ -384,8 +379,8 @@ SEXP savvy_rep_int_vec__impl(SEXP c_arg__x) { return handle_result(res); } -SEXP savvy_rep_int_slice__impl(SEXP c_arg__x) { - SEXP res = savvy_rep_int_slice__ffi(c_arg__x); +SEXP savvy_rep_real_slice__impl(SEXP c_arg__x) { + SEXP res = savvy_rep_real_slice__ffi(c_arg__x); return handle_result(res); } @@ -394,223 +389,233 @@ SEXP savvy_rep_real_vec__impl(SEXP c_arg__x) { return handle_result(res); } -SEXP savvy_rep_real_slice__impl(SEXP c_arg__x) { - SEXP res = savvy_rep_real_slice__ffi(c_arg__x); +SEXP savvy_rep_str_slice__impl(SEXP c_arg__x) { + SEXP res = savvy_rep_str_slice__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_rep_bool_vec__impl(SEXP c_arg__x) { - SEXP res = savvy_rep_bool_vec__ffi(c_arg__x); +SEXP savvy_rep_str_vec__impl(SEXP c_arg__x) { + SEXP res = savvy_rep_str_vec__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_rep_bool_slice__impl(SEXP c_arg__x) { - SEXP res = savvy_rep_bool_slice__ffi(c_arg__x); +SEXP savvy_reverse_bit_scalar__impl(SEXP c_arg__x) { + SEXP res = savvy_reverse_bit_scalar__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_rep_str_vec__impl(SEXP c_arg__x) { - SEXP res = savvy_rep_str_vec__ffi(c_arg__x); +SEXP savvy_reverse_bits__impl(SEXP c_arg__x) { + SEXP res = savvy_reverse_bits__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_rep_str_slice__impl(SEXP c_arg__x) { - SEXP res = savvy_rep_str_slice__ffi(c_arg__x); +SEXP savvy_safe_stop__impl(void) { + SEXP res = savvy_safe_stop__ffi(); return handle_result(res); } -SEXP savvy_print_foo_enum__impl(SEXP c_arg__x) { - SEXP res = savvy_print_foo_enum__ffi(c_arg__x); +SEXP savvy_safe_warn__impl(void) { + SEXP res = savvy_safe_warn__ffi(); return handle_result(res); } -SEXP savvy_print_foo_enum_ref__impl(SEXP c_arg__x) { - SEXP res = savvy_print_foo_enum_ref__ffi(c_arg__x); +SEXP savvy_scalar_input_int__impl(SEXP c_arg__x) { + SEXP res = savvy_scalar_input_int__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_foo_a__impl(void) { - SEXP res = savvy_foo_a__ffi(); +SEXP savvy_scalar_input_logical__impl(SEXP c_arg__x) { + SEXP res = savvy_scalar_input_logical__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_get_var_in_env__impl(SEXP c_arg__name, SEXP c_arg__env) { - SEXP res = savvy_get_var_in_env__ffi(c_arg__name, c_arg__env); +SEXP savvy_scalar_input_real__impl(SEXP c_arg__x) { + SEXP res = savvy_scalar_input_real__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_var_exists_in_env__impl(SEXP c_arg__name, SEXP c_arg__env) { - SEXP res = savvy_var_exists_in_env__ffi(c_arg__name, c_arg__env); +SEXP savvy_scalar_input_string__impl(SEXP c_arg__x) { + SEXP res = savvy_scalar_input_string__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_set_var_in_env__impl(SEXP c_arg__name, SEXP c_arg__value, SEXP c_arg__env) { - SEXP res = savvy_set_var_in_env__ffi(c_arg__name, c_arg__value, c_arg__env); +SEXP savvy_scalar_output_complex__impl(void) { + SEXP res = savvy_scalar_output_complex__ffi(); return handle_result(res); } -SEXP savvy_init_foo_value__impl(DllInfo* c_arg__dll) { - SEXP res = savvy_init_foo_value__ffi(c_arg__dll); +SEXP savvy_scalar_output_complex2__impl(void) { + SEXP res = savvy_scalar_output_complex2__ffi(); return handle_result(res); } -SEXP savvy_get_foo_value__impl(void) { - SEXP res = savvy_get_foo_value__ffi(); +SEXP savvy_scalar_output_int__impl(void) { + SEXP res = savvy_scalar_output_int__ffi(); return handle_result(res); } -SEXP savvy_safe_stop__impl(void) { - SEXP res = savvy_safe_stop__ffi(); +SEXP savvy_scalar_output_int2__impl(void) { + SEXP res = savvy_scalar_output_int2__ffi(); return handle_result(res); } -SEXP savvy_raise_error__impl(void) { - SEXP res = savvy_raise_error__ffi(); +SEXP savvy_scalar_output_logical__impl(void) { + SEXP res = savvy_scalar_output_logical__ffi(); return handle_result(res); } -SEXP savvy_must_panic__impl(void) { - SEXP res = savvy_must_panic__ffi(); +SEXP savvy_scalar_output_logical2__impl(void) { + SEXP res = savvy_scalar_output_logical2__ffi(); return handle_result(res); } -SEXP savvy_safe_warn__impl(void) { - SEXP res = savvy_safe_warn__ffi(); +SEXP savvy_scalar_output_real__impl(void) { + SEXP res = savvy_scalar_output_real__ffi(); return handle_result(res); } -SEXP savvy_error_conversion__impl(void) { - SEXP res = savvy_error_conversion__ffi(); +SEXP savvy_scalar_output_real2__impl(void) { + SEXP res = savvy_scalar_output_real2__ffi(); return handle_result(res); } -SEXP savvy_do_call__impl(SEXP c_arg__fun, SEXP c_arg__args) { - SEXP res = savvy_do_call__ffi(c_arg__fun, c_arg__args); +SEXP savvy_scalar_output_string__impl(void) { + SEXP res = savvy_scalar_output_string__ffi(); return handle_result(res); } -SEXP savvy_call_with_args__impl(SEXP c_arg__fun) { - SEXP res = savvy_call_with_args__ffi(c_arg__fun); +SEXP savvy_scalar_output_string2__impl(void) { + SEXP res = savvy_scalar_output_string2__ffi(); return handle_result(res); } -SEXP savvy_get_args__impl(SEXP c_arg__args) { - SEXP res = savvy_get_args__ffi(c_arg__args); +SEXP savvy_set_attr_int__impl(SEXP c_arg__attr, SEXP c_arg__value) { + SEXP res = savvy_set_attr_int__ffi(c_arg__attr, c_arg__value); return handle_result(res); } -SEXP savvy_new_int__impl(SEXP c_arg__size) { - SEXP res = savvy_new_int__ffi(c_arg__size); +SEXP savvy_set_class_int__impl(void) { + SEXP res = savvy_set_class_int__ffi(); return handle_result(res); } -SEXP savvy_new_real__impl(SEXP c_arg__size) { - SEXP res = savvy_new_real__ffi(c_arg__size); +SEXP savvy_set_dim_int__impl(void) { + SEXP res = savvy_set_dim_int__ffi(); return handle_result(res); } -SEXP savvy_new_bool__impl(SEXP c_arg__size) { - SEXP res = savvy_new_bool__ffi(c_arg__size); +SEXP savvy_set_name_external__impl(SEXP c_arg__x, SEXP c_arg__name) { + SEXP res = savvy_set_name_external__ffi(c_arg__x, c_arg__name); return handle_result(res); } -SEXP savvy_times_two_numeric_f64__impl(SEXP c_arg__x) { - SEXP res = savvy_times_two_numeric_f64__ffi(c_arg__x); +SEXP savvy_set_names_int__impl(void) { + SEXP res = savvy_set_names_int__ffi(); return handle_result(res); } -SEXP savvy_times_two_numeric_i32__impl(SEXP c_arg__x) { - SEXP res = savvy_times_two_numeric_i32__ffi(c_arg__x); +SEXP savvy_set_var_in_env__impl(SEXP c_arg__name, SEXP c_arg__value, SEXP c_arg__env) { + SEXP res = savvy_set_var_in_env__ffi(c_arg__name, c_arg__value, c_arg__env); return handle_result(res); } -SEXP savvy_usize_to_string__impl(SEXP c_arg__x) { - SEXP res = savvy_usize_to_string__ffi(c_arg__x); +SEXP savvy_sum_int__impl(SEXP c_arg__x) { + SEXP res = savvy_sum_int__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_times_two_numeric_f64_scalar__impl(SEXP c_arg__x) { - SEXP res = savvy_times_two_numeric_f64_scalar__ffi(c_arg__x); +SEXP savvy_sum_real__impl(SEXP c_arg__x) { + SEXP res = savvy_sum_real__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_times_two_numeric_i32_scalar__impl(SEXP c_arg__x) { - SEXP res = savvy_times_two_numeric_i32_scalar__ffi(c_arg__x); +SEXP savvy_times_any_int__impl(SEXP c_arg__x, SEXP c_arg__y) { + SEXP res = savvy_times_any_int__ffi(c_arg__x, c_arg__y); return handle_result(res); } -SEXP savvy_usize_to_string_scalar__impl(SEXP c_arg__x) { - SEXP res = savvy_usize_to_string_scalar__ffi(c_arg__x); +SEXP savvy_times_any_real__impl(SEXP c_arg__x, SEXP c_arg__y) { + SEXP res = savvy_times_any_real__ffi(c_arg__x, c_arg__y); return handle_result(res); } -SEXP savvy_print_numeric__impl(SEXP c_arg__x) { - SEXP res = savvy_print_numeric__ffi(c_arg__x); +SEXP savvy_times_two_int__impl(SEXP c_arg__x) { + SEXP res = savvy_times_two_int__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_default_value_scalar__impl(SEXP c_arg__x) { - SEXP res = savvy_default_value_scalar__ffi(c_arg__x); +SEXP savvy_times_two_numeric_f64__impl(SEXP c_arg__x) { + SEXP res = savvy_times_two_numeric_f64__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_default_value_vec__impl(SEXP c_arg__x) { - SEXP res = savvy_default_value_vec__ffi(c_arg__x); +SEXP savvy_times_two_numeric_f64_scalar__impl(SEXP c_arg__x) { + SEXP res = savvy_times_two_numeric_f64_scalar__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_default_value_struct__impl(SEXP c_arg__x) { - SEXP res = savvy_default_value_struct__ffi(c_arg__x); +SEXP savvy_times_two_numeric_i32__impl(SEXP c_arg__x) { + SEXP res = savvy_times_two_numeric_i32__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_default_value_enum__impl(SEXP c_arg__x) { - SEXP res = savvy_default_value_enum__ffi(c_arg__x); +SEXP savvy_times_two_numeric_i32_scalar__impl(SEXP c_arg__x) { + SEXP res = savvy_times_two_numeric_i32_scalar__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_filter_integer_odd__impl(SEXP c_arg__x) { - SEXP res = savvy_filter_integer_odd__ffi(c_arg__x); +SEXP savvy_times_two_real__impl(SEXP c_arg__x) { + SEXP res = savvy_times_two_real__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_filter_real_negative__impl(SEXP c_arg__x) { - SEXP res = savvy_filter_real_negative__ffi(c_arg__x); +SEXP savvy_to_upper__impl(SEXP c_arg__x) { + SEXP res = savvy_to_upper__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_filter_complex_without_im__impl(SEXP c_arg__x) { - SEXP res = savvy_filter_complex_without_im__ffi(c_arg__x); +SEXP savvy_tweak_altint__impl(SEXP c_arg__x) { + SEXP res = savvy_tweak_altint__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_filter_logical_duplicates__impl(SEXP c_arg__x) { - SEXP res = savvy_filter_logical_duplicates__ffi(c_arg__x); +SEXP savvy_tweak_altlist__impl(SEXP c_arg__x) { + SEXP res = savvy_tweak_altlist__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_filter_string_ascii__impl(SEXP c_arg__x) { - SEXP res = savvy_filter_string_ascii__ffi(c_arg__x); +SEXP savvy_tweak_altlogical__impl(SEXP c_arg__x) { + SEXP res = savvy_tweak_altlogical__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_fn__impl(SEXP c_arg__struct) { - SEXP res = savvy_fn__ffi(c_arg__struct); +SEXP savvy_tweak_altraw__impl(SEXP c_arg__x) { + SEXP res = savvy_tweak_altraw__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_fun_mod1__impl(void) { - SEXP res = savvy_fun_mod1__ffi(); +SEXP savvy_tweak_altreal__impl(SEXP c_arg__x) { + SEXP res = savvy_tweak_altreal__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_init_logger__impl(DllInfo* c_arg__dll_info) { - SEXP res = savvy_init_logger__ffi(c_arg__dll_info); +SEXP savvy_tweak_altstring__impl(SEXP c_arg__x) { + SEXP res = savvy_tweak_altstring__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_fun_mod1_1_foo__impl(void) { - SEXP res = savvy_fun_mod1_1_foo__ffi(); +SEXP savvy_usize_to_string__impl(SEXP c_arg__x) { + SEXP res = savvy_usize_to_string__ffi(c_arg__x); + return handle_result(res); +} + +SEXP savvy_usize_to_string_scalar__impl(SEXP c_arg__x) { + SEXP res = savvy_usize_to_string_scalar__ffi(c_arg__x); + return handle_result(res); +} + +SEXP savvy_var_exists_in_env__impl(SEXP c_arg__name, SEXP c_arg__env) { + SEXP res = savvy_var_exists_in_env__ffi(c_arg__name, c_arg__env); return handle_result(res); } @@ -620,8 +625,8 @@ SEXP savvy_FooEnum_print__impl(SEXP self__) { return handle_result(res); } -SEXP savvy_FooWithDefault_new__impl(SEXP c_arg__default_value) { - SEXP res = savvy_FooWithDefault_new__ffi(c_arg__default_value); +SEXP savvy_FooWithDefault_default_value_associated_fn__impl(SEXP c_arg__x) { + SEXP res = savvy_FooWithDefault_default_value_associated_fn__ffi(c_arg__x); return handle_result(res); } @@ -630,8 +635,23 @@ SEXP savvy_FooWithDefault_default_value_method__impl(SEXP self__, SEXP c_arg__x) return handle_result(res); } -SEXP savvy_FooWithDefault_default_value_associated_fn__impl(SEXP c_arg__x) { - SEXP res = savvy_FooWithDefault_default_value_associated_fn__ffi(c_arg__x); +SEXP savvy_FooWithDefault_new__impl(SEXP c_arg__default_value) { + SEXP res = savvy_FooWithDefault_new__ffi(c_arg__default_value); + return handle_result(res); +} + +SEXP savvy_Person_another_person__impl(SEXP self__) { + SEXP res = savvy_Person_another_person__ffi(self__); + return handle_result(res); +} + +SEXP savvy_Person_associated_function__impl(void) { + SEXP res = savvy_Person_associated_function__ffi(); + return handle_result(res); +} + +SEXP savvy_Person_name__impl(SEXP self__) { + SEXP res = savvy_Person_name__ffi(self__); return handle_result(res); } @@ -650,11 +670,6 @@ SEXP savvy_Person_new_fallible__impl(void) { return handle_result(res); } -SEXP savvy_Person_another_person__impl(SEXP self__) { - SEXP res = savvy_Person_another_person__ffi(self__); - return handle_result(res); -} - SEXP savvy_Person_new_with_name__impl(SEXP c_arg__name) { SEXP res = savvy_Person_new_with_name__ffi(c_arg__name); return handle_result(res); @@ -665,28 +680,18 @@ SEXP savvy_Person_set_name__impl(SEXP self__, SEXP c_arg__name) { return handle_result(res); } -SEXP savvy_Person_name__impl(SEXP self__) { - SEXP res = savvy_Person_name__ffi(self__); - return handle_result(res); -} - -SEXP savvy_Person_associated_function__impl(void) { - SEXP res = savvy_Person_associated_function__ffi(); - return handle_result(res); -} - SEXP savvy_Person2_name__impl(SEXP self__) { SEXP res = savvy_Person2_name__ffi(self__); return handle_result(res); } -SEXP savvy_Value_new__impl(SEXP c_arg__x) { - SEXP res = savvy_Value_new__ffi(c_arg__x); +SEXP savvy_StructWithConfig_new_associated_fn__impl(SEXP c_arg__x) { + SEXP res = savvy_StructWithConfig_new_associated_fn__ffi(c_arg__x); return handle_result(res); } -SEXP savvy_Value_pair__impl(SEXP self__, SEXP c_arg__b) { - SEXP res = savvy_Value_pair__ffi(self__, c_arg__b); +SEXP savvy_StructWithConfig_new_method__impl(SEXP self__, SEXP c_arg__x) { + SEXP res = savvy_StructWithConfig_new_method__ffi(self__, c_arg__x); return handle_result(res); } @@ -700,6 +705,16 @@ SEXP savvy_Value_get2__impl(SEXP self__) { return handle_result(res); } +SEXP savvy_Value_new__impl(SEXP c_arg__x) { + SEXP res = savvy_Value_new__ffi(c_arg__x); + return handle_result(res); +} + +SEXP savvy_Value_pair__impl(SEXP self__, SEXP c_arg__b) { + SEXP res = savvy_Value_pair__ffi(self__, c_arg__b); + return handle_result(res); +} + SEXP savvy_ValuePair_new__impl(SEXP c_arg__a, SEXP c_arg__b) { SEXP res = savvy_ValuePair_new__ffi(c_arg__a, c_arg__b); return handle_result(res); @@ -715,154 +730,157 @@ SEXP savvy_ValuePair_print__impl(SEXP self__) { return handle_result(res); } -SEXP savvy_struct_new__impl(void) { - SEXP res = savvy_struct_new__ffi(); +SEXP savvy_struct_fn__impl(SEXP c_arg__fn) { + SEXP res = savvy_struct_fn__ffi(c_arg__fn); return handle_result(res); } -SEXP savvy_struct_fn__impl(SEXP c_arg__fn) { - SEXP res = savvy_struct_fn__ffi(c_arg__fn); +SEXP savvy_struct_new__impl(void) { + SEXP res = savvy_struct_new__ffi(); return handle_result(res); } static const R_CallMethodDef CallEntries[] = { - {"savvy_is_built_with_debug__impl", (DL_FUNC) &savvy_is_built_with_debug__impl, 0}, - {"savvy_to_upper__impl", (DL_FUNC) &savvy_to_upper__impl, 1}, + {"savvy_abs_complex__impl", (DL_FUNC) &savvy_abs_complex__impl, 1}, {"savvy_add_suffix__impl", (DL_FUNC) &savvy_add_suffix__impl, 2}, - {"savvy_times_two_int__impl", (DL_FUNC) &savvy_times_two_int__impl, 1}, - {"savvy_times_any_int__impl", (DL_FUNC) &savvy_times_any_int__impl, 2}, - {"savvy_times_two_real__impl", (DL_FUNC) &savvy_times_two_real__impl, 1}, - {"savvy_times_any_real__impl", (DL_FUNC) &savvy_times_any_real__impl, 2}, - {"savvy_flip_logical__impl", (DL_FUNC) &savvy_flip_logical__impl, 1}, - {"savvy_flip_logical_expert_only__impl", (DL_FUNC) &savvy_flip_logical_expert_only__impl, 1}, - {"savvy_or_logical__impl", (DL_FUNC) &savvy_or_logical__impl, 2}, - {"savvy_reverse_bits__impl", (DL_FUNC) &savvy_reverse_bits__impl, 1}, - {"savvy_reverse_bit_scalar__impl", (DL_FUNC) &savvy_reverse_bit_scalar__impl, 1}, - {"savvy_print_list__impl", (DL_FUNC) &savvy_print_list__impl, 1}, - {"savvy_list_with_no_values__impl", (DL_FUNC) &savvy_list_with_no_values__impl, 0}, - {"savvy_list_with_no_names__impl", (DL_FUNC) &savvy_list_with_no_names__impl, 0}, - {"savvy_list_with_names_and_values__impl", (DL_FUNC) &savvy_list_with_names_and_values__impl, 0}, - {"savvy_external_person_new__impl", (DL_FUNC) &savvy_external_person_new__impl, 0}, - {"savvy_get_name_external__impl", (DL_FUNC) &savvy_get_name_external__impl, 1}, - {"savvy_set_name_external__impl", (DL_FUNC) &savvy_set_name_external__impl, 2}, {"savvy_altint__impl", (DL_FUNC) &savvy_altint__impl, 0}, - {"savvy_print_altint__impl", (DL_FUNC) &savvy_print_altint__impl, 1}, - {"savvy_tweak_altint__impl", (DL_FUNC) &savvy_tweak_altint__impl, 1}, - {"savvy_altreal__impl", (DL_FUNC) &savvy_altreal__impl, 0}, - {"savvy_print_altreal__impl", (DL_FUNC) &savvy_print_altreal__impl, 1}, - {"savvy_tweak_altreal__impl", (DL_FUNC) &savvy_tweak_altreal__impl, 1}, + {"savvy_altlist__impl", (DL_FUNC) &savvy_altlist__impl, 0}, {"savvy_altlogical__impl", (DL_FUNC) &savvy_altlogical__impl, 0}, - {"savvy_print_altlogical__impl", (DL_FUNC) &savvy_print_altlogical__impl, 1}, - {"savvy_tweak_altlogical__impl", (DL_FUNC) &savvy_tweak_altlogical__impl, 1}, {"savvy_altraw__impl", (DL_FUNC) &savvy_altraw__impl, 0}, - {"savvy_print_altraw__impl", (DL_FUNC) &savvy_print_altraw__impl, 1}, - {"savvy_tweak_altraw__impl", (DL_FUNC) &savvy_tweak_altraw__impl, 1}, + {"savvy_altreal__impl", (DL_FUNC) &savvy_altreal__impl, 0}, {"savvy_altstring__impl", (DL_FUNC) &savvy_altstring__impl, 0}, - {"savvy_print_altstring__impl", (DL_FUNC) &savvy_print_altstring__impl, 1}, - {"savvy_tweak_altstring__impl", (DL_FUNC) &savvy_tweak_altstring__impl, 1}, - {"savvy_altlist__impl", (DL_FUNC) &savvy_altlist__impl, 0}, - {"savvy_print_altlist__impl", (DL_FUNC) &savvy_print_altlist__impl, 1}, - {"savvy_tweak_altlist__impl", (DL_FUNC) &savvy_tweak_altlist__impl, 1}, + {"savvy_call_with_args__impl", (DL_FUNC) &savvy_call_with_args__impl, 1}, + {"savvy_default_value_enum__impl", (DL_FUNC) &savvy_default_value_enum__impl, 1}, + {"savvy_default_value_scalar__impl", (DL_FUNC) &savvy_default_value_scalar__impl, 1}, + {"savvy_default_value_struct__impl", (DL_FUNC) &savvy_default_value_struct__impl, 1}, + {"savvy_default_value_vec__impl", (DL_FUNC) &savvy_default_value_vec__impl, 1}, + {"savvy_do_call__impl", (DL_FUNC) &savvy_do_call__impl, 2}, + {"savvy_error_conversion__impl", (DL_FUNC) &savvy_error_conversion__impl, 0}, + {"savvy_external_person_new__impl", (DL_FUNC) &savvy_external_person_new__impl, 0}, + {"savvy_filter_complex_without_im__impl", (DL_FUNC) &savvy_filter_complex_without_im__impl, 1}, + {"savvy_filter_integer_odd__impl", (DL_FUNC) &savvy_filter_integer_odd__impl, 1}, + {"savvy_filter_logical_duplicates__impl", (DL_FUNC) &savvy_filter_logical_duplicates__impl, 1}, + {"savvy_filter_real_negative__impl", (DL_FUNC) &savvy_filter_real_negative__impl, 1}, + {"savvy_filter_string_ascii__impl", (DL_FUNC) &savvy_filter_string_ascii__impl, 1}, + {"savvy_first_complex__impl", (DL_FUNC) &savvy_first_complex__impl, 1}, + {"savvy_flip_logical__impl", (DL_FUNC) &savvy_flip_logical__impl, 1}, + {"savvy_flip_logical_expert_only__impl", (DL_FUNC) &savvy_flip_logical_expert_only__impl, 1}, + {"savvy_fn_w_cfg__impl", (DL_FUNC) &savvy_fn_w_cfg__impl, 1}, + {"savvy_foo_a__impl", (DL_FUNC) &savvy_foo_a__impl, 0}, + {"savvy_fun_mod1__impl", (DL_FUNC) &savvy_fun_mod1__impl, 0}, + {"savvy_fun_mod1_1_foo__impl", (DL_FUNC) &savvy_fun_mod1_1_foo__impl, 0}, {"savvy_get_altrep_class_name__impl", (DL_FUNC) &savvy_get_altrep_class_name__impl, 1}, {"savvy_get_altrep_package_name__impl", (DL_FUNC) &savvy_get_altrep_package_name__impl, 1}, - {"savvy_print_altint_by_weird_way__impl", (DL_FUNC) &savvy_print_altint_by_weird_way__impl, 1}, + {"savvy_get_args__impl", (DL_FUNC) &savvy_get_args__impl, 1}, + {"savvy_get_attr_int__impl", (DL_FUNC) &savvy_get_attr_int__impl, 2}, {"savvy_get_class_int__impl", (DL_FUNC) &savvy_get_class_int__impl, 1}, - {"savvy_get_names_int__impl", (DL_FUNC) &savvy_get_names_int__impl, 1}, {"savvy_get_dim_int__impl", (DL_FUNC) &savvy_get_dim_int__impl, 1}, - {"savvy_get_attr_int__impl", (DL_FUNC) &savvy_get_attr_int__impl, 2}, - {"savvy_set_class_int__impl", (DL_FUNC) &savvy_set_class_int__impl, 0}, - {"savvy_set_names_int__impl", (DL_FUNC) &savvy_set_names_int__impl, 0}, - {"savvy_set_dim_int__impl", (DL_FUNC) &savvy_set_dim_int__impl, 0}, - {"savvy_set_attr_int__impl", (DL_FUNC) &savvy_set_attr_int__impl, 2}, + {"savvy_get_foo_value__impl", (DL_FUNC) &savvy_get_foo_value__impl, 0}, + {"savvy_get_name_external__impl", (DL_FUNC) &savvy_get_name_external__impl, 1}, + {"savvy_get_names_int__impl", (DL_FUNC) &savvy_get_names_int__impl, 1}, + {"savvy_get_var_in_env__impl", (DL_FUNC) &savvy_get_var_in_env__impl, 2}, + {"savvy_is_built_with_debug__impl", (DL_FUNC) &savvy_is_built_with_debug__impl, 0}, + {"savvy_list_with_names_and_values__impl", (DL_FUNC) &savvy_list_with_names_and_values__impl, 0}, + {"savvy_list_with_no_names__impl", (DL_FUNC) &savvy_list_with_no_names__impl, 0}, + {"savvy_list_with_no_values__impl", (DL_FUNC) &savvy_list_with_no_values__impl, 0}, + {"savvy_must_panic__impl", (DL_FUNC) &savvy_must_panic__impl, 0}, + {"savvy_new_bool__impl", (DL_FUNC) &savvy_new_bool__impl, 1}, {"savvy_new_complex__impl", (DL_FUNC) &savvy_new_complex__impl, 1}, - {"savvy_first_complex__impl", (DL_FUNC) &savvy_first_complex__impl, 1}, - {"savvy_abs_complex__impl", (DL_FUNC) &savvy_abs_complex__impl, 1}, + {"savvy_new_int__impl", (DL_FUNC) &savvy_new_int__impl, 1}, + {"savvy_new_real__impl", (DL_FUNC) &savvy_new_real__impl, 1}, {"savvy_new_value_pair__impl", (DL_FUNC) &savvy_new_value_pair__impl, 2}, + {"savvy_or_logical__impl", (DL_FUNC) &savvy_or_logical__impl, 2}, + {"savvy_print_altint__impl", (DL_FUNC) &savvy_print_altint__impl, 1}, + {"savvy_print_altint_by_weird_way__impl", (DL_FUNC) &savvy_print_altint_by_weird_way__impl, 1}, + {"savvy_print_altlist__impl", (DL_FUNC) &savvy_print_altlist__impl, 1}, + {"savvy_print_altlogical__impl", (DL_FUNC) &savvy_print_altlogical__impl, 1}, + {"savvy_print_altraw__impl", (DL_FUNC) &savvy_print_altraw__impl, 1}, + {"savvy_print_altreal__impl", (DL_FUNC) &savvy_print_altreal__impl, 1}, + {"savvy_print_altstring__impl", (DL_FUNC) &savvy_print_altstring__impl, 1}, + {"savvy_print_foo_enum__impl", (DL_FUNC) &savvy_print_foo_enum__impl, 1}, + {"savvy_print_foo_enum_ref__impl", (DL_FUNC) &savvy_print_foo_enum_ref__impl, 1}, + {"savvy_print_list__impl", (DL_FUNC) &savvy_print_list__impl, 1}, + {"savvy_print_numeric__impl", (DL_FUNC) &savvy_print_numeric__impl, 1}, + {"savvy_fn__impl", (DL_FUNC) &savvy_fn__impl, 1}, + {"savvy_raise_error__impl", (DL_FUNC) &savvy_raise_error__impl, 0}, + {"savvy_rep_bool_slice__impl", (DL_FUNC) &savvy_rep_bool_slice__impl, 1}, + {"savvy_rep_bool_vec__impl", (DL_FUNC) &savvy_rep_bool_vec__impl, 1}, + {"savvy_rep_int_slice__impl", (DL_FUNC) &savvy_rep_int_slice__impl, 1}, + {"savvy_rep_int_vec__impl", (DL_FUNC) &savvy_rep_int_vec__impl, 1}, + {"savvy_rep_real_slice__impl", (DL_FUNC) &savvy_rep_real_slice__impl, 1}, + {"savvy_rep_real_vec__impl", (DL_FUNC) &savvy_rep_real_vec__impl, 1}, + {"savvy_rep_str_slice__impl", (DL_FUNC) &savvy_rep_str_slice__impl, 1}, + {"savvy_rep_str_vec__impl", (DL_FUNC) &savvy_rep_str_vec__impl, 1}, + {"savvy_reverse_bit_scalar__impl", (DL_FUNC) &savvy_reverse_bit_scalar__impl, 1}, + {"savvy_reverse_bits__impl", (DL_FUNC) &savvy_reverse_bits__impl, 1}, + {"savvy_safe_stop__impl", (DL_FUNC) &savvy_safe_stop__impl, 0}, + {"savvy_safe_warn__impl", (DL_FUNC) &savvy_safe_warn__impl, 0}, {"savvy_scalar_input_int__impl", (DL_FUNC) &savvy_scalar_input_int__impl, 1}, - {"savvy_scalar_input_real__impl", (DL_FUNC) &savvy_scalar_input_real__impl, 1}, {"savvy_scalar_input_logical__impl", (DL_FUNC) &savvy_scalar_input_logical__impl, 1}, + {"savvy_scalar_input_real__impl", (DL_FUNC) &savvy_scalar_input_real__impl, 1}, {"savvy_scalar_input_string__impl", (DL_FUNC) &savvy_scalar_input_string__impl, 1}, + {"savvy_scalar_output_complex__impl", (DL_FUNC) &savvy_scalar_output_complex__impl, 0}, + {"savvy_scalar_output_complex2__impl", (DL_FUNC) &savvy_scalar_output_complex2__impl, 0}, {"savvy_scalar_output_int__impl", (DL_FUNC) &savvy_scalar_output_int__impl, 0}, {"savvy_scalar_output_int2__impl", (DL_FUNC) &savvy_scalar_output_int2__impl, 0}, - {"savvy_scalar_output_real__impl", (DL_FUNC) &savvy_scalar_output_real__impl, 0}, - {"savvy_scalar_output_real2__impl", (DL_FUNC) &savvy_scalar_output_real2__impl, 0}, {"savvy_scalar_output_logical__impl", (DL_FUNC) &savvy_scalar_output_logical__impl, 0}, {"savvy_scalar_output_logical2__impl", (DL_FUNC) &savvy_scalar_output_logical2__impl, 0}, + {"savvy_scalar_output_real__impl", (DL_FUNC) &savvy_scalar_output_real__impl, 0}, + {"savvy_scalar_output_real2__impl", (DL_FUNC) &savvy_scalar_output_real2__impl, 0}, {"savvy_scalar_output_string__impl", (DL_FUNC) &savvy_scalar_output_string__impl, 0}, {"savvy_scalar_output_string2__impl", (DL_FUNC) &savvy_scalar_output_string2__impl, 0}, - {"savvy_scalar_output_complex__impl", (DL_FUNC) &savvy_scalar_output_complex__impl, 0}, - {"savvy_scalar_output_complex2__impl", (DL_FUNC) &savvy_scalar_output_complex2__impl, 0}, + {"savvy_set_attr_int__impl", (DL_FUNC) &savvy_set_attr_int__impl, 2}, + {"savvy_set_class_int__impl", (DL_FUNC) &savvy_set_class_int__impl, 0}, + {"savvy_set_dim_int__impl", (DL_FUNC) &savvy_set_dim_int__impl, 0}, + {"savvy_set_name_external__impl", (DL_FUNC) &savvy_set_name_external__impl, 2}, + {"savvy_set_names_int__impl", (DL_FUNC) &savvy_set_names_int__impl, 0}, + {"savvy_set_var_in_env__impl", (DL_FUNC) &savvy_set_var_in_env__impl, 3}, {"savvy_sum_int__impl", (DL_FUNC) &savvy_sum_int__impl, 1}, {"savvy_sum_real__impl", (DL_FUNC) &savvy_sum_real__impl, 1}, - {"savvy_rep_int_vec__impl", (DL_FUNC) &savvy_rep_int_vec__impl, 1}, - {"savvy_rep_int_slice__impl", (DL_FUNC) &savvy_rep_int_slice__impl, 1}, - {"savvy_rep_real_vec__impl", (DL_FUNC) &savvy_rep_real_vec__impl, 1}, - {"savvy_rep_real_slice__impl", (DL_FUNC) &savvy_rep_real_slice__impl, 1}, - {"savvy_rep_bool_vec__impl", (DL_FUNC) &savvy_rep_bool_vec__impl, 1}, - {"savvy_rep_bool_slice__impl", (DL_FUNC) &savvy_rep_bool_slice__impl, 1}, - {"savvy_rep_str_vec__impl", (DL_FUNC) &savvy_rep_str_vec__impl, 1}, - {"savvy_rep_str_slice__impl", (DL_FUNC) &savvy_rep_str_slice__impl, 1}, - {"savvy_print_foo_enum__impl", (DL_FUNC) &savvy_print_foo_enum__impl, 1}, - {"savvy_print_foo_enum_ref__impl", (DL_FUNC) &savvy_print_foo_enum_ref__impl, 1}, - {"savvy_foo_a__impl", (DL_FUNC) &savvy_foo_a__impl, 0}, - {"savvy_get_var_in_env__impl", (DL_FUNC) &savvy_get_var_in_env__impl, 2}, - {"savvy_var_exists_in_env__impl", (DL_FUNC) &savvy_var_exists_in_env__impl, 2}, - {"savvy_set_var_in_env__impl", (DL_FUNC) &savvy_set_var_in_env__impl, 3}, - {"savvy_get_foo_value__impl", (DL_FUNC) &savvy_get_foo_value__impl, 0}, - {"savvy_safe_stop__impl", (DL_FUNC) &savvy_safe_stop__impl, 0}, - {"savvy_raise_error__impl", (DL_FUNC) &savvy_raise_error__impl, 0}, - {"savvy_must_panic__impl", (DL_FUNC) &savvy_must_panic__impl, 0}, - {"savvy_safe_warn__impl", (DL_FUNC) &savvy_safe_warn__impl, 0}, - {"savvy_error_conversion__impl", (DL_FUNC) &savvy_error_conversion__impl, 0}, - {"savvy_do_call__impl", (DL_FUNC) &savvy_do_call__impl, 2}, - {"savvy_call_with_args__impl", (DL_FUNC) &savvy_call_with_args__impl, 1}, - {"savvy_get_args__impl", (DL_FUNC) &savvy_get_args__impl, 1}, - {"savvy_new_int__impl", (DL_FUNC) &savvy_new_int__impl, 1}, - {"savvy_new_real__impl", (DL_FUNC) &savvy_new_real__impl, 1}, - {"savvy_new_bool__impl", (DL_FUNC) &savvy_new_bool__impl, 1}, + {"savvy_times_any_int__impl", (DL_FUNC) &savvy_times_any_int__impl, 2}, + {"savvy_times_any_real__impl", (DL_FUNC) &savvy_times_any_real__impl, 2}, + {"savvy_times_two_int__impl", (DL_FUNC) &savvy_times_two_int__impl, 1}, {"savvy_times_two_numeric_f64__impl", (DL_FUNC) &savvy_times_two_numeric_f64__impl, 1}, - {"savvy_times_two_numeric_i32__impl", (DL_FUNC) &savvy_times_two_numeric_i32__impl, 1}, - {"savvy_usize_to_string__impl", (DL_FUNC) &savvy_usize_to_string__impl, 1}, {"savvy_times_two_numeric_f64_scalar__impl", (DL_FUNC) &savvy_times_two_numeric_f64_scalar__impl, 1}, + {"savvy_times_two_numeric_i32__impl", (DL_FUNC) &savvy_times_two_numeric_i32__impl, 1}, {"savvy_times_two_numeric_i32_scalar__impl", (DL_FUNC) &savvy_times_two_numeric_i32_scalar__impl, 1}, + {"savvy_times_two_real__impl", (DL_FUNC) &savvy_times_two_real__impl, 1}, + {"savvy_to_upper__impl", (DL_FUNC) &savvy_to_upper__impl, 1}, + {"savvy_tweak_altint__impl", (DL_FUNC) &savvy_tweak_altint__impl, 1}, + {"savvy_tweak_altlist__impl", (DL_FUNC) &savvy_tweak_altlist__impl, 1}, + {"savvy_tweak_altlogical__impl", (DL_FUNC) &savvy_tweak_altlogical__impl, 1}, + {"savvy_tweak_altraw__impl", (DL_FUNC) &savvy_tweak_altraw__impl, 1}, + {"savvy_tweak_altreal__impl", (DL_FUNC) &savvy_tweak_altreal__impl, 1}, + {"savvy_tweak_altstring__impl", (DL_FUNC) &savvy_tweak_altstring__impl, 1}, + {"savvy_usize_to_string__impl", (DL_FUNC) &savvy_usize_to_string__impl, 1}, {"savvy_usize_to_string_scalar__impl", (DL_FUNC) &savvy_usize_to_string_scalar__impl, 1}, - {"savvy_print_numeric__impl", (DL_FUNC) &savvy_print_numeric__impl, 1}, - {"savvy_default_value_scalar__impl", (DL_FUNC) &savvy_default_value_scalar__impl, 1}, - {"savvy_default_value_vec__impl", (DL_FUNC) &savvy_default_value_vec__impl, 1}, - {"savvy_default_value_struct__impl", (DL_FUNC) &savvy_default_value_struct__impl, 1}, - {"savvy_default_value_enum__impl", (DL_FUNC) &savvy_default_value_enum__impl, 1}, - {"savvy_filter_integer_odd__impl", (DL_FUNC) &savvy_filter_integer_odd__impl, 1}, - {"savvy_filter_real_negative__impl", (DL_FUNC) &savvy_filter_real_negative__impl, 1}, - {"savvy_filter_complex_without_im__impl", (DL_FUNC) &savvy_filter_complex_without_im__impl, 1}, - {"savvy_filter_logical_duplicates__impl", (DL_FUNC) &savvy_filter_logical_duplicates__impl, 1}, - {"savvy_filter_string_ascii__impl", (DL_FUNC) &savvy_filter_string_ascii__impl, 1}, - {"savvy_fn__impl", (DL_FUNC) &savvy_fn__impl, 1}, - {"savvy_fun_mod1__impl", (DL_FUNC) &savvy_fun_mod1__impl, 0}, - {"savvy_fun_mod1_1_foo__impl", (DL_FUNC) &savvy_fun_mod1_1_foo__impl, 0}, + {"savvy_var_exists_in_env__impl", (DL_FUNC) &savvy_var_exists_in_env__impl, 2}, {"savvy_FooEnum_print__impl", (DL_FUNC) &savvy_FooEnum_print__impl, 1}, - {"savvy_FooWithDefault_new__impl", (DL_FUNC) &savvy_FooWithDefault_new__impl, 1}, - {"savvy_FooWithDefault_default_value_method__impl", (DL_FUNC) &savvy_FooWithDefault_default_value_method__impl, 2}, {"savvy_FooWithDefault_default_value_associated_fn__impl", (DL_FUNC) &savvy_FooWithDefault_default_value_associated_fn__impl, 1}, + {"savvy_FooWithDefault_default_value_method__impl", (DL_FUNC) &savvy_FooWithDefault_default_value_method__impl, 2}, + {"savvy_FooWithDefault_new__impl", (DL_FUNC) &savvy_FooWithDefault_new__impl, 1}, + {"savvy_Person_another_person__impl", (DL_FUNC) &savvy_Person_another_person__impl, 1}, + {"savvy_Person_associated_function__impl", (DL_FUNC) &savvy_Person_associated_function__impl, 0}, + {"savvy_Person_name__impl", (DL_FUNC) &savvy_Person_name__impl, 1}, {"savvy_Person_new__impl", (DL_FUNC) &savvy_Person_new__impl, 0}, {"savvy_Person_new2__impl", (DL_FUNC) &savvy_Person_new2__impl, 0}, {"savvy_Person_new_fallible__impl", (DL_FUNC) &savvy_Person_new_fallible__impl, 0}, - {"savvy_Person_another_person__impl", (DL_FUNC) &savvy_Person_another_person__impl, 1}, {"savvy_Person_new_with_name__impl", (DL_FUNC) &savvy_Person_new_with_name__impl, 1}, {"savvy_Person_set_name__impl", (DL_FUNC) &savvy_Person_set_name__impl, 2}, - {"savvy_Person_name__impl", (DL_FUNC) &savvy_Person_name__impl, 1}, - {"savvy_Person_associated_function__impl", (DL_FUNC) &savvy_Person_associated_function__impl, 0}, {"savvy_Person2_name__impl", (DL_FUNC) &savvy_Person2_name__impl, 1}, - {"savvy_Value_new__impl", (DL_FUNC) &savvy_Value_new__impl, 1}, - {"savvy_Value_pair__impl", (DL_FUNC) &savvy_Value_pair__impl, 2}, + {"savvy_StructWithConfig_new_associated_fn__impl", (DL_FUNC) &savvy_StructWithConfig_new_associated_fn__impl, 1}, + {"savvy_StructWithConfig_new_method__impl", (DL_FUNC) &savvy_StructWithConfig_new_method__impl, 2}, {"savvy_Value_get__impl", (DL_FUNC) &savvy_Value_get__impl, 1}, {"savvy_Value_get2__impl", (DL_FUNC) &savvy_Value_get2__impl, 1}, + {"savvy_Value_new__impl", (DL_FUNC) &savvy_Value_new__impl, 1}, + {"savvy_Value_pair__impl", (DL_FUNC) &savvy_Value_pair__impl, 2}, {"savvy_ValuePair_new__impl", (DL_FUNC) &savvy_ValuePair_new__impl, 2}, {"savvy_ValuePair_new_copy__impl", (DL_FUNC) &savvy_ValuePair_new_copy__impl, 2}, {"savvy_ValuePair_print__impl", (DL_FUNC) &savvy_ValuePair_print__impl, 1}, - {"savvy_struct_new__impl", (DL_FUNC) &savvy_struct_new__impl, 0}, {"savvy_struct_fn__impl", (DL_FUNC) &savvy_struct_fn__impl, 1}, + {"savvy_struct_new__impl", (DL_FUNC) &savvy_struct_new__impl, 0}, {NULL, NULL, 0} }; diff --git a/R-package/src/rust/api.h b/R-package/src/rust/api.h index 13c5c52..d18e065 100644 --- a/R-package/src/rust/api.h +++ b/R-package/src/rust/api.h @@ -1,119 +1,120 @@ -SEXP savvy_is_built_with_debug__ffi(void); -SEXP savvy_to_upper__ffi(SEXP c_arg__x); +SEXP savvy_abs_complex__ffi(SEXP c_arg__x); SEXP savvy_add_suffix__ffi(SEXP c_arg__x, SEXP c_arg__y); -SEXP savvy_times_two_int__ffi(SEXP c_arg__x); -SEXP savvy_times_any_int__ffi(SEXP c_arg__x, SEXP c_arg__y); -SEXP savvy_times_two_real__ffi(SEXP c_arg__x); -SEXP savvy_times_any_real__ffi(SEXP c_arg__x, SEXP c_arg__y); -SEXP savvy_flip_logical__ffi(SEXP c_arg__x); -SEXP savvy_flip_logical_expert_only__ffi(SEXP c_arg__x); -SEXP savvy_or_logical__ffi(SEXP c_arg__x, SEXP c_arg__y); -SEXP savvy_reverse_bits__ffi(SEXP c_arg__x); -SEXP savvy_reverse_bit_scalar__ffi(SEXP c_arg__x); -SEXP savvy_print_list__ffi(SEXP c_arg__x); -SEXP savvy_list_with_no_values__ffi(void); -SEXP savvy_list_with_no_names__ffi(void); -SEXP savvy_list_with_names_and_values__ffi(void); -SEXP savvy_external_person_new__ffi(void); -SEXP savvy_get_name_external__ffi(SEXP c_arg__x); -SEXP savvy_set_name_external__ffi(SEXP c_arg__x, SEXP c_arg__name); SEXP savvy_altint__ffi(void); -SEXP savvy_print_altint__ffi(SEXP c_arg__x); -SEXP savvy_tweak_altint__ffi(SEXP c_arg__x); -SEXP savvy_altreal__ffi(void); -SEXP savvy_print_altreal__ffi(SEXP c_arg__x); -SEXP savvy_tweak_altreal__ffi(SEXP c_arg__x); +SEXP savvy_altlist__ffi(void); SEXP savvy_altlogical__ffi(void); -SEXP savvy_print_altlogical__ffi(SEXP c_arg__x); -SEXP savvy_tweak_altlogical__ffi(SEXP c_arg__x); SEXP savvy_altraw__ffi(void); -SEXP savvy_print_altraw__ffi(SEXP c_arg__x); -SEXP savvy_tweak_altraw__ffi(SEXP c_arg__x); +SEXP savvy_altreal__ffi(void); SEXP savvy_altstring__ffi(void); -SEXP savvy_print_altstring__ffi(SEXP c_arg__x); -SEXP savvy_tweak_altstring__ffi(SEXP c_arg__x); -SEXP savvy_altlist__ffi(void); -SEXP savvy_print_altlist__ffi(SEXP c_arg__x); -SEXP savvy_tweak_altlist__ffi(SEXP c_arg__x); -SEXP savvy_init_altrep_class__ffi(DllInfo* c_arg__dll_info); +SEXP savvy_call_with_args__ffi(SEXP c_arg__fun); +SEXP savvy_default_value_enum__ffi(SEXP c_arg__x); +SEXP savvy_default_value_scalar__ffi(SEXP c_arg__x); +SEXP savvy_default_value_struct__ffi(SEXP c_arg__x); +SEXP savvy_default_value_vec__ffi(SEXP c_arg__x); +SEXP savvy_do_call__ffi(SEXP c_arg__fun, SEXP c_arg__args); +SEXP savvy_error_conversion__ffi(void); +SEXP savvy_external_person_new__ffi(void); +SEXP savvy_filter_complex_without_im__ffi(SEXP c_arg__x); +SEXP savvy_filter_integer_odd__ffi(SEXP c_arg__x); +SEXP savvy_filter_logical_duplicates__ffi(SEXP c_arg__x); +SEXP savvy_filter_real_negative__ffi(SEXP c_arg__x); +SEXP savvy_filter_string_ascii__ffi(SEXP c_arg__x); +SEXP savvy_first_complex__ffi(SEXP c_arg__x); +SEXP savvy_flip_logical__ffi(SEXP c_arg__x); +SEXP savvy_flip_logical_expert_only__ffi(SEXP c_arg__x); +SEXP savvy_fn_w_cfg__ffi(SEXP c_arg__x); +SEXP savvy_foo_a__ffi(void); +SEXP savvy_fun_mod1__ffi(void); +SEXP savvy_fun_mod1_1_foo__ffi(void); SEXP savvy_get_altrep_class_name__ffi(SEXP c_arg__x); SEXP savvy_get_altrep_package_name__ffi(SEXP c_arg__x); -SEXP savvy_print_altint_by_weird_way__ffi(SEXP c_arg__x); +SEXP savvy_get_args__ffi(SEXP c_arg__args); +SEXP savvy_get_attr_int__ffi(SEXP c_arg__x, SEXP c_arg__attr); SEXP savvy_get_class_int__ffi(SEXP c_arg__x); -SEXP savvy_get_names_int__ffi(SEXP c_arg__x); SEXP savvy_get_dim_int__ffi(SEXP c_arg__x); -SEXP savvy_get_attr_int__ffi(SEXP c_arg__x, SEXP c_arg__attr); -SEXP savvy_set_class_int__ffi(void); -SEXP savvy_set_names_int__ffi(void); -SEXP savvy_set_dim_int__ffi(void); -SEXP savvy_set_attr_int__ffi(SEXP c_arg__attr, SEXP c_arg__value); +SEXP savvy_get_foo_value__ffi(void); +SEXP savvy_get_name_external__ffi(SEXP c_arg__x); +SEXP savvy_get_names_int__ffi(SEXP c_arg__x); +SEXP savvy_get_var_in_env__ffi(SEXP c_arg__name, SEXP c_arg__env); +SEXP savvy_init_altrep_class__ffi(DllInfo* c_arg__dll_info); +SEXP savvy_init_foo_value__ffi(DllInfo* c_arg__dll); +SEXP savvy_init_logger__ffi(DllInfo* c_arg__dll_info); +SEXP savvy_is_built_with_debug__ffi(void); +SEXP savvy_list_with_names_and_values__ffi(void); +SEXP savvy_list_with_no_names__ffi(void); +SEXP savvy_list_with_no_values__ffi(void); +SEXP savvy_must_panic__ffi(void); +SEXP savvy_new_bool__ffi(SEXP c_arg__size); SEXP savvy_new_complex__ffi(SEXP c_arg__size); -SEXP savvy_first_complex__ffi(SEXP c_arg__x); -SEXP savvy_abs_complex__ffi(SEXP c_arg__x); +SEXP savvy_new_int__ffi(SEXP c_arg__size); +SEXP savvy_new_real__ffi(SEXP c_arg__size); SEXP savvy_new_value_pair__ffi(SEXP c_arg__a, SEXP c_arg__b); +SEXP savvy_or_logical__ffi(SEXP c_arg__x, SEXP c_arg__y); +SEXP savvy_print_altint__ffi(SEXP c_arg__x); +SEXP savvy_print_altint_by_weird_way__ffi(SEXP c_arg__x); +SEXP savvy_print_altlist__ffi(SEXP c_arg__x); +SEXP savvy_print_altlogical__ffi(SEXP c_arg__x); +SEXP savvy_print_altraw__ffi(SEXP c_arg__x); +SEXP savvy_print_altreal__ffi(SEXP c_arg__x); +SEXP savvy_print_altstring__ffi(SEXP c_arg__x); +SEXP savvy_print_foo_enum__ffi(SEXP c_arg__x); +SEXP savvy_print_foo_enum_ref__ffi(SEXP c_arg__x); +SEXP savvy_print_list__ffi(SEXP c_arg__x); +SEXP savvy_print_numeric__ffi(SEXP c_arg__x); +SEXP savvy_fn__ffi(SEXP c_arg__struct); +SEXP savvy_raise_error__ffi(void); +SEXP savvy_rep_bool_slice__ffi(SEXP c_arg__x); +SEXP savvy_rep_bool_vec__ffi(SEXP c_arg__x); +SEXP savvy_rep_int_slice__ffi(SEXP c_arg__x); +SEXP savvy_rep_int_vec__ffi(SEXP c_arg__x); +SEXP savvy_rep_real_slice__ffi(SEXP c_arg__x); +SEXP savvy_rep_real_vec__ffi(SEXP c_arg__x); +SEXP savvy_rep_str_slice__ffi(SEXP c_arg__x); +SEXP savvy_rep_str_vec__ffi(SEXP c_arg__x); +SEXP savvy_reverse_bit_scalar__ffi(SEXP c_arg__x); +SEXP savvy_reverse_bits__ffi(SEXP c_arg__x); +SEXP savvy_safe_stop__ffi(void); +SEXP savvy_safe_warn__ffi(void); SEXP savvy_scalar_input_int__ffi(SEXP c_arg__x); -SEXP savvy_scalar_input_real__ffi(SEXP c_arg__x); SEXP savvy_scalar_input_logical__ffi(SEXP c_arg__x); +SEXP savvy_scalar_input_real__ffi(SEXP c_arg__x); SEXP savvy_scalar_input_string__ffi(SEXP c_arg__x); +SEXP savvy_scalar_output_complex__ffi(void); +SEXP savvy_scalar_output_complex2__ffi(void); SEXP savvy_scalar_output_int__ffi(void); SEXP savvy_scalar_output_int2__ffi(void); -SEXP savvy_scalar_output_real__ffi(void); -SEXP savvy_scalar_output_real2__ffi(void); SEXP savvy_scalar_output_logical__ffi(void); SEXP savvy_scalar_output_logical2__ffi(void); +SEXP savvy_scalar_output_real__ffi(void); +SEXP savvy_scalar_output_real2__ffi(void); SEXP savvy_scalar_output_string__ffi(void); SEXP savvy_scalar_output_string2__ffi(void); -SEXP savvy_scalar_output_complex__ffi(void); -SEXP savvy_scalar_output_complex2__ffi(void); +SEXP savvy_set_attr_int__ffi(SEXP c_arg__attr, SEXP c_arg__value); +SEXP savvy_set_class_int__ffi(void); +SEXP savvy_set_dim_int__ffi(void); +SEXP savvy_set_name_external__ffi(SEXP c_arg__x, SEXP c_arg__name); +SEXP savvy_set_names_int__ffi(void); +SEXP savvy_set_var_in_env__ffi(SEXP c_arg__name, SEXP c_arg__value, SEXP c_arg__env); SEXP savvy_sum_int__ffi(SEXP c_arg__x); SEXP savvy_sum_real__ffi(SEXP c_arg__x); -SEXP savvy_rep_int_vec__ffi(SEXP c_arg__x); -SEXP savvy_rep_int_slice__ffi(SEXP c_arg__x); -SEXP savvy_rep_real_vec__ffi(SEXP c_arg__x); -SEXP savvy_rep_real_slice__ffi(SEXP c_arg__x); -SEXP savvy_rep_bool_vec__ffi(SEXP c_arg__x); -SEXP savvy_rep_bool_slice__ffi(SEXP c_arg__x); -SEXP savvy_rep_str_vec__ffi(SEXP c_arg__x); -SEXP savvy_rep_str_slice__ffi(SEXP c_arg__x); -SEXP savvy_print_foo_enum__ffi(SEXP c_arg__x); -SEXP savvy_print_foo_enum_ref__ffi(SEXP c_arg__x); -SEXP savvy_foo_a__ffi(void); -SEXP savvy_get_var_in_env__ffi(SEXP c_arg__name, SEXP c_arg__env); -SEXP savvy_var_exists_in_env__ffi(SEXP c_arg__name, SEXP c_arg__env); -SEXP savvy_set_var_in_env__ffi(SEXP c_arg__name, SEXP c_arg__value, SEXP c_arg__env); -SEXP savvy_init_foo_value__ffi(DllInfo* c_arg__dll); -SEXP savvy_get_foo_value__ffi(void); -SEXP savvy_safe_stop__ffi(void); -SEXP savvy_raise_error__ffi(void); -SEXP savvy_must_panic__ffi(void); -SEXP savvy_safe_warn__ffi(void); -SEXP savvy_error_conversion__ffi(void); -SEXP savvy_do_call__ffi(SEXP c_arg__fun, SEXP c_arg__args); -SEXP savvy_call_with_args__ffi(SEXP c_arg__fun); -SEXP savvy_get_args__ffi(SEXP c_arg__args); -SEXP savvy_new_int__ffi(SEXP c_arg__size); -SEXP savvy_new_real__ffi(SEXP c_arg__size); -SEXP savvy_new_bool__ffi(SEXP c_arg__size); +SEXP savvy_times_any_int__ffi(SEXP c_arg__x, SEXP c_arg__y); +SEXP savvy_times_any_real__ffi(SEXP c_arg__x, SEXP c_arg__y); +SEXP savvy_times_two_int__ffi(SEXP c_arg__x); SEXP savvy_times_two_numeric_f64__ffi(SEXP c_arg__x); -SEXP savvy_times_two_numeric_i32__ffi(SEXP c_arg__x); -SEXP savvy_usize_to_string__ffi(SEXP c_arg__x); SEXP savvy_times_two_numeric_f64_scalar__ffi(SEXP c_arg__x); +SEXP savvy_times_two_numeric_i32__ffi(SEXP c_arg__x); SEXP savvy_times_two_numeric_i32_scalar__ffi(SEXP c_arg__x); +SEXP savvy_times_two_real__ffi(SEXP c_arg__x); +SEXP savvy_to_upper__ffi(SEXP c_arg__x); +SEXP savvy_tweak_altint__ffi(SEXP c_arg__x); +SEXP savvy_tweak_altlist__ffi(SEXP c_arg__x); +SEXP savvy_tweak_altlogical__ffi(SEXP c_arg__x); +SEXP savvy_tweak_altraw__ffi(SEXP c_arg__x); +SEXP savvy_tweak_altreal__ffi(SEXP c_arg__x); +SEXP savvy_tweak_altstring__ffi(SEXP c_arg__x); +SEXP savvy_usize_to_string__ffi(SEXP c_arg__x); SEXP savvy_usize_to_string_scalar__ffi(SEXP c_arg__x); -SEXP savvy_print_numeric__ffi(SEXP c_arg__x); -SEXP savvy_default_value_scalar__ffi(SEXP c_arg__x); -SEXP savvy_default_value_vec__ffi(SEXP c_arg__x); -SEXP savvy_default_value_struct__ffi(SEXP c_arg__x); -SEXP savvy_default_value_enum__ffi(SEXP c_arg__x); -SEXP savvy_filter_integer_odd__ffi(SEXP c_arg__x); -SEXP savvy_filter_real_negative__ffi(SEXP c_arg__x); -SEXP savvy_filter_complex_without_im__ffi(SEXP c_arg__x); -SEXP savvy_filter_logical_duplicates__ffi(SEXP c_arg__x); -SEXP savvy_filter_string_ascii__ffi(SEXP c_arg__x); -SEXP savvy_fn__ffi(SEXP c_arg__struct); -SEXP savvy_fun_mod1__ffi(void); -SEXP savvy_init_logger__ffi(DllInfo* c_arg__dll_info); -SEXP savvy_fun_mod1_1_foo__ffi(void); +SEXP savvy_var_exists_in_env__ffi(SEXP c_arg__name, SEXP c_arg__env); // methods and associated functions for Enum @@ -122,28 +123,32 @@ SEXP savvy_fun_mod1_1_foo__ffi(void); SEXP savvy_FooEnum_print__ffi(SEXP self__); // methods and associated functions for FooWithDefault -SEXP savvy_FooWithDefault_new__ffi(SEXP c_arg__default_value); -SEXP savvy_FooWithDefault_default_value_method__ffi(SEXP self__, SEXP c_arg__x); SEXP savvy_FooWithDefault_default_value_associated_fn__ffi(SEXP c_arg__x); +SEXP savvy_FooWithDefault_default_value_method__ffi(SEXP self__, SEXP c_arg__x); +SEXP savvy_FooWithDefault_new__ffi(SEXP c_arg__default_value); // methods and associated functions for Person +SEXP savvy_Person_another_person__ffi(SEXP self__); +SEXP savvy_Person_associated_function__ffi(void); +SEXP savvy_Person_name__ffi(SEXP self__); SEXP savvy_Person_new__ffi(void); SEXP savvy_Person_new2__ffi(void); SEXP savvy_Person_new_fallible__ffi(void); -SEXP savvy_Person_another_person__ffi(SEXP self__); SEXP savvy_Person_new_with_name__ffi(SEXP c_arg__name); SEXP savvy_Person_set_name__ffi(SEXP self__, SEXP c_arg__name); -SEXP savvy_Person_name__ffi(SEXP self__); -SEXP savvy_Person_associated_function__ffi(void); // methods and associated functions for Person2 SEXP savvy_Person2_name__ffi(SEXP self__); +// methods and associated functions for StructWithConfig +SEXP savvy_StructWithConfig_new_associated_fn__ffi(SEXP c_arg__x); +SEXP savvy_StructWithConfig_new_method__ffi(SEXP self__, SEXP c_arg__x); + // methods and associated functions for Value -SEXP savvy_Value_new__ffi(SEXP c_arg__x); -SEXP savvy_Value_pair__ffi(SEXP self__, SEXP c_arg__b); SEXP savvy_Value_get__ffi(SEXP self__); SEXP savvy_Value_get2__ffi(SEXP self__); +SEXP savvy_Value_new__ffi(SEXP c_arg__x); +SEXP savvy_Value_pair__ffi(SEXP self__, SEXP c_arg__b); // methods and associated functions for ValuePair SEXP savvy_ValuePair_new__ffi(SEXP c_arg__a, SEXP c_arg__b); @@ -151,5 +156,5 @@ SEXP savvy_ValuePair_new_copy__ffi(SEXP c_arg__a, SEXP c_arg__b); SEXP savvy_ValuePair_print__ffi(SEXP self__); // methods and associated functions for r#struct -SEXP savvy_struct_new__ffi(void); -SEXP savvy_struct_fn__ffi(SEXP c_arg__fn); \ No newline at end of file +SEXP savvy_struct_fn__ffi(SEXP c_arg__fn); +SEXP savvy_struct_new__ffi(void); \ No newline at end of file diff --git a/R-package/src/rust/src/lib.rs b/R-package/src/rust/src/lib.rs index b515579..dab6d51 100644 --- a/R-package/src/rust/src/lib.rs +++ b/R-package/src/rust/src/lib.rs @@ -10,6 +10,7 @@ mod environment; mod error_handling; mod function; mod init_vectors; +mod multiple_defs; mod numeric; mod optional_arg; mod try_from_iter; diff --git a/R-package/src/rust/src/multiple_defs.rs b/R-package/src/rust/src/multiple_defs.rs new file mode 100644 index 0000000..a6b0af1 --- /dev/null +++ b/R-package/src/rust/src/multiple_defs.rs @@ -0,0 +1,41 @@ +// This file is to check if savvy-cli can handle multiple definitions. + +use savvy::savvy; + +#[savvy] +#[cfg(target_os = "windows")] +fn fn_w_cfg(x: savvy::Sexp) -> savvy::Result<()> { + Ok(()) +} + +#[savvy] +#[cfg(not(target_os = "windows"))] +fn fn_w_cfg(x: savvy::Sexp) -> savvy::Result<()> { + Ok(()) +} + +#[savvy] +struct StructWithConfig(i32); + +#[savvy] +impl StructWithConfig { + #[cfg(target_os = "windows")] + fn new_method(&self, x: i32) -> savvy::Result { + Ok(Self(x)) + } + + #[cfg(not(target_os = "windows"))] + fn new_method(&self, x: i32) -> savvy::Result { + Ok(Self(x * 2)) + } + + #[cfg(target_os = "windows")] + fn new_associated_fn(x: i32) -> savvy::Result { + Ok(Self(x)) + } + + #[cfg(not(target_os = "windows"))] + fn new_associated_fn(x: i32) -> savvy::Result { + Ok(Self(x * 2)) + } +} diff --git a/savvy-bindgen/src/gen/rust.rs b/savvy-bindgen/src/gen/rust.rs index 61be019..3fafa8c 100644 --- a/savvy-bindgen/src/gen/rust.rs +++ b/savvy-bindgen/src/gen/rust.rs @@ -141,6 +141,8 @@ impl SavvyFn { .map(|arg| arg.to_rust_type_inner()) .collect(); + let attrs = &self.attrs; + let (ok_lhs, ok_rhs, wrapped_with_result): (syn::Expr, syn::Expr, bool) = match &self.return_type { SavvyFnReturnType::Unit(_) => ( @@ -171,6 +173,7 @@ impl SavvyFn { // `-> Self` is allowed if wrapped_with_result { parse_quote!( + #(#attrs)* #[allow(clippy::missing_safety_doc)] #[no_mangle] pub unsafe extern "C" fn #fn_name_ffi(self__: savvy::ffi::SEXP, #(#args_pat: #args_ty),* ) -> savvy::ffi::SEXP { @@ -182,6 +185,7 @@ impl SavvyFn { ) } else { parse_quote!( + #(#attrs)* #[allow(clippy::missing_safety_doc)] #[no_mangle] pub unsafe extern "C" fn #fn_name_ffi(self__: savvy::ffi::SEXP, #(#args_pat: #args_ty),* ) -> savvy::ffi::SEXP { @@ -191,6 +195,7 @@ impl SavvyFn { } } _ => parse_quote!( + #(#attrs)* #[allow(clippy::missing_safety_doc)] #[no_mangle] pub unsafe extern "C" fn #fn_name_ffi( #(#args_pat: #args_ty),* ) -> savvy::ffi::SEXP { diff --git a/savvy-bindgen/src/ir/mod.rs b/savvy-bindgen/src/ir/mod.rs index cea2ea6..e6517aa 100644 --- a/savvy-bindgen/src/ir/mod.rs +++ b/savvy-bindgen/src/ir/mod.rs @@ -43,7 +43,24 @@ pub struct MergedResult { pub enums: Vec, } -pub fn merge_parsed_results(results: Vec) -> MergedResult { +#[derive(Debug, Clone)] +pub enum SavvyParseError { + ConflictingDefinitions(syn::Ident), +} + +impl std::fmt::Display for SavvyParseError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + SavvyParseError::ConflictingDefinitions(ident) => { + write!(f, "Different definitions are found for fn `{ident}`") + } + } + } +} + +pub fn merge_parsed_results( + results: Vec, +) -> Result> { let mut bare_fns: Vec = Vec::new(); let mut impl_map: HashMap = HashMap::new(); let mut enums: Vec = Vec::new(); @@ -118,9 +135,69 @@ pub fn merge_parsed_results(results: Vec) -> MergedResult { // in order to make the wrapper generation deterministic, sort by the type impls.sort_by_key(|(k, _)| k.clone()); - MergedResult { - bare_fns, - impls, - enums, + let mut parse_errors: Vec = Vec::new(); + + // validate bare functions + let bare_fns = match remove_duplicated_fns(&bare_fns) { + Ok(fns) => fns, + Err(mut e) => { + parse_errors.append(&mut e); + Vec::new() + } + }; + + // validate impl functions + for (_, merged) in impls.iter_mut() { + merged.fns = match remove_duplicated_fns(&merged.fns) { + Ok(fns) => fns, + Err(mut e) => { + parse_errors.append(&mut e); + Vec::new() + } + }; + } + + if parse_errors.is_empty() { + Ok(MergedResult { + bare_fns, + impls, + enums, + }) + } else { + Err(parse_errors) + } +} + +fn remove_duplicated_fns(fns: &[SavvyFn]) -> Result, Vec> { + let mut fn_map: HashMap = HashMap::new(); + let mut parse_errors: Vec = Vec::new(); + + for f in fns { + match fn_map.get(&f.fn_name) { + // If there's already the same name of the function, check if the signatures match. + Some(f_entry) => { + let args1 = &f.args; + let args2 = &f_entry.args; + if args1.len() == args2.len() + && args1.iter().zip(args2.iter()).all(|(a1, a2)| a1 == a2) + { + // do nothing if these share the same signature + } else { + // raise an error if the signatures differ + parse_errors.push(SavvyParseError::ConflictingDefinitions(f.fn_name.clone())); + } + } + None => { + fn_map.insert(f.fn_name.clone(), f.clone()); + } + } + } + + if parse_errors.is_empty() { + let mut fns: Vec = fn_map.into_values().collect(); + fns.sort_by_key(|f| f.fn_name.clone()); // make the order deterministic + Ok(fns) + } else { + Err(parse_errors) } } diff --git a/savvy-bindgen/src/ir/savvy_fn.rs b/savvy-bindgen/src/ir/savvy_fn.rs index 469871f..1d714c4 100644 --- a/savvy-bindgen/src/ir/savvy_fn.rs +++ b/savvy-bindgen/src/ir/savvy_fn.rs @@ -4,6 +4,7 @@ use syn::{ext::IdentExt, parse_quote, Attribute, FnArg::Typed, Pat::Ident, PatTy use crate::utils::extract_docs; +#[derive(Clone, PartialEq)] enum SavvyInputTypeCategory { Sexp, SexpWrapper, @@ -13,6 +14,7 @@ enum SavvyInputTypeCategory { DllInfo, } +#[derive(Clone)] struct SavvyInputType { category: SavvyInputTypeCategory, ty_orig: syn::Type, @@ -196,6 +198,7 @@ impl SavvyInputType { } } +#[derive(Clone)] pub struct SavvyFnArg { pub(crate) pat: syn::Ident, ty: SavvyInputType, @@ -234,11 +237,18 @@ impl SavvyFnArg { } } +impl PartialEq for SavvyFnArg { + fn eq(&self, other: &Self) -> bool { + self.pat == other.pat && self.ty.category == other.ty.category && self.ty.ty_str == other.ty.ty_str && self.ty.optional == other.ty.optional + } +} + /// Return type of a user-defined struct. This can be either /// /// - `savvy::Result` /// - `savvy::Result` /// - `Self` +#[derive(Clone)] pub struct UserDefinedStructReturnType { pub(crate) ty: syn::Ident, pub(crate) return_type: syn::ReturnType, @@ -253,6 +263,7 @@ pub struct UserDefinedStructReturnType { /// - `savvy::Result` /// - `savvy::Result` /// - `Self` +#[derive(Clone)] pub enum SavvyFnReturnType { Sexp(syn::ReturnType), Unit(syn::ReturnType), @@ -269,6 +280,7 @@ impl SavvyFnReturnType { } } +#[derive(Clone)] pub enum SavvyFnType { /// A function that doesn't belong to a struct BareFunction, @@ -286,6 +298,7 @@ pub enum SavvyFnType { InitFunction, } +#[derive(Clone)] pub struct SavvyFn { /// Doc comments pub docs: Vec, diff --git a/savvy-cli/Cargo.toml b/savvy-cli/Cargo.toml index 44f29fb..f2097ce 100644 --- a/savvy-cli/Cargo.toml +++ b/savvy-cli/Cargo.toml @@ -19,7 +19,7 @@ clap = { version = "4", features = ["derive"] } async-process = "2" futures-lite = "2" -savvy-bindgen = { version = "0.8.2", path = "../savvy-bindgen", features = [ +savvy-bindgen = { version = "0.8.3-rc.4", path = "../savvy-bindgen", features = [ "use_formatter", ] } dirs = "5" diff --git a/savvy-cli/src/main.rs b/savvy-cli/src/main.rs index 5e7fbfc..cf0dfca 100644 --- a/savvy-cli/src/main.rs +++ b/savvy-cli/src/main.rs @@ -318,7 +318,18 @@ fn update(path: &Path) { let parsed = parse_crate(&lib_rs, &manifest.crate_name); - let merged = merge_parsed_results(parsed); + let merged = match merge_parsed_results(parsed) { + Ok(merged) => merged, + Err(parse_errors) => { + let details = parse_errors + .iter() + .map(|e| format!(" - {e}")) + .collect::>() + .join("\n"); + + panic!("Failed to parse files:\n{details}"); + } + }; write_file(&path.join(PATH_C_HEADER), &generate_c_header_file(&merged)); write_file( diff --git a/savvy-macro/Cargo.toml b/savvy-macro/Cargo.toml index 15e7b05..a8a91b4 100644 --- a/savvy-macro/Cargo.toml +++ b/savvy-macro/Cargo.toml @@ -17,7 +17,7 @@ proc-macro2 = "1" quote = "1" syn = { version = "2", features = ["full", "extra-traits"] } -savvy-bindgen = { version = "0.8.2", path = "../savvy-bindgen" } +savvy-bindgen = { version = "0.8.3-rc.4", path = "../savvy-bindgen" } [dev-dependencies] trybuild = "1"