comparison R/rdyncall/R/pack.R @ 0:0cfcc391201f

initial from svn dyncall-1745
author Daniel Adler
date Thu, 19 Mar 2015 22:26:28 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0cfcc391201f
1 # Package: rdyncall
2 # File: R/pack.R
3 # Description: (un-)packing functions for access to C aggregate (struct/union) data types.
4
5 .pack <- function(x, offset, sigchar, value)
6 {
7 char1 <- substr(sigchar,1,1)
8 if (char1 == "*") char1 <- "p"
9 .Call("pack", x, as.integer(offset), char1, value, PACKAGE="rdyncall" )
10 }
11
12 .unpack <- function(x, offset, sigchar)
13 {
14 sigchar <- char1 <- substr(sigchar,1,1)
15 if (char1 == "*") sigchar <- "p"
16 x <- .Call("unpack", x, as.integer(offset), sigchar, PACKAGE="rdyncall" )
17 if (char1 == "*")
18 {
19 attr(x,"basetype") <- substr(sigchar,2,nchar(sigchar))
20 }
21 return(x)
22 }
23