Skip to content

Commit 0ac307d

Browse files
committed
Move build-time deps to src, remove wrappers
1 parent 95cfdbe commit 0ac307d

35 files changed

+98
-103
lines changed

R/JSContext.R

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,15 @@ get <- NULL
109109
assign <- NULL
110110

111111
new_JSContext <- function(stack_size = NULL) {
112-
stack_size_int = ifelse(is.null(stack_size), -1, stack_size)
113-
ContextList = list(
114-
runtime_context_ptr = qjs_context(stack_size_int)
112+
stack_size_int <- ifelse(is.null(stack_size), -1, stack_size)
113+
rt_and_ctx <- qjs_context(stack_size_int)
114+
ContextList <- list(
115+
runtime = rt_and_ctx$runtime_ptr,
116+
context = rt_and_ctx$context_ptr
115117
)
116118

117119
ContextList$validate <- function(code_string) {
118-
qjs_validate(ContextList$runtime_context_ptr, code_string)
120+
qjs_validate(ContextList$context, code_string)
119121
}
120122

121123
ContextList$source <- function(file = NULL, code = NULL) {
@@ -125,10 +127,10 @@ new_JSContext <- function(stack_size = NULL) {
125127
warning("Both a filepath and code string cannot be provided,",
126128
" code will be ignored!", call. = FALSE)
127129
}
128-
eval_success <- qjs_source(ContextList$runtime_context_ptr,
130+
eval_success <- qjs_source(ContextList$context,
129131
input = normalizePath(file), is_file = TRUE)
130132
} else if (!is.null(code)) {
131-
eval_success <- qjs_source(ContextList$runtime_context_ptr, input = code, is_file = FALSE)
133+
eval_success <- qjs_source(ContextList$context, input = code, is_file = FALSE)
132134
} else {
133135
stop("No JS code provided!", call. = FALSE)
134136
}
@@ -139,13 +141,13 @@ new_JSContext <- function(stack_size = NULL) {
139141
invisible(NULL)
140142
}
141143
ContextList$call <- function(function_name, ...) {
142-
qjs_call(ContextList$runtime_context_ptr, function_name, ...)
144+
qjs_call(ContextList$context, function_name, ...)
143145
}
144146
ContextList$get <- function(var_name) {
145-
qjs_get(ContextList$runtime_context_ptr, var_name)
147+
qjs_get(ContextList$context, var_name)
146148
}
147149
ContextList$assign <- function(var_name, value) {
148-
qjs_assign(ContextList$runtime_context_ptr, var_name, value)
150+
qjs_assign(ContextList$context, var_name, value)
149151
}
150152
structure(
151153
class = "JSContext",

inst/include/quickjsr/JS_Containers.hpp

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/Makevars

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
PKG_CPPFLAGS = -I"../inst/include/" -I"quickjs" -D_GNU_SOURCE
1+
PKG_CPPFLAGS = -I"include" -I"quickjs" -D_GNU_SOURCE
22
PKG_LIBS = libquickjs.o
33

44
ifeq ($(OS),Windows_NT)
5-
DLL := .dll
5+
DLL := .dll
66
else
77
DLL := .so
88
endif
99

1010
ifdef R_HOME
11-
R_CC := $(shell $(R_HOME)/bin$(R_ARCH_BIN)/R CMD config CC)
12-
R_CXX := $(shell $(R_HOME)/bin$(R_ARCH_BIN)/R CMD config CXX)
11+
R_CC := $(shell $(R_HOME)/bin$(R_ARCH_BIN)/R CMD config CC)
12+
R_CXX := $(shell $(R_HOME)/bin$(R_ARCH_BIN)/R CMD config CXX)
1313
else
14-
R_CC := $(CC)
14+
R_CC := $(CC)
1515
R_CXX := $(CXX)
1616
endif
1717

0 commit comments

Comments
 (0)