inline-r 0.7.2.0 → 0.7.3.0
raw patch · 6 files changed
+55/−6 lines, 6 filessetup-changed
Files
- LICENSE +28/−0
- Setup.hs +5/−0
- inline-r.cabal +2/−1
- src/Foreign/R.chs +5/−0
- src/Language/R/Globals.hs +3/−0
- src/Language/R/Instance.hs +12/−5
+ LICENSE view
@@ -0,0 +1,28 @@+Copyright (c) 2013-2015 Amgen, Inc.+Copyright (c) 2015 Tweag I/O Limited.++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:+1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+3. The names of the author may not be used to endorse or promote+ products derived from this software without specific prior written+ permission.++THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF+SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,5 @@+import Distribution.Simple++main :: IO ()+main = defaultMain+
inline-r.cabal view
@@ -1,6 +1,7 @@ name: inline-r-version: 0.7.2.0+version: 0.7.3.0 license: BSD3+license-file: LICENSE copyright: Copyright (c) 2013-2015 Amgen, Inc. Copyright (c) 2015 Tweag I/O Limited. author: Mathieu Boespflug, Facundo Dominguez, Alexander Vershilov
src/Foreign/R.chs view
@@ -127,6 +127,7 @@ , baseEnv , emptyEnv , globalEnv+ , signalHandlers -- * Communication with runtime , printValue -- * Low level info header access@@ -173,6 +174,7 @@ #define USE_RINTERNALS #include <R.h>+#include <Rinterface.h> #include <Rinternals.h> #include <R_ext/Memory.h> #include "missing_r.h"@@ -578,6 +580,9 @@ -- | Global environment. foreign import ccall "&R_GlobalEnv" globalEnv :: Ptr (SEXP G R.Env)++-- | Signal handler switch+foreign import ccall "&R_SignalHandlers" signalHandlers :: Ptr CInt ---------------------------------------------------------------------------------- -- Structure header --
src/Language/R/Globals.hs view
@@ -19,6 +19,7 @@ -- * R Internal constants , isRInteractive , inputHandlers+ , signalHandlersPtr -- * R global constants -- $ghci-bug , pokeRVariables@@ -59,6 +60,7 @@ , Ptr (SEXP G 'R.Symbol) , Ptr CInt , Ptr (Ptr R.InputHandler)+ , Ptr CInt ) -- | Stores R variables in a static location. This makes the variables'@@ -76,6 +78,7 @@ , missingArgPtr , isRInteractive , inputHandlersPtr+ , signalHandlersPtr ) = unsafePerformIO $ peek rVariables >>= deRefStablePtr -- | Special value to which all symbols unbound in the current environment
src/Language/R/Instance.hs view
@@ -140,9 +140,13 @@ data Config = Config { -- | Program name. If 'Nothing' then the value of 'getProgName' will be -- used.- configProgName :: Maybe String+ configProgName :: Last String -- | Command-line arguments. , configArgs :: [String]++ -- | Set to 'True' if you're happy to let R install its own signal handlers+ -- during initialization.+ , configSignalHandlers :: Last Bool } instance Default Config where@@ -153,11 +157,12 @@ mappend cfg1 cfg2 = Config { configProgName = configProgName cfg1 <> configProgName cfg2 , configArgs = configArgs cfg1 <> configArgs cfg2+ , configSignalHandlers = configSignalHandlers cfg1 <> configSignalHandlers cfg2 } -- | Default argument to pass to 'initialize'. defaultConfig :: Config-defaultConfig = Config Nothing ["--vanilla", "--silent"]+defaultConfig = Config (Last Nothing) ["--vanilla", "--silent"] (Last (Just False)) -- | Populate environment with @R_HOME@ variable if it does not exist. populateEnv :: IO ()@@ -200,8 +205,7 @@ -- main thread of the program. That is, from the same thread of execution that -- the program's @main@ function is running on. In GHCi, use @-fno-ghci-sandbox@ -- to achieve this.-initialize :: Config- -> IO ()+initialize :: Config -> IO () initialize Config{..} = do #ifdef H_ARCH_UNIX #ifdef H_ARCH_UNIX_DARWIN@@ -239,12 +243,15 @@ , R.missingArg , R.isRInteractive , R.inputHandlers+ , R.signalHandlers ) populateEnv- args <- (:) <$> maybe getProgName return configProgName+ args <- (:) <$> maybe getProgName return (getLast configProgName) <*> pure configArgs argv <- mapM newCString args let argc = length argv+ unless (maybe False id $ getLast configSignalHandlers) $+ poke signalHandlersPtr 0 newCArray argv $ R.initEmbeddedR argc poke isRInteractive 0 poke isRInitializedPtr 1