|
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
net.sf.smc.generator.SmcCGenerator
public final class SmcCGenerator
Visits the abstract syntax tree emitting C code to an output stream.
SmcElement
,
SmcCodeGenerator
,
SmcVisitor
,
SmcOptions
Field Summary |
---|
Fields inherited from class net.sf.smc.generator.SmcCodeGenerator |
---|
_accessLevel, _castType, _debugLevel, _genericFlag, _graphLevel, _guardCount, _guardIndex, _headerDirectory, _indent, _noCatchFlag, _noExceptionFlag, _noStreamsFlag, _reflectFlag, _serialFlag, _source, _srcDirectory, _srcfileBase, _syncFlag, DEBUG_LEVEL_0, DEBUG_LEVEL_1, GRAPH_LEVEL_0, GRAPH_LEVEL_1, GRAPH_LEVEL_2, NO_DEBUG_OUTPUT, NO_GRAPH_LEVEL |
Constructor Summary | |
---|---|
SmcCGenerator(net.sf.smc.generator.SmcOptions options)
Creates a C code generator for the given options. |
Method Summary | |
---|---|
protected java.lang.String |
scopeStateName(java.lang.String stateName,
java.lang.String mapName)
Returns the scoped state name. |
void |
visit(SmcAction action)
Emits C code for this FSM action. |
void |
visit(SmcFSM fsm)
Emits the following C code for the FSM:
|
void |
visit(SmcGuard guard)
Emits C code for this FSM guard. |
void |
visit(SmcMap map)
Emits C code for the FSM map. |
void |
visit(SmcParameter parameter)
Emits C code for this transition parameter. |
void |
visit(SmcState state)
Emits C code for this FSM state. |
void |
visit(SmcTransition transition)
Emits C code for this FSM transition. |
Methods inherited from class net.sf.smc.generator.SmcCodeGenerator |
---|
allNilEndStates, escape, isLoopback, setSource, sourceFile |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SmcCGenerator(net.sf.smc.generator.SmcOptions options)
options
- The target code generator options.Method Detail |
---|
public void visit(SmcFSM fsm)
%{ %} raw source code - if any
#include <%include header file>
#include "context.h"
If the -headerd option is used, then this is generated:
#include "header dir/context.h")
visit
in class SmcVisitor
fsm
- Emit code for this finite state machine.public void visit(SmcMap map)
visit
in class SmcVisitor
map
- emit code for this FSM map.public void visit(SmcState state)
visit
in class SmcVisitor
state
- emit C code for this FSM state.public void visit(SmcTransition transition)
visit
in class SmcVisitor
transition
- emit C code for this FSM transition.public void visit(SmcGuard guard)
[else] if
statement. The exit actions, transition
actions, setting the next state and entry actions are
called from within the condition body. If the condition
has no condition but there are other guards, then the
guard actions are placed within an else
body.
If the guard has no condition and there are no other
guards, then the guard action code is emitted within the
transition routine block.
visit
in class SmcVisitor
guard
- emit C code for this transition guard.public void visit(SmcAction action)
action(ctxt[, arg0, ... , argn]);
visit
in class SmcVisitor
action
- emit C code for this action.public void visit(SmcParameter parameter)
type name
visit
in class SmcVisitor
parameter
- emit C code for this transition
parameter.protected java.lang.String scopeStateName(java.lang.String stateName, java.lang.String mapName)
<i>mapName</i>.<i>stateName</i>
. Replaces
any "::" with "_" in the state name.
scopeStateName
in class SmcCodeGenerator
stateName
- the state name.mapName
- the map name.
|
SMC 6_0_1 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |