{-# LINE 1 "src/Sound/ALSA/Sequencer/Marshal/Client.hsc" #-} -------------------------------------------------------------------------------- {-# LINE 2 "src/Sound/ALSA/Sequencer/Marshal/Client.hsc" #-} -- | -- Module : Sound.ALSA.Sequencer.Marshal -- Copyright : (c) Henning Thielemann, 2010 -- (c) Iavor S. Diatchki, 2007 -- License : BSD3 -- -- Maintainer: Henning Thielemann -- Stability : provisional -- -- PRIVATE MODULE. -- -- Here we have the various types used by the library, -- and how they are imported\/exported to C. -- -- NOTE: In the translations bellow we make the following assumptions -- about the sizes of C types. -- CChar = 8 bits -- CShort = 16 bit -- CInt = 32 bits -------------------------------------------------------------------------------- module Sound.ALSA.Sequencer.Marshal.Client where {-# LINE 26 "src/Sound/ALSA/Sequencer/Marshal/Client.hsc" #-} import qualified Sound.ALSA.Sequencer.Utility as U import Foreign.C.Types (CInt, ) import Foreign.Storable (Storable, ) import Data.Word (Word8, ) -- | The type of client identifiers. newtype T = Cons Word8 deriving (Eq, Ord, Storable) instance Show T where showsPrec prec (Cons x) = U.showsRecord prec "Client" [U.showsField x] system :: T system = Cons 0 subscribers :: T subscribers = Cons 254 broadcast :: T broadcast = Cons 255 unknown :: T unknown = Cons 253 {-# LINE 46 "src/Sound/ALSA/Sequencer/Marshal/Client.hsc" #-} exp :: T -> CInt exp (Cons c) = fromIntegral c imp :: CInt -> T imp p = Cons (fromIntegral p) -- | The different types of clients. data Type = User | Kernel impType :: CInt -> Type impType x = if x == 1 {-# LINE 61 "src/Sound/ALSA/Sequencer/Marshal/Client.hsc" #-} then User else Kernel