next up previous contents
Next: 3.2 HelloWorld Example Up: 3. CODE SYNTHESIS WITH Previous: 3. CODE SYNTHESIS WITH   Contents

3.1 SCC Command-line Parameters

When SCC is invoked without any parameter, it prints out the following message about the usage:

==================================================
|  Python Implementation of Statechart Compiler  |
|                   Version 0.3                  |
|       Presented by Thomas Feng, Nov. 2003      |
==================================================

Usage: scc [options...] <.des file> [parameters...]
       options:
           -l <lang>: generate code in language <lang>
                      supported languages: java (default), cpp, csharp, python
           -i <file>: include a file (to the head)
           -I <file>: include a file (to the tail)
           -q:        quiet
       language-specific options:
         cpp:
           --head:    generate head file
           --ext:     include extensions for actions (require Python dynamic library)
         python:
           --ext:     include extensions for actions
       parameters:
           "name=value"

The following command is the simplest use, which compiles model.des into Java source model.java:

scc model.des

The -i and -I parameters are similar to their counterparts on the SVM command-line. -i is used to insert a text file to the head of the model description, while -I is used to append a text file to the end of it.

It is also possible to redefine the macros in the model description, as can be done in SVM. The redefined macros are statically compiled into the generated code. (Note that it is impossible to dynamically redefine macros in the generated code. If a model redefines macros in its components, those redefinitions are ignored by SCC.) The model redefinitions are written after the name of the model description. (This is similar to SVM.)

The -l parameter is followed by the name of the target language. Currently Java, C++, C# and Python are supported as target languages. For example, to compile model.des into model.cpp, execute the following command:

scc -lcpp model.des
or
scc -l cpp model.des

By default, SCC does not generate any action code or guard in the model. They are simply ignored. This is because, enabling the action code and guards for target languages other than Python requires extra Python library. To minimize system requirement and still guarantee unique target-language-independent behavior of the generated code, SCC ignores all the action code and guards even if Python is the target language. However, the user may specify the -ext command-line parameter to enable the action code and guards for some target languages. Uniqueness of behavior between different target languages is not guaranteed in this case. (See the examples discussed later.)

After code is generated, SCC prints out information about the time spent in the code synthesis, the command to compile the source code in the target language (if the target language is not interpreted), and the command the execute the model after the generated code is compiled. The user may disable this information with the -q parameter.


next up previous contents
Next: 3.2 HelloWorld Example Up: 3. CODE SYNTHESIS WITH Previous: 3. CODE SYNTHESIS WITH   Contents
Thomas Huining Feng
2004-04-05