Skip to content

Commit 92b64bc

Browse files
committed
rename to cpp4r
1 parent 1bd398f commit 92b64bc

File tree

144 files changed

+2905
-3229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+2905
-3229
lines changed

.Rbuildignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ script.R
1313
^\.clangd$
1414
^compile_flags\.txt$
1515
^compile_commands\.json$
16-
^cpp11test$
16+
^cpp4rtest$
1717
^codecov\.yml$
1818
^R/coverage\.R$
1919
^book$

.github/CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Contributing to cpp11
1+
# Contributing to cpp4r
22

3-
This outlines how to propose a change to cpp11.
3+
This outlines how to propose a change to cpp4r.
44
For more detailed info about contributing to this, and other tidyverse packages, please see the
55
[**development contributing guide**](https://rstd.io/tidy-contrib).
66

@@ -18,7 +18,7 @@ If you’ve found a bug, please file an issue that illustrates the bug with a mi
1818

1919
### Pull request process
2020

21-
* Fork the package and clone onto your computer. If you haven't done this before, we recommend using `usethis::create_from_github("r-lib/cpp11", fork = TRUE)`.
21+
* Fork the package and clone onto your computer. If you haven't done this before, we recommend using `usethis::create_from_github("r-lib/cpp4r", fork = TRUE)`.
2222

2323
* Install all development dependences with `devtools::install_dev_deps()`, and then make sure the package passes R CMD check by running `devtools::check()`.
2424
If R CMD check doesn't pass cleanly, it's a good idea to ask for help before continuing.
@@ -42,6 +42,6 @@ If you’ve found a bug, please file an issue that illustrates the bug with a mi
4242

4343
## Code of Conduct
4444

45-
Please note that the cpp11 project is released with a
45+
Please note that the cpp4r project is released with a
4646
[Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this
4747
project you agree to abide by its terms.

.github/SUPPORT.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Getting help with cpp11
1+
# Getting help with cpp4r
22

3-
Thanks for using cpp11!
3+
Thanks for using cpp4r!
44
Before filing an issue, there are a few places to explore and pieces to put together to make the process as smooth as possible.
55

66
## Make a reprex
@@ -16,12 +16,12 @@ Armed with your reprex, the next step is to figure out [where to ask](https://ww
1616

1717
* If it's a question: start with [community.rstudio.com](https://community.rstudio.com/), and/or StackOverflow. There are more people there to answer questions.
1818

19-
* If it's a bug: you're in the right place, [file an issue](https://github.com/r-lib/cpp11/issues/new).
19+
* If it's a bug: you're in the right place, [file an issue](https://github.com/r-lib/cpp4r/issues/new).
2020

2121
* If you're not sure: let the community help you figure it out!
2222
If your problem _is_ a bug or a feature request, you can easily return here and report it.
2323

24-
Before opening a new issue, be sure to [search issues and pull requests](https://github.com/r-lib/cpp11/issues) to make sure the bug hasn't been reported and/or already fixed in the development version.
24+
Before opening a new issue, be sure to [search issues and pull requests](https://github.com/r-lib/cpp4r/issues) to make sure the bug hasn't been reported and/or already fixed in the development version.
2525
By default, the search will be pre-populated with `is:issue is:open`.
2626
You can [edit the qualifiers](https://help.github.com/articles/searching-issues-and-pull-requests/) (e.g. `is:pr`, `is:closed`) as needed.
2727
For example, you'd simply remove `is:open` to search _all_ issues in the repo, open or closed.

.github/workflows/R-CMD-check.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
# Use older ubuntu to maximise backward compatibility
3535
- {os: ubuntu-22.04, r: 'devel', http-user-agent: 'release'}
3636
- {os: ubuntu-22.04, r: 'release'}
37-
- {os: ubuntu-22.04, r: 'release', custom: 'no-cpp11test'}
37+
- {os: ubuntu-22.04, r: 'release', custom: 'no-cpp4rtest'}
3838
- {os: ubuntu-22.04, r: 'oldrel-1'}
3939
- {os: ubuntu-22.04, r: 'oldrel-2'}
4040
- {os: ubuntu-22.04, r: 'oldrel-3'}
@@ -65,25 +65,25 @@ jobs:
6565
pak-version: devel
6666
needs: check
6767

68-
- name: Install cpp11test
69-
if: matrix.config.custom != 'no-cpp11test'
68+
- name: Install cpp4rtest
69+
if: matrix.config.custom != 'no-cpp4rtest'
7070
run: |
7171
options(warn = 2)
72-
pak::local_install_dev_deps("cpp11test", dependencies = TRUE)
72+
pak::local_install_dev_deps("cpp4rtest", dependencies = TRUE)
7373
install.packages(".", repos = NULL, type = "source")
74-
install.packages("cpp11test", repos = NULL, INSTALL_opts = "--install-tests", type = "source")
74+
install.packages("cpp4rtest", repos = NULL, INSTALL_opts = "--install-tests", type = "source")
7575
shell: Rscript {0}
7676

7777
- uses: r-lib/actions/check-r-package@v2
7878
with:
7979
upload-snapshots: true
8080
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
8181

82-
- name: Run cpp11test tests
83-
if: matrix.config.custom != 'no-cpp11test'
82+
- name: Run cpp4rtest tests
83+
if: matrix.config.custom != 'no-cpp4rtest'
8484
run: |
85-
setwd("cpp11test/tests")
85+
setwd("cpp4rtest/tests")
8686
library(testthat)
87-
library(cpp11test)
88-
test_check("cpp11test", reporter = "progress")
87+
library(cpp4rtest)
88+
test_check("cpp4rtest", reporter = "progress")
8989
shell: Rscript {0}

.github/workflows/pkgdown.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ jobs:
3434

3535
- uses: r-lib/actions/setup-r-dependencies@v2
3636
with:
37-
extra-packages: any::pkgdown, local::., local::cpp11test
37+
extra-packages: any::pkgdown, local::., local::cpp4rtest
3838
needs: website
3939

4040
- name: Build site
4141
env:
42-
CPP11_EVAL: true
42+
cpp4r_EVAL: true
4343
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
4444
shell: Rscript {0}
4545

.github/workflows/test-coverage.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ jobs:
2828
extra-packages: any::covr, any::xml2
2929
needs: coverage
3030

31-
- name: Install cpp11test
31+
- name: Install cpp4rtest
3232
run: |
3333
options(warn = 2)
34-
pak::local_install_dev_deps("cpp11test", dependencies = TRUE)
34+
pak::local_install_dev_deps("cpp4rtest", dependencies = TRUE)
3535
install.packages(".", repos = NULL, type = "source")
36-
install.packages("cpp11test", repos = NULL, INSTALL_opts = "--install-tests", type = "source")
36+
install.packages("cpp4rtest", repos = NULL, INSTALL_opts = "--install-tests", type = "source")
3737
shell: Rscript {0}
3838

3939
- name: Test coverage

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ README.html
33
.Rproj.user
44
.Rhistory
55
.clangd/
6-
cpp11test/compile_commands.json
7-
cpp11test/src/Makevars
8-
cpp11test/src/*.o
9-
cpp11test/src/*.so
6+
cpp4rtest/compile_commands.json
7+
cpp4rtest/src/Makevars
8+
cpp4rtest/src/*.o
9+
cpp4rtest/src/*.so
1010
compile_flags.txt
1111
inst/doc
1212
vignettes/*_cache

DESCRIPTION

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Package: cpp11
2-
Title: A C++11 Interface for R's C Interface
1+
Package: cpp4r
2+
Title: A C++ Interface for R's C Interface
33
Version: 0.5.2.9000
44
Authors@R:
55
c(
@@ -9,14 +9,14 @@ Authors@R:
99
person("Benjamin", "Kietzman", role = "ctb"),
1010
person("Posit Software, PBC", role = c("cph", "fnd"))
1111
)
12-
Description: Provides a header only, C++11 interface to R's C
13-
interface. Compared to other approaches 'cpp11' strives to be safe
12+
Description: Provides a header only, C++ interface to R's C
13+
interface. Compared to other approaches 'cpp4r' strives to be safe
1414
against long jumps from the C API as well as C++ exceptions, conform
1515
to normal R function semantics and supports interaction with 'ALTREP'
1616
vectors.
1717
License: MIT + file LICENSE
18-
URL: https://cpp11.r-lib.org, https://github.com/r-lib/cpp11
19-
BugReports: https://github.com/r-lib/cpp11/issues
18+
URL: https://cpp4r.r-lib.org, https://github.com/r-lib/cpp4r
19+
BugReports: https://github.com/r-lib/cpp4r/issues
2020
Depends:
2121
R (>= 4.0.0)
2222
Suggests:
@@ -35,7 +35,6 @@ Suggests:
3535
progress,
3636
rmarkdown,
3737
scales,
38-
Rcpp,
3938
testthat (>= 3.2.0),
4039
tibble,
4140
utils,
@@ -45,7 +44,7 @@ VignetteBuilder:
4544
knitr
4645
Config/Needs/website: tidyverse/tidytemplate
4746
Config/testthat/edition: 3
48-
Config/Needs/cpp11/cpp_register:
47+
Config/Needs/cpp4r/cpp_register:
4948
brio,
5049
cli,
5150
decor,

MAINTENANCE.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
## Current state
22

3-
The state of cpp11 is pretty stable, it seems to have the features we need for most of our projects using C++.
3+
The state of cpp4r is pretty stable, it seems to have the features we need for most of our projects using C++.
44

55
## Known outstanding issues
66

7-
### Running the cpp11test tests
7+
### Running the cpp4rtest tests
88

9-
Most of the test suite is in a sub-package, cpp11test.
10-
The best way to run these tests is to install the development version of cpp11 after any change, and then run `devtools::test("./cpp11test")`.
9+
Most of the test suite is in a sub-package, cpp4rtest.
10+
The best way to run these tests is to install the development version of cpp4r after any change, and then run `devtools::test("./cpp4rtest")`.
1111
Precisely, this looks like:
1212

1313
```r
14-
# Install dev cpp11, clean the cpp11test dll manually since it thinks nothing
14+
# Install dev cpp4r, clean the cpp4rtest dll manually since it thinks nothing
1515
# has changed, then recompile and run its tests.
1616
devtools::install()
17-
devtools::clean_dll("./cpp11test")
18-
devtools::test("./cpp11test")
17+
devtools::clean_dll("./cpp4rtest")
18+
devtools::test("./cpp4rtest")
1919
```
2020

2121
If tests failures occur the output from Catch isn't always easy to interpret.
2222
I have a branch of testthat https://github.com/jimhester/testthat/tree/catch-detailed-output that should make things easier to understand.
2323
I contributed those changes to the main testthat, but something changed after merging the more detailed output was lost, I unfortunately never had the time to track down the cause and fix it.
2424

25-
In addition getting a debugger to catch when errors happen can be fiddly when running the cpp11test tests, something about the way that Catch redirects stderr / stdout interacts with the debugger.
25+
In addition getting a debugger to catch when errors happen can be fiddly when running the cpp4rtest tests, something about the way that Catch redirects stderr / stdout interacts with the debugger.
2626

27-
The GitHub Actions workflow has some additional logic to handle running the cpp11 tests https://github.com/r-lib/cpp11/blob/fd8ef97d006db847f7f17166cf52e1e0383b2d35/.github/workflows/R-CMD-check.yaml#L95-L102, https://github.com/r-lib/cpp11/blob/fd8ef97d006db847f7f17166cf52e1e0383b2d35/.github/workflows/R-CMD-check.yaml#L117-L124.
27+
The GitHub Actions workflow has some additional logic to handle running the cpp4r tests https://github.com/r-lib/cpp4r/blob/fd8ef97d006db847f7f17166cf52e1e0383b2d35/.github/workflows/R-CMD-check.yaml#L95-L102, https://github.com/r-lib/cpp4r/blob/fd8ef97d006db847f7f17166cf52e1e0383b2d35/.github/workflows/R-CMD-check.yaml#L117-L124.
2828

29-
## Ensure you use `Sys.setenv("CPP11_EVAL" = "true"); devtools::submit_cran()` when submitting.
29+
## Ensure you use `Sys.setenv("cpp4r_EVAL" = "true"); devtools::submit_cran()` when submitting.
3030

3131
If you forget to set `CPP_EVAL = "true"` then the vignette chunks will not run properly and the vignettes will not be rendered properly.
3232

3333
## Regenerating benchmark objects used in `motivations.Rmd`
3434

35-
If you need to regenerate the benchmark objects (RDS objects) utilized in `motivations.Rmd`, then you should set `Sys.setenv("CPP11TEST_SHOULD_RUN_BENCHMARKS" = "TRUE")` before running the Rmd. You'll also need to make sure that cpp11test is actually installed. See `cpp11test:::should_run_benchmarks()` for more.
35+
If you need to regenerate the benchmark objects (RDS objects) utilized in `motivations.Rmd`, then you should set `Sys.setenv("cpp4rTEST_SHOULD_RUN_BENCHMARKS" = "TRUE")` before running the Rmd. You'll also need to make sure that cpp4rtest is actually installed. See `cpp4rtest:::should_run_benchmarks()` for more.
3636

3737
## Usage with clangd
3838

39-
Since cpp11 is header only, if you use clangd you'll have a bit of an issue because tools like bear and pkgload won't know how to generate the `compile_commands.json` file. Instead, you can create it manually with something like this, which seems to work well. Note that the paths are specific to your computer.
39+
Since cpp4r is header only, if you use clangd you'll have a bit of an issue because tools like bear and pkgload won't know how to generate the `compile_commands.json` file. Instead, you can create it manually with something like this, which seems to work well. Note that the paths are specific to your computer.
4040

4141
```
4242
[
4343
{
44-
"command": "g++ -std=gnu++11 -I\"/Users/davis/files/r/packages/cpp11/inst/include\" -I\"/Library/Frameworks/R.framework/Resources/include\" -I\"/Users/davis/Library/R/arm64/4.4/library/Rcpp/include\" -I\"/Users/davis/Library/R/arm64/4.4/library/testthat/include\" -I\"/opt/homebrew/include\" -Wall -pedantic",
44+
"command": "g++ -std=gnu++11 -I\"/Users/davis/files/r/packages/cpp4r/inst/include\" -I\"/Library/Frameworks/R.framework/Resources/include\" -I\"/Users/davis/Library/R/arm64/4.4/library/Rcpp/include\" -I\"/Users/davis/Library/R/arm64/4.4/library/testthat/include\" -I\"/opt/homebrew/include\" -Wall -pedantic",
4545
"file": "R.hpp",
46-
"directory": "/Users/davis/files/r/packages/cpp11/inst/include/cpp11"
46+
"directory": "/Users/davis/files/r/packages/cpp4r/inst/include/cpp4r"
4747
}
4848
]
4949
```
@@ -53,7 +53,7 @@ Key notes:
5353
- Only doing this for `R.hpp` seems to be enough. I imagine this could be any of the header files, but it is reasonable to pick the "root" one that pretty much all others include.
5454
- Using `-std=gnu++11` to keep us honest about only C++11 features.
5555
- Using `-I\"/Library/Frameworks/R.framework/Resources/include\"` for access to the R headers.
56-
- Using `-I\"/Users/davis/files/r/packages/cpp11/inst/include\"` as a "self include", which seems to be the key to the whole thing.
56+
- Using `-I\"/Users/davis/files/r/packages/cpp4r/inst/include\"` as a "self include", which seems to be the key to the whole thing.
5757

5858
If you are modifying any tests or benchmarks, you also need:
5959

@@ -66,6 +66,6 @@ Note that this is specific to a path on your machine and the R version you are c
6666

6767
Some work could be spent in smoothing out the `cpp_source()` / knitr chunk experience.
6868
Our main focus and use cases were in R packages, so that usage is more tested.
69-
Because we don't typically use cpp11 in non package contexts those use cases may not be as nice.
69+
Because we don't typically use cpp4r in non package contexts those use cases may not be as nice.
7070

7171
For similar reasons the matrix support might be somewhat lacking, as the majority of our use cases do not deal with numeric matrices.

Makefile

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1-
all:
2-
@echo "make: Entering directory 'cpp11test/src'"
3-
@Rscript -e 'devtools::load_all("cpp11test")'
4-
@echo "make: Leaving directory 'cpp11test/src'"
5-
6-
test: all
7-
@echo "make: Entering directory 'cpp11test/tests/testthat'"
8-
@Rscript -e 'devtools::test("cpp11test")'
9-
@echo "make: Leaving directory 'cpp11test/tests/testthat'"
10-
111
clean:
122
@Rscript -e 'devtools::clean_dll()'
13-
@Rscript -e 'devtools::clean_dll("cpp11test")'
3+
@Rscript -e 'devtools::clean_dll("cpp4rtest")'
4+
5+
test:
6+
@echo "Testing R code"
7+
@Rscript -e 'devtools::document(); devtools::test(); devtools::install()'
8+
@echo "Testing C++ code"
9+
@Rscript -e 'devtools::clean_dll("cpp4rtest"); devtools::load_all("cpp4rtest"); devtools::test("cpp4rtest")'
10+
11+
check:
12+
@echo "Local"
13+
@Rscript -e 'devtools::install()'
14+
@Rscript -e 'devtools::check(); devtools::check("cpp4rtest")'
15+
16+
site:
17+
@Rscript -e 'devtools::document()'
18+
@Rscript -e 'pkgdown::build_site()'
19+
20+
install:
21+
@Rscript -e 'devtools::install()'
22+
23+
clang_format=`which clang-format-14`
1424

15-
clang_format=`which clang-format`
16-
format: $(shell find . -name '*.hpp') $(shell find . -name '*.cpp')
17-
@${clang_format} -i $?
25+
format: $(shell find . -name '*.h') $(shell find . -name '*.hpp') $(shell find . -name '*.cpp')
26+
@${clang_format} -i $?

0 commit comments

Comments
 (0)