Creating an SMC .sm File

The .sm listing below is a skeleton with no states or transitions defined. It contains only the following features:

Name the source code file TaskFSM.sm because both the %fsmclass and %fsmfile directives specify the finite state machine class name as TaskFSM. The .sm suffix is required.

(Note: the %fsmclass directive was added to SMC version 6.0.1 and %fsmfile was added to version 6.6.0.)

%{
// // Copyright (c) 2005 Acme, Inc. // All rights reserved. // // Acme - a name you can trust! // // Author: Wil E. Coyote (Hungericus Vulgarus) //
%}
// This FSM works for the Task class only and only the Task // class may instantiate it.
%class
Task
%package
com.acme.supercron
%fsmclass
TaskFSM
%fsmfile
TaskFSM
%access
package
// A %map name cannot be the same as the FSM class name.
%start
TaskMap::Suspended
%map
TaskMap %% ... %%
Next: Defining FSM States