Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions System/Expect/ExpectBindings.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ 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

data TCL_Interp = TCL_Interp

foreign import ccall "Tcl_Init" tcl_Init :: Ptr TCL_Interp -> IO ()
foreign import ccall "Expect_Init" expect_Init :: Ptr TCL_Interp -> IO ()
foreign import ccall "Tcl_CreateInterp" tcl_CreateInterp :: IO (Ptr TCL_Interp)
8 changes: 8 additions & 0 deletions System/Expect/ExpectInterface.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module System.Expect.ExpectInterface
({-- The contents of the binding that are to be further exposed --}
ExpectType(ExpExact,ExpRegex,ExpGlob,ExpNull)
{-- The custom interface --}
,initExpect
,ExpectCase(ExpectCase,expectPattern,expectType,expectValue)
,ExpectProc(ExpectProc,expectHandle,expectFilePtr)
,muteExpect,unmuteExpect
Expand Down Expand Up @@ -40,6 +41,13 @@ data ExpectCase = ExpectCase { -- | Pattern to match against.
, expectValue :: Int
}

-- | tcl and expect initialization.
initExpect :: IO ()
initExpect = do
interp <- tcl_CreateInterp
tcl_Init interp
expect_Init interp

-- | Proc created by spawnExpect. Contains both the
-- CFile pointer and a Haskell handle, so the
-- translation needs only be done once.
Expand Down