-ctx2ptr :: MateCtx -> IO (Ptr ())
-ctx2ptr ctx = do
- ptr <- newStablePtr ctx
- return $ castStablePtrToPtr ptr
-
-ptr2ctx :: Ptr () -> IO MateCtx
-ptr2ctx ptr = deRefStablePtr (castPtrToStablePtr ptr :: StablePtr MateCtx)
-
-
-setMethodMap :: MethodMap -> IO ()
-setMethodMap m = do
- ctx <- get_mate_context >>= ptr2ctx
- ctx2ptr ctx { ctxMethodMap = m } >>= set_mate_context
-
-getMethodMap :: IO MethodMap
-getMethodMap = do
- ctx <- get_mate_context >>= ptr2ctx
- return $ ctxMethodMap ctx
-
-
-setTrapMap :: TrapMap -> IO ()
-setTrapMap m = do
- ctx <- get_mate_context >>= ptr2ctx
- ctx2ptr ctx { ctxTrapMap = m } >>= set_mate_context
-
-getTrapMap :: IO TrapMap
-getTrapMap = do
- ctx <- get_mate_context >>= ptr2ctx
- return $ ctxTrapMap ctx
-
-
-setClassMap :: ClassMap -> IO ()
-setClassMap m = do
- ctx <- get_mate_context >>= ptr2ctx
- ctx2ptr ctx { ctxClassMap = m } >>= set_mate_context
-
-getClassMap :: IO ClassMap
-getClassMap = do
- ctx <- get_mate_context >>= ptr2ctx
- return $ ctxClassMap ctx
-
-
-setVirtualMap :: VirtualMap -> IO ()
-setVirtualMap m = do
- ctx <- get_mate_context >>= ptr2ctx
- ctx2ptr ctx { ctxVirtualMap = m } >>= set_mate_context
-
-getVirtualMap :: IO VirtualMap
-getVirtualMap = do
- ctx <- get_mate_context >>= ptr2ctx
- return $ ctxVirtualMap ctx