module SDL.Raw.Filesystem (
getBasePath,
getPrefPath,
allocRW,
freeRW,
rwFromConstMem,
rwFromFP,
rwFromFile,
rwFromMem,
rwClose,
rwRead,
rwSeek,
rwTell,
rwWrite,
readBE16,
readBE32,
readBE64,
readLE16,
readLE32,
readLE64,
writeBE16,
writeBE32,
writeBE64,
writeLE16,
writeLE32,
writeLE64
) where
import Control.Monad.IO.Class
import Data.Int
import Data.Word
import Foreign.C.String
import Foreign.C.Types
import Foreign.Ptr
import SDL.Raw.Types
foreign import ccall "SDL.h SDL_GetBasePath" getBasePathFFI :: IO CString
foreign import ccall "SDL.h SDL_GetPrefPath" getPrefPathFFI :: CString -> CString -> IO CString
foreign import ccall "SDL.h SDL_AllocRW" allocRWFFI :: IO (Ptr RWops)
foreign import ccall "SDL.h SDL_FreeRW" freeRWFFI :: Ptr RWops -> IO ()
foreign import ccall "SDL.h SDL_RWFromConstMem" rwFromConstMemFFI :: Ptr () -> CInt -> IO (Ptr RWops)
foreign import ccall "SDL.h SDL_RWFromFP" rwFromFPFFI :: Ptr () -> Bool -> IO (Ptr RWops)
foreign import ccall "SDL.h SDL_RWFromFile" rwFromFileFFI :: CString -> CString -> IO (Ptr RWops)
foreign import ccall "SDL.h SDL_RWFromMem" rwFromMemFFI :: Ptr () -> CInt -> IO (Ptr RWops)
foreign import ccall "sdlhelper.h SDLHelper_RWclose" rwCloseFFI :: Ptr RWops -> IO CInt
foreign import ccall "sdlhelper.h SDLHelper_RWread" rwReadFFI :: Ptr RWops -> Ptr () -> CSize -> CSize -> IO CSize
foreign import ccall "sdlhelper.h SDLHelper_RWseek" rwSeekFFI :: Ptr RWops -> Int64 -> CInt -> IO Int64
foreign import ccall "sdlhelper.h SDLHelper_RWtell" rwTellFFI :: Ptr RWops -> IO Int64
foreign import ccall "sdlhelper.h SDLHelper_RWwrite" rwWriteFFI :: Ptr RWops -> Ptr () -> CSize -> CSize -> IO CSize
foreign import ccall "SDL.h SDL_ReadBE16" readBE16FFI :: Ptr RWops -> IO Word16
foreign import ccall "SDL.h SDL_ReadBE32" readBE32FFI :: Ptr RWops -> IO Word32
foreign import ccall "SDL.h SDL_ReadBE64" readBE64FFI :: Ptr RWops -> IO Word64
foreign import ccall "SDL.h SDL_ReadLE16" readLE16FFI :: Ptr RWops -> IO Word16
foreign import ccall "SDL.h SDL_ReadLE32" readLE32FFI :: Ptr RWops -> IO Word32
foreign import ccall "SDL.h SDL_ReadLE64" readLE64FFI :: Ptr RWops -> IO Word64
foreign import ccall "SDL.h SDL_WriteBE16" writeBE16FFI :: Ptr RWops -> Word16 -> IO CSize
foreign import ccall "SDL.h SDL_WriteBE32" writeBE32FFI :: Ptr RWops -> Word32 -> IO CSize
foreign import ccall "SDL.h SDL_WriteBE64" writeBE64FFI :: Ptr RWops -> Word64 -> IO CSize
foreign import ccall "SDL.h SDL_WriteLE16" writeLE16FFI :: Ptr RWops -> Word16 -> IO CSize
foreign import ccall "SDL.h SDL_WriteLE32" writeLE32FFI :: Ptr RWops -> Word32 -> IO CSize
foreign import ccall "SDL.h SDL_WriteLE64" writeLE64FFI :: Ptr RWops -> Word64 -> IO CSize
getBasePath :: MonadIO m => m CString
getBasePath :: forall (m :: Type -> Type). MonadIO m => m CString
getBasePath = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO IO CString
getBasePathFFI
{-# INLINE getBasePath #-}
getPrefPath :: MonadIO m => CString -> CString -> m CString
getPrefPath :: forall (m :: Type -> Type).
MonadIO m =>
CString -> CString -> m CString
getPrefPath CString
v1 CString
v2 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ CString -> CString -> IO CString
getPrefPathFFI CString
v1 CString
v2
{-# INLINE getPrefPath #-}
allocRW :: MonadIO m => m (Ptr RWops)
allocRW :: forall (m :: Type -> Type). MonadIO m => m (Ptr RWops)
allocRW = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO IO (Ptr RWops)
allocRWFFI
{-# INLINE allocRW #-}
freeRW :: MonadIO m => Ptr RWops -> m ()
freeRW :: forall (m :: Type -> Type). MonadIO m => Ptr RWops -> m ()
freeRW Ptr RWops
v1 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> IO ()
freeRWFFI Ptr RWops
v1
{-# INLINE freeRW #-}
rwFromConstMem :: MonadIO m => Ptr () -> CInt -> m (Ptr RWops)
rwFromConstMem :: forall (m :: Type -> Type).
MonadIO m =>
Ptr () -> CInt -> m (Ptr RWops)
rwFromConstMem Ptr ()
v1 CInt
v2 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr () -> CInt -> IO (Ptr RWops)
rwFromConstMemFFI Ptr ()
v1 CInt
v2
{-# INLINE rwFromConstMem #-}
rwFromFP :: MonadIO m => Ptr () -> Bool -> m (Ptr RWops)
rwFromFP :: forall (m :: Type -> Type).
MonadIO m =>
Ptr () -> Bool -> m (Ptr RWops)
rwFromFP Ptr ()
v1 Bool
v2 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr () -> Bool -> IO (Ptr RWops)
rwFromFPFFI Ptr ()
v1 Bool
v2
{-# INLINE rwFromFP #-}
rwFromFile :: MonadIO m => CString -> CString -> m (Ptr RWops)
rwFromFile :: forall (m :: Type -> Type).
MonadIO m =>
CString -> CString -> m (Ptr RWops)
rwFromFile CString
v1 CString
v2 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ CString -> CString -> IO (Ptr RWops)
rwFromFileFFI CString
v1 CString
v2
{-# INLINE rwFromFile #-}
rwFromMem :: MonadIO m => Ptr () -> CInt -> m (Ptr RWops)
rwFromMem :: forall (m :: Type -> Type).
MonadIO m =>
Ptr () -> CInt -> m (Ptr RWops)
rwFromMem Ptr ()
v1 CInt
v2 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr () -> CInt -> IO (Ptr RWops)
rwFromMemFFI Ptr ()
v1 CInt
v2
{-# INLINE rwFromMem #-}
rwClose :: MonadIO m => Ptr RWops -> m CInt
rwClose :: forall (m :: Type -> Type). MonadIO m => Ptr RWops -> m CInt
rwClose Ptr RWops
v1 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> IO CInt
rwCloseFFI Ptr RWops
v1
{-# INLINE rwClose #-}
rwRead :: MonadIO m => Ptr RWops -> Ptr () -> CSize -> CSize -> m CSize
rwRead :: forall (m :: Type -> Type).
MonadIO m =>
Ptr RWops -> Ptr () -> CSize -> CSize -> m CSize
rwRead Ptr RWops
v1 Ptr ()
v2 CSize
v3 CSize
v4 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> Ptr () -> CSize -> CSize -> IO CSize
rwReadFFI Ptr RWops
v1 Ptr ()
v2 CSize
v3 CSize
v4
{-# INLINE rwRead #-}
rwSeek :: MonadIO m => Ptr RWops -> Int64 -> CInt -> m Int64
rwSeek :: forall (m :: Type -> Type).
MonadIO m =>
Ptr RWops -> Int64 -> CInt -> m Int64
rwSeek Ptr RWops
v1 Int64
v2 CInt
v3 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> Int64 -> CInt -> IO Int64
rwSeekFFI Ptr RWops
v1 Int64
v2 CInt
v3
{-# INLINE rwSeek #-}
rwTell :: MonadIO m => Ptr RWops -> m Int64
rwTell :: forall (m :: Type -> Type). MonadIO m => Ptr RWops -> m Int64
rwTell Ptr RWops
v1 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> IO Int64
rwTellFFI Ptr RWops
v1
{-# INLINE rwTell #-}
rwWrite :: MonadIO m => Ptr RWops -> Ptr () -> CSize -> CSize -> m CSize
rwWrite :: forall (m :: Type -> Type).
MonadIO m =>
Ptr RWops -> Ptr () -> CSize -> CSize -> m CSize
rwWrite Ptr RWops
v1 Ptr ()
v2 CSize
v3 CSize
v4 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> Ptr () -> CSize -> CSize -> IO CSize
rwWriteFFI Ptr RWops
v1 Ptr ()
v2 CSize
v3 CSize
v4
{-# INLINE rwWrite #-}
readBE16 :: MonadIO m => Ptr RWops -> m Word16
readBE16 :: forall (m :: Type -> Type). MonadIO m => Ptr RWops -> m Word16
readBE16 Ptr RWops
v1 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> IO Word16
readBE16FFI Ptr RWops
v1
{-# INLINE readBE16 #-}
readBE32 :: MonadIO m => Ptr RWops -> m Word32
readBE32 :: forall (m :: Type -> Type). MonadIO m => Ptr RWops -> m Word32
readBE32 Ptr RWops
v1 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> IO Word32
readBE32FFI Ptr RWops
v1
{-# INLINE readBE32 #-}
readBE64 :: MonadIO m => Ptr RWops -> m Word64
readBE64 :: forall (m :: Type -> Type). MonadIO m => Ptr RWops -> m Word64
readBE64 Ptr RWops
v1 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> IO Word64
readBE64FFI Ptr RWops
v1
{-# INLINE readBE64 #-}
readLE16 :: MonadIO m => Ptr RWops -> m Word16
readLE16 :: forall (m :: Type -> Type). MonadIO m => Ptr RWops -> m Word16
readLE16 Ptr RWops
v1 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> IO Word16
readLE16FFI Ptr RWops
v1
{-# INLINE readLE16 #-}
readLE32 :: MonadIO m => Ptr RWops -> m Word32
readLE32 :: forall (m :: Type -> Type). MonadIO m => Ptr RWops -> m Word32
readLE32 Ptr RWops
v1 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> IO Word32
readLE32FFI Ptr RWops
v1
{-# INLINE readLE32 #-}
readLE64 :: MonadIO m => Ptr RWops -> m Word64
readLE64 :: forall (m :: Type -> Type). MonadIO m => Ptr RWops -> m Word64
readLE64 Ptr RWops
v1 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> IO Word64
readLE64FFI Ptr RWops
v1
{-# INLINE readLE64 #-}
writeBE16 :: MonadIO m => Ptr RWops -> Word16 -> m CSize
writeBE16 :: forall (m :: Type -> Type).
MonadIO m =>
Ptr RWops -> Word16 -> m CSize
writeBE16 Ptr RWops
v1 Word16
v2 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> Word16 -> IO CSize
writeBE16FFI Ptr RWops
v1 Word16
v2
{-# INLINE writeBE16 #-}
writeBE32 :: MonadIO m => Ptr RWops -> Word32 -> m CSize
writeBE32 :: forall (m :: Type -> Type).
MonadIO m =>
Ptr RWops -> Word32 -> m CSize
writeBE32 Ptr RWops
v1 Word32
v2 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> Word32 -> IO CSize
writeBE32FFI Ptr RWops
v1 Word32
v2
{-# INLINE writeBE32 #-}
writeBE64 :: MonadIO m => Ptr RWops -> Word64 -> m CSize
writeBE64 :: forall (m :: Type -> Type).
MonadIO m =>
Ptr RWops -> Word64 -> m CSize
writeBE64 Ptr RWops
v1 Word64
v2 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> Word64 -> IO CSize
writeBE64FFI Ptr RWops
v1 Word64
v2
{-# INLINE writeBE64 #-}
writeLE16 :: MonadIO m => Ptr RWops -> Word16 -> m CSize
writeLE16 :: forall (m :: Type -> Type).
MonadIO m =>
Ptr RWops -> Word16 -> m CSize
writeLE16 Ptr RWops
v1 Word16
v2 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> Word16 -> IO CSize
writeLE16FFI Ptr RWops
v1 Word16
v2
{-# INLINE writeLE16 #-}
writeLE32 :: MonadIO m => Ptr RWops -> Word32 -> m CSize
writeLE32 :: forall (m :: Type -> Type).
MonadIO m =>
Ptr RWops -> Word32 -> m CSize
writeLE32 Ptr RWops
v1 Word32
v2 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> Word32 -> IO CSize
writeLE32FFI Ptr RWops
v1 Word32
v2
{-# INLINE writeLE32 #-}
writeLE64 :: MonadIO m => Ptr RWops -> Word64 -> m CSize
writeLE64 :: forall (m :: Type -> Type).
MonadIO m =>
Ptr RWops -> Word64 -> m CSize
writeLE64 Ptr RWops
v1 Word64
v2 = forall (m :: Type -> Type) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ Ptr RWops -> Word64 -> IO CSize
writeLE64FFI Ptr RWops
v1 Word64
v2
{-# INLINE writeLE64 #-}