...
 
Commits (2)
......@@ -2,18 +2,18 @@ Package: dotCall64
Type: Package
Title: Enhanced Foreign Function Interface Supporting Long Vectors
Version: 0.9-5.2
Date: 2018-01-08
Date: 2018-01-09
Authors@R: c(person("Kaspar", "Moesinger", role = c("aut"),
email = "kaspar.moesinger@gmail.com"),
person("Florian", "Gerber", role = c("cre", "ctb"),
email = "florian.gerber@math.uzh.ch"),
person("Reinhard", "Furrer", role = "ctb",
email = "reinhard.furrer@math.uzh.ch"))
Description: The package provides .C64(), which is an enhanced version of .C()
and .Fortran(). .C64() supports long vectors, arguments of type 64-bit
integer, and provides a mechanism to avoid unnecessary copies of read-only
and write-only arguments. This makes it a convenient and fast interface to
C/C++ and Fortran code.
Description: Provides .C64(), which is an enhanced version of .C()
and .Fortran() from the foreign function interface. .C64() supports long
vectors, arguments of type 64-bit integer, and provides a mechanism to
avoid unnecessary copies of read-only and write-only arguments. This
makes it a convenient and fast interface to C/C++ and Fortran code.
License: GPL (>= 2)
URL: https://git.math.uzh.ch/reinhard.furrer/dotCall64
BugReports: https://git.math.uzh.ch/reinhard.furrer/dotCall64/issues
......
#' dotCall64 - Extended Foreign Function Interface
#'
#' \code{.C64} can be used to call compiled and loaded C functions and Fortran subroutines.
#' \code{.C64} can be used to call compiled and loaded C/C++ functions and Fortran subroutines.
#' \code{.C64} is similar to \code{\link{.C}} and \code{\link{.Fortran}}, but
#' \enumerate{
#' \item supports long vectors, i.e., vectors with more than \code{2^31-1} elements
......@@ -17,11 +17,11 @@
#'
#' @param .NAME character vector of length 1. Name of the compiled function to be called.
#' @param SIGNATURE character vector of the same length as the number of arguments of the compiled function.
#' Accepted strings are \code{"double"}, \code{"integer"}, \code{"int64"} describing the signature
#' of each argument of the compiled function.
#' Accepted strings are \code{"double"}, \code{"integer"}, \code{"int64"}.
#' They describe the signature of each argument of the compiled function.
#' @param ... arguments passed to the compiled function. One R object for each argument. Up to 65 arguments are supported.
#' @param INTENT character vector of the same length as the number of arguments of the compiled code.
#' Accepted strings are \code{"rw"}, \code{"r"} or \code{"w"} indicating
#' @param INTENT character vector of the same length as the number of arguments of the compiled function.
#' Accepted strings are \code{"rw"}, \code{"r"}, and \code{"w"}, which indicate
#' whether the intent of the argument is "read and write", "read", or "write", respectively.
#' If the INTENT of an argument is \code{"rw"}, the R object is copied and the
#' compiled function receives a pointer to that copy.
......@@ -43,12 +43,12 @@
#' which can use this argument to ensure that no other package can override their external symbols,
#' and also speeds up the search.
#' @param VERBOSE numeric vector of length 1. If \code{0}, no warnings are printed.
#' If \code{1} warnings are printed (which may help to improve the performance of the call),
#' If \code{2} additional debug information is given as warnings.
#' If \code{1}, warnings are printed, which help to improve the performance of the call.
#' If \code{2}, additional debug information is given as warnings.
#' The default value can be changed via the \code{dotCall64.verbose} option, which is set to \code{0} by default.
#'
#' @return list of R objects similar to the list of arguments specified as \code{...} arguments.
#' The objects of the list reflect the changes made by the compiled C or Fortran code.
#' The objects of the list reflect the changes made by the compiled C or Fortran function.
#'
#' @references
#' F. Gerber, K. Moesinger, and R. Furrer (2017),
......@@ -67,7 +67,7 @@
#' ## output[0] = input[index[0] - 1];
#' ## }
#' ##
#' ## We can use .C64() the call it from R:
#' ## We can use .C64() to call it from R:
#' .C64("get_c", SIGNATURE = c("double", "integer", "double"),
#' input = 1:10, index = 9, output = double(1))$output
#'
......@@ -90,7 +90,6 @@
#' ## Now, we can use .C64() to call the function from R.
#' .C64("get64_c", SIGNATURE = c("double", "int64", "double"),
#' input = x_long, index = 2^31, output = double(1))$output
#'
#' ## Note that 2^31 is of type double and .C64() casts it into an
#' ## int64_t type before calling the C function get64_c().
#'
......
......@@ -12,13 +12,13 @@
\item{.NAME}{character vector of length 1. Name of the compiled function to be called.}
\item{SIGNATURE}{character vector of the same length as the number of arguments of the compiled function.
Accepted strings are \code{"double"}, \code{"integer"}, \code{"int64"} describing the signature
of each argument of the compiled function.}
Accepted strings are \code{"double"}, \code{"integer"}, \code{"int64"}.
They describe the signature of each argument of the compiled function.}
\item{...}{arguments passed to the compiled function. One R object for each argument. Up to 65 arguments are supported.}
\item{INTENT}{character vector of the same length as the number of arguments of the compiled code.
Accepted strings are \code{"rw"}, \code{"r"} or \code{"w"} indicating
\item{INTENT}{character vector of the same length as the number of arguments of the compiled function.
Accepted strings are \code{"rw"}, \code{"r"}, and \code{"w"}, which indicate
whether the intent of the argument is "read and write", "read", or "write", respectively.
If the INTENT of an argument is \code{"rw"}, the R object is copied and the
compiled function receives a pointer to that copy.
......@@ -43,16 +43,16 @@ which can use this argument to ensure that no other package can override their e
and also speeds up the search.}
\item{VERBOSE}{numeric vector of length 1. If \code{0}, no warnings are printed.
If \code{1} warnings are printed (which may help to improve the performance of the call),
If \code{2} additional debug information is given as warnings.
If \code{1}, warnings are printed, which help to improve the performance of the call.
If \code{2}, additional debug information is given as warnings.
The default value can be changed via the \code{dotCall64.verbose} option, which is set to \code{0} by default.}
}
\value{
list of R objects similar to the list of arguments specified as \code{...} arguments.
The objects of the list reflect the changes made by the compiled C or Fortran code.
The objects of the list reflect the changes made by the compiled C or Fortran function.
}
\description{
\code{.C64} can be used to call compiled and loaded C functions and Fortran subroutines.
\code{.C64} can be used to call compiled and loaded C/C++ functions and Fortran subroutines.
\code{.C64} is similar to \code{\link{.C}} and \code{\link{.Fortran}}, but
\enumerate{
\item supports long vectors, i.e., vectors with more than \code{2^31-1} elements
......@@ -74,7 +74,7 @@ This is then used to duplicate R objects if and only if necessary.
## output[0] = input[index[0] - 1];
## }
##
## We can use .C64() the call it from R:
## We can use .C64() to call it from R:
.C64("get_c", SIGNATURE = c("double", "integer", "double"),
input = 1:10, index = 9, output = double(1))$output
......@@ -97,7 +97,6 @@ x_long[9] <- 9; x_long[2^31] <- -1
## Now, we can use .C64() to call the function from R.
.C64("get64_c", SIGNATURE = c("double", "int64", "double"),
input = x_long, index = 2^31, output = double(1))$output
## Note that 2^31 is of type double and .C64() casts it into an
## int64_t type before calling the C function get64_c().
......