Re: [NTLK] FSM Question

From: Steve Weyer (weyer_at_kagi.com)
Date: Sun Dec 16 2001 - 12:32:35 EST


> Is the FSM like this:
> A -> B -> C -> end
> which isn't helpful, or can it be:
> D
> / \
> A-> B -> C -> E -> end
> \ /
> F
>
> My "triggers":
> A := "Login:" // send the username
> B := "ssword:" // send the password
> C := "%aics%" // send several set-up commands to use the host
> D := "@#@ * #@#" // * is an ASCII character field showing board position
> // and status, and would trigger a board redraw
> E := "^Y( * ^Y)" // * is a special msg indicating move time or game status
> // and it gets displayed in its' own window.
> F := "*" // Any other string, window text to display
>

the FSM can only be in one state at a time.
but if I understand what you want to do --
assuming that your D,E,F states are all waiting for an inputspec to do a
callback, and they all have the same termination condition, e.g., \n.
then D,E,F could just be tests embedded in the inputspec callback.
that is, your current state action would receive the inputstring,
it would test whether the data corresponded to D, E, or F,
then dispatch to the next state (fsm or inputspec) based on that.
 
you could just use the fsm for opening and closing a connection/endpoint,
and use separate callbacks for input and/or output -- only returning to the
fsm when you're done or there's an error. (I mix the two techniques in
Newt's Cape; in newtVNC, I didn't bother with protoFSM at all, just set up
separate input and output fsms via callbacks).

> Is there any FSM guru out there that could help? Hope this isn't *too*
> confusing, or I'll quit programming and go back to making things out of
> Wiccans. ;)

you mean "widgets"?
(I don't think our local Wiccans would like to be objectified)

-- 
Steve
  weyer_at_kagi.com
Newton apps/tools: Newt's Cape, newtVNC, NewtDevEnv, Sloup, Crypto,...
  http://www.kagi.com/weyer/

-- This is the Newtontalk mailinglist - http://www.newtontalk.net To unsubscribe or manage: visit the above link or mailto:newtontalk-request_at_newtontalk.net?Subject=unsubscribe



This archive was generated by hypermail 2.1.2 : Wed Jan 02 2002 - 12:01:49 EST