inline-r 0.9.0.0 → 0.9.0.1
raw patch · 5 files changed
+36/−12 lines, 5 filesdep ~vector
Dependency ranges changed: vector
Files
- inline-r.cabal +2/−2
- src/Foreign/R.chs +3/−1
- src/Foreign/R/Internal.hsc +21/−7
- src/Language/R/Debug.hs +1/−1
- src/Language/R/Instance.hs +9/−1
inline-r.cabal view
@@ -1,5 +1,5 @@ name: inline-r-version: 0.9.0.0+version: 0.9.0.1 license: BSD3 license-file: LICENSE copyright: Copyright (c) 2013-2015 Amgen, Inc.@@ -92,7 +92,7 @@ , th-lift >= 0.6 , th-orphans >= 0.8 , transformers >= 0.3- , vector >= 0.10 && < 0.12+ , vector >= 0.10 && < 0.13 hs-source-dirs: src includes: cbits/missing_r.h c-sources: cbits/missing_r.c
src/Foreign/R.chs view
@@ -61,8 +61,10 @@ , mkWeakRef -- * Node attributes , typeOf- , setAttribute+ , isS4+ , setAttributes , getAttribute+ , getAttributes -- * Node accessor functions -- ** Lists , cons
src/Foreign/R/Internal.hsc view
@@ -314,14 +314,28 @@ -- Attribute header -- ------------------------------------------------------------------------------- +-- | Check if object is an S4 object.+--+-- This is a function call so it will be more precise than using 'typeOf'.+isS4 :: SEXP s ty -> Bool+isS4 s = (>0) $ cisS4 (unsexp s)+ -- | Get the attribute list from the given object.-getAttribute :: SEXP s a -> IO (SEXP s b)-getAttribute s = sexp <$> cATTRIB (unsexp s)+getAttributes :: SEXP s a -> IO (SEXP s b)+getAttributes s = sexp <$> cAttrib (unsexp s) --- | Set the attribute list.-setAttribute :: SEXP s a -> SEXP s b -> IO ()-setAttribute s v = cSET_ATTRIB (unsexp s) (castPtr $ unsexp v)+-- | Get attribute with the given name.+getAttribute :: SEXP s a -- ^ Value+ -> SEXP s2 b -- ^ Attribute name+ -> SEXP s c+getAttribute a b = sexp $ cgetAttrib (unsexp a) (unsexp b) -foreign import capi unsafe "Rinternals.h ATTRIB" cATTRIB :: SEXP0 -> IO SEXP0-foreign import capi unsafe "Rinternals.h SET_ATTRIB" cSET_ATTRIB :: SEXP0 -> SEXP0 -> IO () +-- | Set the attribute list.+setAttributes :: SEXP s a -> SEXP s b -> IO ()+setAttributes s v = csetAttrib (unsexp s) (castPtr $ unsexp v)++foreign import capi unsafe "Rinternals.h ATTRIB" cAttrib :: SEXP0 -> IO SEXP0+foreign import capi unsafe "Rinternals.h SET_ATTRIB" csetAttrib :: SEXP0 -> SEXP0 -> IO ()+foreign import capi unsafe "Rinternals.h Rf_getAttrib" cgetAttrib :: SEXP0 -> SEXP0 -> SEXP0+foreign import capi unsafe "Rinternals.h Rf_isS4" cisS4 :: SEXP0 -> Int
src/Language/R/Debug.hs view
@@ -72,7 +72,7 @@ nil = R.unsexp H.nilValue miss = R.unsexp H.missingArg info = unsafePerformIO $ R.peekInfo x- attr = unsafePerformIO $ R.getAttribute x+ attr = unsafePerformIO $ R.getAttributes x tp = T.pack . show $ R.infoType info go :: SEXP s a -> Value go y | R.unsexp y == ub = A.String "UnboundValue"
src/Language/R/Instance.hs view
@@ -145,7 +145,15 @@ , configArgs :: [String] -- | Set to 'True' if you're happy to let R install its own signal handlers- -- during initialization.+ -- during initialization. By default R sets following signal handlers:+ --+ -- * SIGPIPE - ignore signal;+ -- * SIGUSR1 - save workspace and terminate program;+ -- * SIGUSR2 - terminate program without saving workspace;+ -- * SIGINT - cancel execution of the current function.+ --+ -- *N.B.* When program is terminated, haskell runtime will not have any chances+ -- to run any exception handlers or finalizers. , configSignalHandlers :: Last Bool }