|
SMC 6_0_1 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.smc.model.SmcVisitor
net.sf.smc.generator.SmcCodeGenerator
public abstract class SmcCodeGenerator
Base class for all target language code generators. The
syntax tree visitation methods of the
SmcVisitor
super class are left to
this class' subclasses to define.
SmcElement
,
SmcVisitor
,
SmcOptions
Field Summary | |
---|---|
protected java.lang.String |
_accessLevel
Used this access keyword for the generated classes. |
protected java.lang.String |
_castType
Use this cast type (C++ only). |
protected int |
_debugLevel
This flag is true when debug output is to be generated. |
protected boolean |
_genericFlag
This flag is true when reflection is to use a generic transition map. |
protected int |
_graphLevel
Generate this much detail in the graph (-graph only). |
protected int |
_guardCount
The total number of guards to be generated at this time. |
protected int |
_guardIndex
The guard currently being generated. |
protected java.lang.String |
_headerDirectory
Place the generated header file in this directory. |
protected java.lang.String |
_indent
Output this indent before generating a line of code. |
protected boolean |
_noCatchFlag
This flag is true when exceptions are not caught. |
protected boolean |
_noExceptionFlag
This flag is true when exceptions are not be thrown. |
protected boolean |
_noStreamsFlag
This flag is true when I/O streams should not be used. |
protected boolean |
_reflectFlag
This flag is true when reflection is supported. |
protected boolean |
_serialFlag
This flag is true when serialization is to be generated. |
protected java.io.PrintStream |
_source
Emit the target source code to this output stream. |
protected java.lang.String |
_srcDirectory
Write the target source file to this directory. |
protected java.lang.String |
_srcfileBase
The .sm file's base name. |
protected boolean |
_syncFlag
This flag is true when synchronization code is to be generated. |
static int |
DEBUG_LEVEL_0
Output states and transitions. |
static int |
DEBUG_LEVEL_1
Output states, transitions and all transition, entry and exit actions. |
static int |
GRAPH_LEVEL_0
Provide state and transition names only. |
static int |
GRAPH_LEVEL_1
Provide state and transition names plus transition guards and actions. |
static int |
GRAPH_LEVEL_2
Provides state names, entry and exit actions, transition name and arguments, guards, actions and their action parameters and pop transition arguments. |
static int |
NO_DEBUG_OUTPUT
No debug output. |
static int |
NO_GRAPH_LEVEL
No graphing is done. |
Constructor Summary | |
---|---|
protected |
SmcCodeGenerator(net.sf.smc.generator.SmcOptions options,
java.lang.String suffix)
Constructs the target code generator for the given parameters. |
Method Summary | |
---|---|
protected boolean |
allNilEndStates(java.util.List<SmcGuard> guards)
Returns true if each of the transition guards uses
the nil end state. |
static java.lang.String |
escape(java.lang.String s)
Place a backslash escape character in front of backslashes and doublequotes. |
protected boolean |
isLoopback(SmcElement.TransType transType,
java.lang.String endState)
Returns true if this transition is an
internal loopback or a push transition and
false otherwise. |
protected java.lang.String |
scopeStateName(java.lang.String stateName,
java.lang.String mapName)
|
void |
setSource(java.io.PrintStream source)
Sets the source code output destination. |
java.lang.String |
sourceFile(java.lang.String path,
java.lang.String basename,
java.lang.String suffix)
Returns the source file name generated from the destination directory, base name and suffix using the source name format. |
Methods inherited from class net.sf.smc.model.SmcVisitor |
---|
visit, visit, visit, visit, visit, visit, visit |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.PrintStream _source
protected final java.lang.String _srcfileBase
protected final java.lang.String _srcDirectory
protected final java.lang.String _headerDirectory
protected final java.lang.String _castType
protected final int _graphLevel
protected java.lang.String _indent
protected int _guardCount
protected int _guardIndex
protected final boolean _serialFlag
protected final int _debugLevel
protected final boolean _noExceptionFlag
protected final boolean _noCatchFlag
protected final boolean _noStreamsFlag
protected final boolean _reflectFlag
protected final boolean _syncFlag
protected final boolean _genericFlag
protected final java.lang.String _accessLevel
public static final int NO_DEBUG_OUTPUT
public static final int DEBUG_LEVEL_0
public static final int DEBUG_LEVEL_1
public static final int NO_GRAPH_LEVEL
public static final int GRAPH_LEVEL_0
public static final int GRAPH_LEVEL_1
public static final int GRAPH_LEVEL_2
Constructor Detail |
---|
protected SmcCodeGenerator(net.sf.smc.generator.SmcOptions options, java.lang.String suffix)
options
- The target code generator options.suffix
- the target source file name suffix.Method Detail |
---|
public java.lang.String sourceFile(java.lang.String path, java.lang.String basename, java.lang.String suffix)
path
- The destination directory.basename
- The file's basename sans suffix.suffix
- Append this suffix to the file.protected boolean isLoopback(SmcElement.TransType transType, java.lang.String endState)
true
if this transition is an
internal loopback or a push transition and
false
otherwise. If true, then do not perform the
the state exit and entry actions.
transType
- the transition type.endState
- entering this state.
true
if this transition is an internal
loopback or push transition and false
otherwise.protected boolean allNilEndStates(java.util.List<SmcGuard> guards)
true
if each of the transition guards uses
the nil end state.
guards
- check if all this transitions use the nil
end state.
true
if each of the transition guards uses
the nil end state.public void setSource(java.io.PrintStream source)
source
- the generated source code output stream.public static java.lang.String escape(java.lang.String s)
s
- Escape this string.
protected java.lang.String scopeStateName(java.lang.String stateName, java.lang.String mapName)
|
SMC 6_0_1 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |