view R/rdyncall/R/pack.R @ 61:c5a69c454963 default tip

- allow use of 'None' with 'Z' - bumped version to 1.4 (be in sync current dyncall version)
author Tassilo Philipp
date Mon, 03 Apr 2023 19:06:07 +0200
parents 0cfcc391201f
children
line wrap: on
line source

# Package: rdyncall
# File: R/pack.R
# Description: (un-)packing functions for access to C aggregate (struct/union) data types. 

.pack   <- function(x, offset, sigchar, value)
{
  char1 <- substr(sigchar,1,1)
  if (char1 == "*") char1 <- "p"
  .Call("pack", x, as.integer(offset), char1, value, PACKAGE="rdyncall" )
}

.unpack <- function(x, offset, sigchar)
{
  sigchar <- char1 <- substr(sigchar,1,1)
  if (char1 == "*") sigchar <- "p"
  x <- .Call("unpack", x, as.integer(offset), sigchar, PACKAGE="rdyncall" )
  if (char1 == "*")
  {
    attr(x,"basetype") <- substr(sigchar,2,nchar(sigchar))
  }
  return(x)
}