diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 466ff80c..b907a0c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -227,15 +227,56 @@ jobs: with: name: generated_binding-${{ matrix.config.os }}-R-${{ matrix.config.r }}-rust-${{ matrix.config.rust-version }}-${{ matrix.config.target || 'default'}} path: generated_bindings + + check_generate_bindings_flag: + name: Check if [generate bindings] is in latest commit message + runs-on: ubuntu-latest + outputs: + head_commit_message: ${{ steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE }} + # generate_bindings: ${{ contains(steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE, '[generate bindings]') }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + - name: Get Head Commit Message + id: get_head_commit_message + run: echo "HEAD_COMMIT_MESSAGE=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" + - name: Show commit message + run: | + echo "${{ steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE }}" + echo "${{ contains(steps.get_head_commit_message.outputs.HEAD_COMMIT_MESSAGE, '[generate bindings]') }}" + + pr_generated_bindings: + name: Make PR with generated bindings + needs: [test_with_bindgen, check_generate_bindings_flag] + if: ${{ contains(needs.check_generate_bindings_flag.outputs.head_commit_message, '[generate bindings]') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + - uses: actions/download-artifact@v3 - # Run tests again using different bindings - - name: Run tests on precomputed bindings shipped with libR-sys - if: matrix.config.skip-tests != 'true' - run: | - . ./ci-cargo.ps1 - ci-cargo test -vv $(if ($env:RUST_TARGET -ne '') {"--target=$env:RUST_TARGET"} ) '--' --nocapture -ActionName "Running tests for target: $env:RUST_TARGET" - env: - RUST_TARGET: ${{ matrix.config.target }} + - name: Update bindings + run: | + # Update or add the bindings + cp generated_binding-*/*.rs bindings/ + + # Replace the default bindings + cd bindings + for x in linux-aarch64 linux-x86_64 macos-aarch64 macos-x86_64 windows-x86_64; do + # Choose the newest version except for devel + ln --force -s "$(ls -1 ./bindings-${x}-*.rs | grep -v devel | sort | tail -1)" ./bindings-${x}.rs + done + cd .. + - name: Add generated bindings + run: | + git add bindings/ + git config --local user.name "${GITHUB_ACTOR}" + git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com" + git commit -m "Update bindings [skip ci]" + - name: Push to PR branch + run: git push # Gather the generated bindings and push them to generated_bindings branch. # If we need to update the bindings, create a pull request from that branch. diff --git a/MAINTAINERS_GUIDE.md b/MAINTAINERS_GUIDE.md index 8407a1b3..ea8db306 100644 --- a/MAINTAINERS_GUIDE.md +++ b/MAINTAINERS_GUIDE.md @@ -1,3 +1,17 @@ +# GUIDE + +## Commit newly generated bindings + +Your last commit must contain `[generate bindings]`. You can make an empty +commit with this message: + +```sh +git commit -m "[generate bindings]" --allow-empty +``` + +Then after successfully running workflows, GitHub Actions will push a commit +with the updated bindings onto your PR branch. + ## Precomputed bindings ### How to update the precomputed bindings? diff --git a/bindings/bindings-linux-aarch64-R4.4-devel.rs b/bindings/bindings-linux-aarch64-R4.4-devel.rs index 6b55142c..0caaa26c 100644 --- a/bindings/bindings-linux-aarch64-R4.4-devel.rs +++ b/bindings/bindings-linux-aarch64-R4.4-devel.rs @@ -164,8 +164,8 @@ pub const R_MINOR: &[u8; 4] = b"4.0\0"; pub const R_STATUS: &[u8; 29] = b"Under development (unstable)\0"; pub const R_YEAR: &[u8; 5] = b"2023\0"; pub const R_MONTH: &[u8; 3] = b"11\0"; -pub const R_DAY: &[u8; 3] = b"11\0"; -pub const R_SVN_REVISION: u32 = 85510; +pub const R_DAY: &[u8; 3] = b"16\0"; +pub const R_SVN_REVISION: u32 = 85542; pub const R_GE_definitions: u32 = 13; pub const R_GE_deviceClip: u32 = 14; pub const R_GE_group: u32 = 15; diff --git a/bindings/bindings-linux-x86_64-R4.4-devel.rs b/bindings/bindings-linux-x86_64-R4.4-devel.rs index 12c3b953..a3892864 100644 --- a/bindings/bindings-linux-x86_64-R4.4-devel.rs +++ b/bindings/bindings-linux-x86_64-R4.4-devel.rs @@ -164,8 +164,8 @@ pub const R_MINOR: &[u8; 4] = b"4.0\0"; pub const R_STATUS: &[u8; 29] = b"Under development (unstable)\0"; pub const R_YEAR: &[u8; 5] = b"2023\0"; pub const R_MONTH: &[u8; 3] = b"11\0"; -pub const R_DAY: &[u8; 3] = b"11\0"; -pub const R_SVN_REVISION: u32 = 85510; +pub const R_DAY: &[u8; 3] = b"16\0"; +pub const R_SVN_REVISION: u32 = 85542; pub const R_GE_definitions: u32 = 13; pub const R_GE_deviceClip: u32 = 14; pub const R_GE_group: u32 = 15; diff --git a/bindings/bindings-macos-x86_64-R4.2.rs b/bindings/bindings-macos-x86_64-R4.2.rs index f3f831a3..d08ec446 100644 --- a/bindings/bindings-macos-x86_64-R4.2.rs +++ b/bindings/bindings-macos-x86_64-R4.2.rs @@ -1,8 +1,8 @@ /* automatically generated by rust-bindgen 0.69.1 */ /* libR-sys version: 0.6.0 */ -/* bindgen clang version: Homebrew clang version 17.0.3 */ -/* clang-rs version: Homebrew clang version 17.0.3 */ +/* bindgen clang version: Homebrew clang version 17.0.2 */ +/* clang-rs version: Homebrew clang version 17.0.2 */ /* r version: 4.2.3 */ #[repr(C)] diff --git a/bindings/bindings-macos-x86_64-R4.3.rs b/bindings/bindings-macos-x86_64-R4.3.rs index 1d1547c9..cf6f7f25 100644 --- a/bindings/bindings-macos-x86_64-R4.3.rs +++ b/bindings/bindings-macos-x86_64-R4.3.rs @@ -1,8 +1,8 @@ /* automatically generated by rust-bindgen 0.69.1 */ /* libR-sys version: 0.6.0 */ -/* bindgen clang version: Homebrew clang version 16.0.6 */ -/* clang-rs version: Homebrew clang version 16.0.6 */ +/* bindgen clang version: Homebrew clang version 17.0.3 */ +/* clang-rs version: Homebrew clang version 17.0.3 */ /* r version: 4.3.2 */ #[repr(C)] @@ -2053,6 +2053,7 @@ extern "C" { pub fn unif_rand() -> f64; pub fn R_unif_index(arg1: f64) -> f64; pub fn exp_rand() -> f64; + #[doc = "Normal Distribution"] pub fn Rf_dnorm4(arg1: f64, arg2: f64, arg3: f64, arg4: ::std::os::raw::c_int) -> f64; pub fn Rf_pnorm5( arg1: f64, @@ -2076,6 +2077,7 @@ extern "C" { arg4: ::std::os::raw::c_int, arg5: ::std::os::raw::c_int, ); + #[doc = "Uniform Distribution"] pub fn Rf_dunif(arg1: f64, arg2: f64, arg3: f64, arg4: ::std::os::raw::c_int) -> f64; pub fn Rf_punif( arg1: f64, @@ -2092,6 +2094,7 @@ extern "C" { arg5: ::std::os::raw::c_int, ) -> f64; pub fn Rf_runif(arg1: f64, arg2: f64) -> f64; + #[doc = "Gamma Distribution"] pub fn Rf_dgamma(arg1: f64, arg2: f64, arg3: f64, arg4: ::std::os::raw::c_int) -> f64; pub fn Rf_pgamma( arg1: f64, @@ -2112,9 +2115,11 @@ extern "C" { pub fn Rf_log1pexp(arg1: f64) -> f64; pub fn Rf_log1mexp(arg1: f64) -> f64; pub fn Rf_lgamma1p(arg1: f64) -> f64; + #[doc = "Compute the log of a sum or difference from logs of terms, i.e.,\n\n log (exp (logx) + exp (logy))\n or log (exp (logx) - exp (logy))\n\n without causing overflows or throwing away too much accuracy:"] pub fn Rf_logspace_add(arg1: f64, arg2: f64) -> f64; pub fn Rf_logspace_sub(arg1: f64, arg2: f64) -> f64; pub fn Rf_logspace_sum(arg1: *const f64, arg2: ::std::os::raw::c_int) -> f64; + #[doc = "Beta Distribution"] pub fn Rf_dbeta(arg1: f64, arg2: f64, arg3: f64, arg4: ::std::os::raw::c_int) -> f64; pub fn Rf_pbeta( arg1: f64, @@ -2131,6 +2136,7 @@ extern "C" { arg5: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rbeta(arg1: f64, arg2: f64) -> f64; + #[doc = "Lognormal Distribution"] pub fn Rf_dlnorm(arg1: f64, arg2: f64, arg3: f64, arg4: ::std::os::raw::c_int) -> f64; pub fn Rf_plnorm( arg1: f64, @@ -2147,6 +2153,7 @@ extern "C" { arg5: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rlnorm(arg1: f64, arg2: f64) -> f64; + #[doc = "Chi-squared Distribution"] pub fn Rf_dchisq(arg1: f64, arg2: f64, arg3: ::std::os::raw::c_int) -> f64; pub fn Rf_pchisq( arg1: f64, @@ -2161,6 +2168,7 @@ extern "C" { arg4: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rchisq(arg1: f64) -> f64; + #[doc = "Non-central Chi-squared Distribution"] pub fn Rf_dnchisq(arg1: f64, arg2: f64, arg3: f64, arg4: ::std::os::raw::c_int) -> f64; pub fn Rf_pnchisq( arg1: f64, @@ -2177,6 +2185,7 @@ extern "C" { arg5: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rnchisq(arg1: f64, arg2: f64) -> f64; + #[doc = "F Distribution"] pub fn Rf_df(arg1: f64, arg2: f64, arg3: f64, arg4: ::std::os::raw::c_int) -> f64; pub fn Rf_pf( arg1: f64, @@ -2193,6 +2202,7 @@ extern "C" { arg5: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rf(arg1: f64, arg2: f64) -> f64; + #[doc = "Student t Distribution"] pub fn Rf_dt(arg1: f64, arg2: f64, arg3: ::std::os::raw::c_int) -> f64; pub fn Rf_pt( arg1: f64, @@ -2207,6 +2217,7 @@ extern "C" { arg4: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rt(arg1: f64) -> f64; + #[doc = "Binomial Distribution"] pub fn Rf_dbinom_raw(x: f64, n: f64, p: f64, q: f64, give_log: ::std::os::raw::c_int) -> f64; pub fn Rf_dbinom(arg1: f64, arg2: f64, arg3: f64, arg4: ::std::os::raw::c_int) -> f64; pub fn Rf_pbinom( @@ -2224,12 +2235,14 @@ extern "C" { arg5: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rbinom(arg1: f64, arg2: f64) -> f64; + #[doc = "Multinomial Distribution"] pub fn Rf_rmultinom( arg1: ::std::os::raw::c_int, arg2: *mut f64, arg3: ::std::os::raw::c_int, arg4: *mut ::std::os::raw::c_int, ); + #[doc = "Cauchy Distribution"] pub fn Rf_dcauchy(arg1: f64, arg2: f64, arg3: f64, arg4: ::std::os::raw::c_int) -> f64; pub fn Rf_pcauchy( arg1: f64, @@ -2246,6 +2259,7 @@ extern "C" { arg5: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rcauchy(arg1: f64, arg2: f64) -> f64; + #[doc = "Exponential Distribution"] pub fn Rf_dexp(arg1: f64, arg2: f64, arg3: ::std::os::raw::c_int) -> f64; pub fn Rf_pexp( arg1: f64, @@ -2260,6 +2274,7 @@ extern "C" { arg4: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rexp(arg1: f64) -> f64; + #[doc = "Geometric Distribution"] pub fn Rf_dgeom(arg1: f64, arg2: f64, arg3: ::std::os::raw::c_int) -> f64; pub fn Rf_pgeom( arg1: f64, @@ -2274,6 +2289,7 @@ extern "C" { arg4: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rgeom(arg1: f64) -> f64; + #[doc = "Hypergeometric Distribution"] pub fn Rf_dhyper( arg1: f64, arg2: f64, @@ -2298,6 +2314,7 @@ extern "C" { arg6: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rhyper(arg1: f64, arg2: f64, arg3: f64) -> f64; + #[doc = "Negative Binomial Distribution"] pub fn Rf_dnbinom(arg1: f64, arg2: f64, arg3: f64, arg4: ::std::os::raw::c_int) -> f64; pub fn Rf_pnbinom( arg1: f64, @@ -2330,6 +2347,7 @@ extern "C" { arg5: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rnbinom_mu(arg1: f64, arg2: f64) -> f64; + #[doc = "Poisson Distribution"] pub fn Rf_dpois_raw(arg1: f64, arg2: f64, arg3: ::std::os::raw::c_int) -> f64; pub fn Rf_dpois(arg1: f64, arg2: f64, arg3: ::std::os::raw::c_int) -> f64; pub fn Rf_ppois( @@ -2345,6 +2363,7 @@ extern "C" { arg4: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rpois(arg1: f64) -> f64; + #[doc = "Weibull Distribution"] pub fn Rf_dweibull(arg1: f64, arg2: f64, arg3: f64, arg4: ::std::os::raw::c_int) -> f64; pub fn Rf_pweibull( arg1: f64, @@ -2361,6 +2380,7 @@ extern "C" { arg5: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rweibull(arg1: f64, arg2: f64) -> f64; + #[doc = "Logistic Distribution"] pub fn Rf_dlogis(arg1: f64, arg2: f64, arg3: f64, arg4: ::std::os::raw::c_int) -> f64; pub fn Rf_plogis( arg1: f64, @@ -2377,6 +2397,7 @@ extern "C" { arg5: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rlogis(arg1: f64, arg2: f64) -> f64; + #[doc = "Non-central Beta Distribution"] pub fn Rf_dnbeta( arg1: f64, arg2: f64, @@ -2401,6 +2422,7 @@ extern "C" { arg6: ::std::os::raw::c_int, ) -> f64; pub fn Rf_rnbeta(arg1: f64, arg2: f64, arg3: f64) -> f64; + #[doc = "Non-central F Distribution"] pub fn Rf_dnf(arg1: f64, arg2: f64, arg3: f64, arg4: f64, arg5: ::std::os::raw::c_int) -> f64; pub fn Rf_pnf( arg1: f64, @@ -2418,6 +2440,7 @@ extern "C" { arg5: ::std::os::raw::c_int, arg6: ::std::os::raw::c_int, ) -> f64; + #[doc = "Non-central Student t Distribution"] pub fn Rf_dnt(arg1: f64, arg2: f64, arg3: f64, arg4: ::std::os::raw::c_int) -> f64; pub fn Rf_pnt( arg1: f64, @@ -2433,6 +2456,7 @@ extern "C" { arg4: ::std::os::raw::c_int, arg5: ::std::os::raw::c_int, ) -> f64; + #[doc = "Studentized Range Distribution"] pub fn Rf_ptukey( arg1: f64, arg2: f64, @@ -2449,6 +2473,7 @@ extern "C" { arg5: ::std::os::raw::c_int, arg6: ::std::os::raw::c_int, ) -> f64; + #[doc = "Wilcoxon Rank Sum Distribution"] pub fn Rf_dwilcox(arg1: f64, arg2: f64, arg3: f64, arg4: ::std::os::raw::c_int) -> f64; pub fn Rf_pwilcox( arg1: f64, @@ -2466,6 +2491,7 @@ extern "C" { ) -> f64; pub fn Rf_rwilcox(arg1: f64, arg2: f64) -> f64; pub fn wilcox_free(); + #[doc = "Wilcoxon Signed Rank Distribution"] pub fn Rf_dsignrank(arg1: f64, arg2: f64, arg3: ::std::os::raw::c_int) -> f64; pub fn Rf_psignrank( arg1: f64, @@ -2481,6 +2507,7 @@ extern "C" { ) -> f64; pub fn Rf_rsignrank(arg1: f64) -> f64; pub fn signrank_free(); + #[doc = "Gamma and Related Functions"] pub fn Rf_gammafn(arg1: f64) -> f64; pub fn Rf_lgammafn(arg1: f64) -> f64; pub fn Rf_lgammafn_sign(arg1: f64, arg2: *mut ::std::os::raw::c_int) -> f64; @@ -2502,6 +2529,7 @@ extern "C" { pub fn Rf_lbeta(arg1: f64, arg2: f64) -> f64; pub fn Rf_choose(arg1: f64, arg2: f64) -> f64; pub fn Rf_lchoose(arg1: f64, arg2: f64) -> f64; + #[doc = "Bessel Functions"] pub fn Rf_bessel_i(arg1: f64, arg2: f64, arg3: f64) -> f64; pub fn Rf_bessel_j(arg1: f64, arg2: f64) -> f64; pub fn Rf_bessel_k(arg1: f64, arg2: f64, arg3: f64) -> f64; @@ -2510,6 +2538,7 @@ extern "C" { pub fn Rf_bessel_j_ex(arg1: f64, arg2: f64, arg3: *mut f64) -> f64; pub fn Rf_bessel_k_ex(arg1: f64, arg2: f64, arg3: f64, arg4: *mut f64) -> f64; pub fn Rf_bessel_y_ex(arg1: f64, arg2: f64, arg3: *mut f64) -> f64; + #[doc = "General Support Functions"] pub fn Rf_imax2( arg1: ::std::os::raw::c_int, arg2: ::std::os::raw::c_int, @@ -2653,15 +2682,22 @@ extern "C" { pub fn R_set_altlist_Set_elt_method(cls: R_altrep_class_t, fun: R_altlist_Set_elt_method_t); pub fn R_GE_getVersion() -> ::std::os::raw::c_int; pub fn R_GE_checkVersionOrDie(version: ::std::os::raw::c_int); + #[doc = "Properly declared version of devNumber"] pub fn Rf_ndevNumber(arg1: pDevDesc) -> ::std::os::raw::c_int; + #[doc = "How many devices exist ? (>= 1)"] pub fn Rf_NumDevices() -> ::std::os::raw::c_int; #[doc = "Check for an available device slot"] pub fn R_CheckDeviceAvailable(); pub fn R_CheckDeviceAvailableBool() -> Rboolean; + #[doc = "Return the number of the current device."] pub fn Rf_curDevice() -> ::std::os::raw::c_int; + #[doc = "Return the number of the next device."] pub fn Rf_nextDevice(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int; + #[doc = "Return the number of the previous device."] pub fn Rf_prevDevice(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int; + #[doc = "Make the specified device (specified by number) the current device"] pub fn Rf_selectDevice(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int; + #[doc = "Kill device which is identified by number."] pub fn Rf_killDevice(arg1: ::std::os::raw::c_int); pub fn Rf_NoDevices() -> ::std::os::raw::c_int; pub fn Rf_NewFrameConfirm(arg1: pDevDesc); @@ -2678,6 +2714,7 @@ extern "C" { pub static mut R_interrupts_suspended: Rboolean; pub static mut R_interrupts_pending: ::std::os::raw::c_int; pub static mut mbcslocale: Rboolean; + #[doc = "Useful for devices: translates Adobe symbol encoding to UTF-8"] pub fn Rf_AdobeSymbol2utf8( out: *mut ::std::os::raw::c_char, in_: *const ::std::os::raw::c_char, @@ -2695,6 +2732,7 @@ extern "C" { ) -> *const ::std::os::raw::c_char; #[doc = "Translates Unicode point to UTF-8"] pub fn Rf_ucstoutf8(s: *mut ::std::os::raw::c_char, c: ::std::os::raw::c_uint) -> usize; + #[doc = "map DevDesc to enclosing GEDevDesc"] pub fn Rf_desc2GEDesc(dd: pDevDesc) -> pGEDevDesc; pub fn GEdeviceNumber(arg1: pGEDevDesc) -> ::std::os::raw::c_int; pub fn GEgetDevice(arg1: ::std::os::raw::c_int) -> pGEDevDesc; @@ -2724,8 +2762,10 @@ extern "C" { pub fn GEtoDeviceWidth(value: f64, from: GEUnit, dd: pGEDevDesc) -> f64; pub fn GEfromDeviceHeight(value: f64, to: GEUnit, dd: pGEDevDesc) -> f64; pub fn GEtoDeviceHeight(value: f64, from: GEUnit, dd: pGEDevDesc) -> f64; + #[doc = "Convert an element of a R colour specification (which might be a\nnumber or a string) into an internal colour specification."] pub fn Rf_RGBpar(arg1: SEXP, arg2: ::std::os::raw::c_int) -> rcolor; pub fn Rf_RGBpar3(arg1: SEXP, arg2: ::std::os::raw::c_int, arg3: rcolor) -> rcolor; + #[doc = "Convert an internal colour specification to/from a colour name"] pub fn Rf_col2name(col: rcolor) -> *const ::std::os::raw::c_char; #[doc = "Convert either a name or a #RRGGBB\\[AA\\] string to internal.\nBecause people were using it, it also converts \"1\", \"2\" ...\nto a colour in the palette, and \"0\" to transparent white."] pub fn R_GE_str2col(s: *const ::std::os::raw::c_char) -> rcolor; diff --git a/bindings/bindings-windows-x86_64-R4.4-devel.rs b/bindings/bindings-windows-x86_64-R4.4-devel.rs index d132bc36..1c196d17 100644 --- a/bindings/bindings-windows-x86_64-R4.4-devel.rs +++ b/bindings/bindings-windows-x86_64-R4.4-devel.rs @@ -83,8 +83,8 @@ pub const R_MINOR: &[u8; 4] = b"4.0\0"; pub const R_STATUS: &[u8; 29] = b"Under development (unstable)\0"; pub const R_YEAR: &[u8; 5] = b"2023\0"; pub const R_MONTH: &[u8; 3] = b"11\0"; -pub const R_DAY: &[u8; 3] = b"11\0"; -pub const R_SVN_REVISION: u32 = 85510; +pub const R_DAY: &[u8; 3] = b"17\0"; +pub const R_SVN_REVISION: u32 = 85550; pub const R_GE_definitions: u32 = 13; pub const R_GE_deviceClip: u32 = 14; pub const R_GE_group: u32 = 15;