The Scheme Underground Expect package Designed and implemented by David Fisher and Olin Shivers (spawn* THUNK) -> task procedure Spawn* forks a process to execute THUNK, and returns a task data-structure that contains all of the information that expect-package elements need in order to interact with that process. (spawn . EPF) -> task procedure This is syntactic sugar for (spawn* (lambda () (exec-epf EPF))). Spawns the epf. (ports->task INPUT-PORT OUTPUT-PORT) -> task procedure This procedure constructs a task from a pair of ports. (task:in TASK) -> output-port procedure (task:out TASK) -> input-port procedure (task:process TASK) -> process procedure These three procedures return, in order, the input port that can be used to get data from the task, the output port that can be used to send data to the task, and the process that the task is running. (task:pre-match TASK) -> string procedure (task:buf TASK) -> string procedure When an EXPECT pattern matches some input, the task:pre-match field is set to the string preceding the matched data, and the task:buf field is set to the string coming after the matched data, that is, it saves input that hasn't yet been processed. When EXPECT starts, it first considers any data stored in the task:buf field. (set-task:pre-match TASK STR) (set-task:buf TASK STR) ... ------------------------------------------------------------------------------- (EXPECT [ ] ...) -> values syntax ::= ( ...) [Task clause.] | | (ON-TIMEOUT ...) [Do on timeout.] Action clauses: ::= (ON-EOF ...) [Do on EOF.] | ( ...) [Do if pattern matches.] | (TEST . ) ::= () [No match info] | () [Match struct only] | ( ...) [...also submatch strings.] ::= (OPTION