packages feed

ViennaRNA-bindings 0.1.2.0 → 0.1.2.2

raw patch · 4 files changed

+29/−34 lines, 4 files

Files

BioInf/ViennaRNA/Bindings/FFI/CoFold.chs view
@@ -33,22 +33,22 @@ {#pointer *cofoldF as CofoldFPtr -> CofoldF #}  data CofoldF = CofoldF-  { f0ab :: Double-  , fab  :: Double-  , fcab :: Double-  , fa   :: Double-  , fb   :: Double+  { f0ab :: {-# UNPACK #-} !Double+  , fab  :: {-# UNPACK #-} !Double+  , fcab :: {-# UNPACK #-} !Double+  , fa   :: {-# UNPACK #-} !Double+  , fb   :: {-# UNPACK #-} !Double   }   deriving (Show)  instance Storable CofoldF where   sizeOf _ = {#sizeof cofoldF#}   alignment _ = sizeOf (undefined :: CDouble)-  peek p = CofoldF <$> liftM unsafeCoerce ({# get cofoldF->F0AB #} p)-                   <*> liftM unsafeCoerce ({# get cofoldF->FAB  #} p)-                   <*> liftM unsafeCoerce ({# get cofoldF->FcAB #} p)-                   <*> liftM unsafeCoerce ({# get cofoldF->FA   #} p)-                   <*> liftM unsafeCoerce ({# get cofoldF->FB   #} p)+  peek p = CofoldF <$> liftM realToFrac ({# get cofoldF->F0AB #} p)+                   <*> liftM realToFrac ({# get cofoldF->FAB  #} p)+                   <*> liftM realToFrac ({# get cofoldF->FcAB #} p)+                   <*> liftM realToFrac ({# get cofoldF->FA   #} p)+                   <*> liftM realToFrac ({# get cofoldF->FB   #} p)  -- | @@ -75,11 +75,12 @@ ffiCoPartitionFunction :: Int -> String -> IO (CofoldF,String,A.Array (Int,Int) Double) ffiCoPartitionFunction cutpoint i =   withCAString i $ \ci ->-  withCAString i $ \cs -> do+  withCAString i $ \cs ->+  alloca         $ \ptr -> do   setCutPoint cutpoint   let n = length i   let z = n * (n+1) `div` 2 +1-  eF <- co_pf_fold_p ci cs >>= peek+  eF <- co_pf_fold_p ptr ci cs >> peek ptr   s  <- peekCAString cs   bp <- {#call export_co_bppm #}   xs <- peekArray z (bp :: Ptr CDouble)@@ -87,22 +88,16 @@   return (eF, s, ar)  -- | Constrained partition function------ NOTE the wrapped C function we @foreign import@ use very dirty--- return-pointer-from-stack stuff. We should fix that. On the other hand, it just--- works, because we immediately peek into the structure and marshall to Haskell.  ffiCoPartitionConstrained :: Int -> String -> String -> IO (CofoldF,String,A.Array (Int,Int) Double) ffiCoPartitionConstrained cutpoint sq st =   withCAString sq $ \csq ->-  withCAString st $ \cst -> do-  print sq-  print st-  print cutpoint+  withCAString st $ \cst ->+  alloca          $ \ptr -> do   setCutPoint cutpoint   let n = length sq   let z = n * (n+1) `div` 2 +1-  eF <- co_pf_fold_constrained_p csq cst 1 >>= peek+  eF <- co_pf_fold_constrained_p ptr csq cst 1 >> peek ptr   s  <- peekCAString cst   bp <- {#call export_co_bppm #}   xs <- peekArray z (bp :: Ptr CDouble)@@ -111,7 +106,7 @@   -foreign import ccall "ffiwrap_co_pf_fold" co_pf_fold_p :: CString -> CString -> IO CofoldFPtr+foreign import ccall "ffiwrap_co_pf_fold" co_pf_fold_p :: CofoldFPtr -> CString -> CString -> IO () -foreign import ccall "ffiwrap_co_pf_fold_constrained" co_pf_fold_constrained_p :: CString -> CString -> Int -> IO CofoldFPtr+foreign import ccall "ffiwrap_co_pf_fold_constrained" co_pf_fold_constrained_p :: CofoldFPtr -> CString -> CString -> Int -> IO () 
ViennaRNA-bindings.cabal view
@@ -1,5 +1,5 @@ name:                ViennaRNA-bindings-version:             0.1.2.0+version:             0.1.2.2 synopsis:            ViennaRNA v2 bindings homepage:            http://www.tbi.univie.ac.at/~choener/ license:             OtherLicense
cbits/ffiwrap_part_func.c view
@@ -15,22 +15,18 @@ }  // wrap the RNAcofold constrained partition function.-//-// TODO the current implementation makes me cry. -cofoldF * ffiwrap_co_pf_fold_constrained (char *sequence, char *structure, int constrained)+void ffiwrap_co_pf_fold_constrained (cofoldF * x, char *sequence, char *structure, int constrained) {-  cofoldF x = co_pf_fold_par (sequence, structure, 0, 1, constrained);-  return &x;+  *x = co_pf_fold_par (sequence, structure, 0, 1, constrained);+  return; }  // wrap RNAcofold partition function-//-// TODO the current implementation makes me cry. -cofoldF * ffiwrap_co_pf_fold (char * inp, char * str)+void ffiwrap_co_pf_fold (cofoldF * x, char * inp, char * str) {-  cofoldF x = co_pf_fold (inp, str);-  return &x;+  *x = co_pf_fold (inp, str);+  return; } 
changelog view
@@ -1,3 +1,7 @@+0.1.2.1++- removed debug statements+ 0.1.2.0  - constrained cofold partition function added