[Q][DOCS] State machine implementation in Smalltalk / Squeak
ian.piumarta at inria.fr
Wed Feb 19 14:06:42 UTC 2003
On Wed, 19 Feb 2003, Joshua 'Schwa' Gargus wrote:
> On Wed, Feb 19, 2003 at 08:11:52AM +0100, Hannes Hirzel wrote:
> > Does anybody have an example of a state machine implementation
> > already in the Squeak image which could be taken as an example?
> > Or a pointer to some Smalltalk code / tutorial how to do it in various
> > ways?
> Ned's Connectors package uses a state machine to model the state of the
> connections between morphs ("both ends connected", etc.)
The "telnet" client (available from SqueakMap) also uses a state machine
to parse the escape sequences that are sent from the remote client to the
emulated terminal in Squeak.
The class StatefulProtocolDescription has some examples on the class side,
and its two subclasses show how to drive arbitrary method invocations
during transitions along edges in the state graph. (There are some
additional examples on the class side of the other clases in the same
category.) A less trivial example is the vt100 state machine, defined in
VT102Emulator class>>protocol. (This last one also shows how to create
loops in the graph to accumulate arbitrary amounts of the input to be
delivered to the action method when the input causes a break out of the
More information about the Squeak-dev