Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members
mkauto
0.3
A tool for the creation of finite state automata.
How does it work?
A state machine definition file, usually named <something>.fsa is parsed by the mkauto tool. It consumes several intial code blocks and dumps and dumps them into the target C++ class without any error checking. The transitions consisting of states, inputs and actions, on the other hand, are evaluated. Member functions of the C++ class are generated from the evaluated transitions.
The following keywords are part of the unchecked block. All of them are optional.
- FILENAME is followed by a simple C word: no spaces, no special character, beginning with a letter, not with a digit. This defines the name of the automaton. This name is used as the class name for the generated class (verify that this is true).
- PREFIX is followed by one codeblock (see below for an explanation of the word codeblock). The codeblock is dumped at the top of the generated header file. It is meant to hold general includes, defines, prototypes or type definition that your code needs.
- CODEPREFIX is followed by one codeblock. The codeblock is dumped at the top of the generated code file. Like PREFIX, it is meant for includes etc.
- DECLARE is followed by one codeblock. It is dumped into the private section of the generated class definition in the header file. It is meant for adding your own member variable, member functions, inner class definition and so on. You can change the protection of the code using the regular public:, protected: or private: labels of C++.
- DEFINE is followed by one codeblock. It is dumped into the code file. It is meant to hold the code that implements the definition made in the DECLARE codeblock.
- INHERIT is followed by one or two codeblocks. The first codeblock may be replace by a simple C word. If it is a codeblock, it must contain exactly one simple C word. This is the name of the base class that the generated automaton inherits, and it is dumped into the header file as a public inheritance. This inheritance is always the second inheritance, and it can not be MNThread. All automata inherit MNThread automatically. The second code block is dumped into the code file at the top of the automaton constructor's assignment list; if the parent class has a trivial constructor, this codeblock is not required. Do not delimit this initializer code, just write %{ baseclass(param) }%. Do not assume that you can achieve the same thing by adding baseclass(param) to the CONSTRUCT. This is not true because of additional initializers that are added by mkauto.
- CONSTRUCT is followed by one, two or three codeblocks. The first codeblock holds the parameter list that is dumped into the declaration and into the definition (header and code file) for the automatons constructor. You can not use default initializers, since ANSI C++ forbids initializers in the code file and mkauto does not process your codeblock. If you need default initializers, you must extend mkauto. The second codeblock contains the assignment list for the constructor. It is dumped into the code file (after the parameter list, the mkauto-defined initializers code, but before the constructor's function body). The third codeblock is dumped into the body of the constructor. If you don't need initializer code but you need code in the body, just leave the second codeblock empty.
- KEY_DESTRUCT is followed by one codeblock. The codeblock is dumped into the body of the destructor.
Codeblocks
A codeblock has the starting delimiter %{
and the end delimiter }%
and can contain an arbitrary set of characters except for the end delimiter. These characters are dumped into the generated code without any syntactical or semantical checks; the C++ compiler will report errors. There are no escape sequences to allow the generation of the end delimiter in the dumped code. If you need it, you must edit mkauto's sources. See the individual keywords to understand where each codeblock is dumped.
Generated on Sat Mar 23 18:58:40 2002 for Komssys-mkauto by
1.2.14 written by Dimitri van Heesch,
© 1997-2002