projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2001-08-17 08:35:24 by rrt]
[ghc-hetmet.git]
/
ghc
/
lib
/
std
/
PrelStable.lhs
diff --git
a/ghc/lib/std/PrelStable.lhs
b/ghc/lib/std/PrelStable.lhs
index
fb12158
..
2d6f8ae
100644
(file)
--- a/
ghc/lib/std/PrelStable.lhs
+++ b/
ghc/lib/std/PrelStable.lhs
@@
-1,15
+1,17
@@
% -----------------------------------------------------------------------------
% -----------------------------------------------------------------------------
-% $Id: PrelStable.lhs,v 1.2 1999/09/19 19:12:42 sof Exp $
+% $Id: PrelStable.lhs,v 1.9 2001/03/25 09:57:26 qrczak Exp $
%
%
-% (c) The GHC Team, 1992-1999
+% (c) The GHC Team, 1992-2000
%
%
+\section{Module @PrelStable@}
+
\begin{code}
{-# OPTIONS -fno-implicit-prelude #-}
module PrelStable
( StablePtr(..)
\begin{code}
{-# OPTIONS -fno-implicit-prelude #-}
module PrelStable
( StablePtr(..)
- , makeStablePtr -- :: a -> IO (StablePtr a)
+ , newStablePtr -- :: a -> IO (StablePtr a)
, deRefStablePtr -- :: StablePtr a -> a
, freeStablePtr -- :: StablePtr a -> IO ()
) where
, deRefStablePtr -- :: StablePtr a -> a
, freeStablePtr -- :: StablePtr a -> IO ()
) where
@@
-20,21
+22,19
@@
import PrelIOBase
-----------------------------------------------------------------------------
-- Stable Pointers
-----------------------------------------------------------------------------
-- Stable Pointers
-data StablePtr a = StablePtr (StablePtr# a)
+data StablePtr a = StablePtr (StablePtr# a)
instance CCallable (StablePtr a)
instance CCallable (StablePtr a)
-instance CCallable (StablePtr# a)
instance CReturnable (StablePtr a)
instance CReturnable (StablePtr a)
-makeStablePtr :: a -> IO (StablePtr a)
-deRefStablePtr :: StablePtr a -> IO a
-foreign import "freeStablePtr" freeStablePtr :: StablePtr a -> IO ()
-
-makeStablePtr a = IO $ \ s ->
+newStablePtr :: a -> IO (StablePtr a)
+newStablePtr a = IO $ \ s ->
case makeStablePtr# a s of (# s', sp #) -> (# s', StablePtr sp #)
case makeStablePtr# a s of (# s', sp #) -> (# s', StablePtr sp #)
+deRefStablePtr :: StablePtr a -> IO a
deRefStablePtr (StablePtr sp) = IO $ \s -> deRefStablePtr# sp s
deRefStablePtr (StablePtr sp) = IO $ \s -> deRefStablePtr# sp s
+foreign import unsafe freeStablePtr :: StablePtr a -> IO ()
instance Eq (StablePtr a) where
(StablePtr sp1) == (StablePtr sp2) =
instance Eq (StablePtr a) where
(StablePtr sp1) == (StablePtr sp2) =