Version 3 of Moore Type State Models

Updated 2012-07-18 08:25:01 by JHJL

State machines can be a powerful way to sequence execution. This is a link to a package to implement Moore type state machines in Tcl.

http://chiselapp.com/user/mangoa01/repository/mrtools/doc/tip/moore/wiki/intro.wiki

It is rather more complete than the simpler examples on the wiki, of course, at the expense of a bit more learning curve. It is large enough that it is hard to deal with as a wiki page, so I have put it in Fossil repository that I have been building for some of these types of tools.


jhjl Using Tcl8.6 on Windows 7 I get an error loading the package. I tried a teacup update but problem persists.

package require moore 1.9
unknown data type, "dict"
    while executing
"relvar create StateMachine {
        MachineId       string
        ModelName       string
        CurrState       string
        Options         dict..."
    (in namespace eval "::moore" script line 35)
    invoked from within
"namespace eval ::moore {
    variable revision 1.9

    namespace export model
    namespace export generate
    namespace export delay
    namespace ..."
    (file "C:/Tcl/lib/teapot/package/tcl/teapot/tcl8/8.5/moore-1.9.tm" line 93)
    invoked from within
"source -encoding utf-8 C:/Tcl/lib/teapot/package/tcl/teapot/tcl8/8.5/moore-1.9.tm"
    ("package ifneeded moore 1.9" script)
    invoked from within
"package require moore"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 {package require moore}"
    invoked from within
"interp eval $::tkcon::OPT(exec) $args"
    (procedure "::tkcon::EvalSlave" line 2)
    invoked from within
"EvalAttached $cmd"

gam, 17 July 2012

I suspect that you have a version of TclRAL that is built against Tcl 8.4 (before dictionaries were a built in type). You might want to get the TclRAL package from sourceforge [L1 ]. That one was built against Tcl 8.5. If you obtained TclRAL from the ActiveState teapot it could have been built against Tcl 8.4 (just a guess here).

jhjl You guessed right! The ActiveState teapot contains TclRAL 0.10.2 built against Tcl8.4. I downloaded the binary from SourceForge and this version is linked against 8.6. The SourceForge version loads without complaint.

C:\Tcl\bin>teacup remove ral
 Removing instance package ral 0.10.2 win32-ix86

C:\Tcl\bin>teacup install ral
Resolving ral ... [package ral 0.10.2 win32-ix86 @ http://teapot.activestate.com]
Resolving Tcl 8.4 -is package ... [package Tcl 8.6 _ ... Installed outside repository, probing dependencies]

Retrieving package ral 0.10.2 win32-ix86 ...@ http://teapot.activestate.com ... Ok

Installing into C:/Tcl/lib/teapot

Installing package ral 0.10.2 win32-ix86

Having done the install above the ActiveState teacup.txt file contains a Meta require {Tcl 8.4} whereas the SourceForge version contains a Meta require {Tcl 8.5}