summaryrefslogtreecommitdiff
path: root/lib/GSL/Special/Internal.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/GSL/Special/Internal.hs')
-rw-r--r--lib/GSL/Special/Internal.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/GSL/Special/Internal.hs b/lib/GSL/Special/Internal.hs
index c7455d9..ad1aaa2 100644
--- a/lib/GSL/Special/Internal.hs
+++ b/lib/GSL/Special/Internal.hs
@@ -25,7 +25,7 @@ module GSL.Special.Internal (
25where 25where
26 26
27import Foreign 27import Foreign
28import Data.Packed.Internal.Common(check,(//)) 28import Data.Packed.Internal(check,(//))
29 29
30 30
31data Precision = PrecDouble | PrecSingle | PrecApprox 31data Precision = PrecDouble | PrecSingle | PrecApprox
@@ -39,10 +39,10 @@ type Gsl_mode_t = Int
39 39
40---------------------------------------------------------------- 40----------------------------------------------------------------
41-- | access to a sf_result 41-- | access to a sf_result
42createSFR :: Storable a => t -> (Ptr a -> IO Int) -> (a, a) 42createSFR :: Storable a => String -> (Ptr a -> IO Int) -> (a, a)
43createSFR s f = unsafePerformIO $ do 43createSFR s f = unsafePerformIO $ do
44 p <- mallocArray 2 44 p <- mallocArray 2
45 f p // check "createSFR" [] 45 f p // check s []
46 [val,err] <- peekArray 2 p 46 [val,err] <- peekArray 2 p
47 free p 47 free p
48 return (val,err) 48 return (val,err)
@@ -52,12 +52,12 @@ createSFR s f = unsafePerformIO $ do
52-- the sf_result_e10 contains two doubles and the exponent 52-- the sf_result_e10 contains two doubles and the exponent
53 53
54-- | acces to sf_result_e10 54-- | acces to sf_result_e10
55createSFR_E10 :: (Storable t2, Storable t3, Storable t1) => t -> (Ptr a -> IO Int) -> (t1, t2, t3) 55createSFR_E10 :: (Storable t2, Storable t3, Storable t1) => String -> (Ptr a -> IO Int) -> (t1, t2, t3)
56createSFR_E10 s f = unsafePerformIO $ do 56createSFR_E10 s f = unsafePerformIO $ do
57 let sd = sizeOf (0::Double) 57 let sd = sizeOf (0::Double)
58 let si = sizeOf (0::Int) 58 let si = sizeOf (0::Int)
59 p <- mallocBytes (2*sd + si) 59 p <- mallocBytes (2*sd + si)
60 f p // check "createSFR_E10" [] 60 f p // check s []
61 val <- peekByteOff p 0 61 val <- peekByteOff p 0
62 err <- peekByteOff p sd 62 err <- peekByteOff p sd
63 expo <- peekByteOff p (2*sd) 63 expo <- peekByteOff p (2*sd)