module System.Expect.ExpectBindings where
import Foreign
import Foreign.C.Types
import Foreign.C.String
import IO
newtype ExpType = ExpType { unExpType :: CInt }
data ExpCase = ExpCase { pattern :: CString
, regexp :: Ptr ()
, exptype :: ExpType
, value :: CInt }
instance Storable ExpCase where
alignment _ = 4
sizeOf _ = (16)
peek ptr = do
p <- (\hsc_ptr -> peekByteOff hsc_ptr 0) ptr
r <- (\hsc_ptr -> peekByteOff hsc_ptr 4) ptr
t <- (\hsc_ptr -> peekByteOff hsc_ptr 8) ptr
v <- (\hsc_ptr -> peekByteOff hsc_ptr 12) ptr
return $ ExpCase p r (ExpType t) v
poke ptr (ExpCase p r t v) = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr p
((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr r
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr (unExpType t)
((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr v
expExact :: ExpType
expExact = ExpType 2
expRegexp :: ExpType
expRegexp = ExpType 3
expGlob :: ExpType
expGlob = ExpType 1
expNull :: ExpType
expNull = ExpType 5
expEnd :: ExpType
expEnd = ExpType 0
foreign import ccall "&" exp_loguser :: Ptr CInt
foreign import ccall exp_popen :: CString -> IO (Ptr CFile)
foreign import ccall exp_fexpectv :: Ptr CFile -> Ptr ExpCase -> IO CInt