Skip to content

Commit 9a8c75b

Browse files
committedMar 30, 2022
initialize project
1 parent 06d3b56 commit 9a8c75b

29 files changed

+338
-0
lines changed
 

‎.Rhistory

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
remotes::install_github("extendr/rextendr")
2+
usethis::create_package("path/to/myextendr")
3+
usethis::create_package(".src")
4+
usethis::create_package("./src")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"debugBreakpointsState": {
3+
"breakpoints": []
4+
}
5+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"sortOrder": [
3+
{
4+
"columnIndex": 2,
5+
"ascending": true
6+
}
7+
],
8+
"path": "~/Documents/codingpot/stringer"
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"installOptions": {
3+
"installFromRepository": true,
4+
"libraryPath": "/usr/local/lib/R/4.1/site-library",
5+
"installDependencies": true
6+
}
7+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"activeTab": -1
3+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"left": {
3+
"splitterpos": 398,
4+
"topwindowstate": "HIDE",
5+
"panelheight": 959,
6+
"windowheight": 997
7+
},
8+
"right": {
9+
"splitterpos": 598,
10+
"topwindowstate": "NORMAL",
11+
"panelheight": 959,
12+
"windowheight": 997
13+
}
14+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"TabSet1": 0,
3+
"TabSet2": 0,
4+
"TabZoom": {}
5+
}

‎.Rproj.user/2194170C/rmd-outputs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
4+
5+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"active_set":"","sets":[]}

‎DESCRIPTION

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Package: stringer
2+
Title: What the Package Does (One Line, Title Case)
3+
Version: 0.0.0.9000
4+
Authors@R:
5+
person("First", "Last", , "first.last@example.com", role = c("aut", "cre"),
6+
comment = c(ORCID = "YOUR-ORCID-ID"))
7+
Description: What the package does (one paragraph).
8+
License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a
9+
license
10+
Encoding: UTF-8
11+
Roxygen: list(markdown = TRUE)
12+
RoxygenNote: 7.1.2

‎NAMESPACE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Generated by roxygen2: do not edit by hand
2+
3+
export(hello_world)
4+
useDynLib(stringer, .registration = TRUE)

‎R/extendr-wrappers.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Generated by extendr: Do not edit by hand
2+
#
3+
# This file was created with the following call:
4+
# .Call("wrap__make_stringer_wrappers", use_symbols = TRUE, package_name = "stringer")
5+
6+
#' @docType package
7+
#' @usage NULL
8+
#' @useDynLib stringer, .registration = TRUE
9+
NULL
10+
11+
#' Return string `"Hello world!"` to R.
12+
#' @export
13+
hello_world <- function() .Call(wrap__hello_world)
14+

‎man/hello_world.Rd

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/.Rhistory

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"sortOrder": [
3+
{
4+
"columnIndex": 2,
5+
"ascending": true
6+
}
7+
],
8+
"path": "~/Documents/codingpot/stringer/src"
9+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"activeTab": -1
3+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"left": {
3+
"splitterpos": 398,
4+
"topwindowstate": "HIDE",
5+
"panelheight": 959,
6+
"windowheight": 997
7+
},
8+
"right": {
9+
"splitterpos": 598,
10+
"topwindowstate": "NORMAL",
11+
"panelheight": 959,
12+
"windowheight": 997
13+
}
14+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"TabSet1": 0,
3+
"TabSet2": 0,
4+
"TabZoom": {}
5+
}

‎src/.Rproj.user/2194170C/rmd-outputs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
4+
5+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"active_set":"","sets":[]}

‎src/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.o
2+
*.so
3+
*.dll
4+
target

‎src/Makevars

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
TARGET_DIR = ./rust/target
2+
LIBDIR = $(TARGET_DIR)/release
3+
STATLIB = $(LIBDIR)/libstringer.a
4+
PKG_LIBS = -L$(LIBDIR) -lstringer
5+
6+
all: C_clean
7+
8+
$(SHLIB): $(STATLIB)
9+
10+
$(STATLIB):
11+
# In some environments, ~/.cargo/bin might not be included in PATH, so we need
12+
# to set it here to ensure cargo can be invoked. It is appended to PATH and
13+
# therefore is only used if cargo is absent from the user's PATH.
14+
export PATH="$(PATH):$(HOME)/.cargo/bin" && \
15+
cargo build --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR)
16+
17+
C_clean:
18+
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS)
19+
20+
clean:
21+
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) rust/target

‎src/Makevars.win

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
TARGET = $(subst 64,x86_64,$(subst 32,i686,$(WIN)))-pc-windows-gnu
2+
TOOLCHAIN = stable-msvc
3+
TARGET_DIR = ./rust/target
4+
LIBDIR = $(TARGET_DIR)/$(TARGET)/release
5+
STATLIB = $(LIBDIR)/libstringer.a
6+
PKG_LIBS = -L$(LIBDIR) -lstringer -lws2_32 -ladvapi32 -luserenv -lbcrypt
7+
8+
all: C_clean
9+
10+
$(SHLIB): $(STATLIB)
11+
12+
$(STATLIB):
13+
cargo +$(TOOLCHAIN) build --target=$(TARGET) --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR)
14+
15+
C_clean:
16+
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS)
17+
18+
clean:
19+
rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) rust/target

‎src/entrypoint.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// We need to forward routine registration from C to Rust
2+
// to avoid the linker removing the static library.
3+
4+
void R_init_stringer_extendr(void *dll);
5+
6+
void R_init_stringer(void *dll) {
7+
R_init_stringer_extendr(dll);
8+
}

‎src/rust/Cargo.lock

Lines changed: 114 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/rust/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = 'stringer'
3+
version = '0.1.0'
4+
edition = '2018'
5+
6+
[lib]
7+
crate-type = [ 'staticlib' ]
8+
name = 'stringer'
9+
10+
[dependencies]
11+
extendr-api = '*'

‎src/rust/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
use extendr_api::prelude::*;
2+
3+
/// Return string `"Hello world!"` to R.
4+
/// @export
5+
#[extendr]
6+
fn hello_world() -> &'static str {
7+
"Hello world!"
8+
}
9+
10+
// Macro to generate exports.
11+
// This ensures exported functions are registered with R.
12+
// See corresponding C code in `entrypoint.c`.
13+
extendr_module! {
14+
mod stringer;
15+
fn hello_world;
16+
}

‎stringer.Rproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Version: 1.0
2+
3+
RestoreWorkspace: Default
4+
SaveWorkspace: Default
5+
AlwaysSaveHistory: Default
6+
7+
EnableCodeIndexing: Yes
8+
UseSpacesForTab: Yes
9+
NumSpacesForTab: 2
10+
Encoding: UTF-8
11+
12+
RnwWeave: Sweave
13+
LaTeX: pdfLaTeX

0 commit comments

Comments
 (0)
Please sign in to comment.