-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
245 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,6 @@ | |
%] | ||
|
||
[%=stateTemplate.process()%] | ||
[%}%] | ||
[% | ||
} | ||
%] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,30 @@ | ||
[% import "Operations.egl"; %] | ||
[% | ||
import "Operations.egl"; | ||
|
||
var regionTemplate : Template = TemplateFactory.load("DeclarationRegion.egl"); | ||
var transitionTemplate : Template = TemplateFactory.load("DeclarationTransition.egl"); | ||
%] | ||
|
||
// State [%=state.name%] | ||
static Transition [%=state.name%]Handler(ImplPtr impl, Event event); | ||
static const State k[%=state.name%]; | ||
[% for (outgoing_transition in state.getOutgoingTransitions()) { | ||
var transitionTemplate : Template = TemplateFactory.load("DeclarationTransition.egl"); | ||
transitionTemplate.populate("start_transition", outgoing_transition); | ||
transitionTemplate.populate("transition", outgoing_transition); | ||
transitionTemplate.populate("state", state); | ||
transitionTemplate.populate("sm", sm); | ||
[% | ||
for (outgoing_transition in state.getOutgoingTransitions()) { | ||
transitionTemplate.populate("start_transition", outgoing_transition); | ||
transitionTemplate.populate("transition", outgoing_transition); | ||
transitionTemplate.populate("state", state); | ||
transitionTemplate.populate("sm", sm); | ||
%] | ||
[%=transitionTemplate.process()%] | ||
[%}%] | ||
[% for (sub_region in state.regions) { | ||
var regionTemplate : Template = TemplateFactory.load("DeclarationRegion.egl"); | ||
regionTemplate.populate("region", sub_region); | ||
regionTemplate.populate("sm", sm); | ||
[% | ||
} | ||
%] | ||
[% | ||
for (sub_region in state.regions) { | ||
regionTemplate.populate("region", sub_region); | ||
regionTemplate.populate("sm", sm); | ||
%] | ||
[%=regionTemplate.process()%] | ||
[%}%] | ||
[% | ||
} | ||
%] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,40 @@ | ||
[% | ||
import "Operations.egl"; | ||
|
||
var transitionTemplate : Template = TemplateFactory.load("InstanceHandlerTransition.egl"); | ||
|
||
if (transition.target.isState()) { | ||
if (transition.guardIsElse()) { | ||
%] | ||
return [%=transition.getVariableName(start_transition)%]; | ||
[% } else { %] | ||
[% | ||
} else { | ||
%] | ||
if (impl->[%=transition.guard.name%](event)) | ||
{ | ||
return [%=transition.getVariableName(start_transition)%]; | ||
} | ||
[% | ||
} | ||
} else if (transition.target.isChoiceState()) { | ||
if (not transition.guardIsElse()) { | ||
if (transition.hasGuard()) { | ||
%] | ||
if (impl->[%=transition.guard.name%](event)) | ||
{ | ||
[% for (choice_transition in transition.target.getOutgoingTransitions()) { | ||
transitionTemplate.populate("start_transition", transition); | ||
transitionTemplate.populate("transition", choice_transition); | ||
transitionTemplate.populate("state", state); | ||
transitionTemplate.populate("sm", sm); | ||
[% | ||
} | ||
var transitionTemplate : Template = TemplateFactory.load("InstanceHandlerTransition.egl"); | ||
for (choice_transition in transition.target.getOutgoingTransitions()) { | ||
transitionTemplate.populate("start_transition", transition); | ||
transitionTemplate.populate("transition", choice_transition); | ||
transitionTemplate.populate("state", state); | ||
transitionTemplate.populate("sm", sm); | ||
%] | ||
[%=transitionTemplate.process()%] | ||
} | ||
[% } | ||
} else { | ||
for (choice_transition in transition.target.getOutgoingTransitions()) { | ||
transitionTemplate.populate("start_transition", transition); | ||
transitionTemplate.populate("transition", choice_transition); | ||
transitionTemplate.populate("state", state); | ||
transitionTemplate.populate("sm", sm); | ||
[% | ||
} | ||
if (transition.hasGuard()) { | ||
%] | ||
[%=transitionTemplate.process()%] | ||
} | ||
[% | ||
} | ||
} | ||
} | ||
} | ||
%] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,6 @@ | |
%] | ||
|
||
[%=stateTemplate.process()%] | ||
[%}%] | ||
[% | ||
} | ||
%] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[% | ||
import "Operations.egl"; | ||
|
||
var transitionVariableTemplate : Template = TemplateFactory.load("InstanceTransitionVariable.egl"); | ||
|
||
if (transition.effect != null) { | ||
actions.add("&" + sm.name + "::Impl::" + transition.effect.name); | ||
} | ||
|
||
if (transition.target.isState()) { | ||
if (not actions.isEmpty()) { | ||
%] | ||
const [%=sm.name%]::Transition::ActionType [%=sm.name%]::[%=transition.getVariableName(start_transition)%]Actions[] = {[%=actions.concat(", ")%]}; | ||
const [%=sm.name%]::Transition [%=sm.name%]::[%=transition.getVariableName(start_transition)%]([%=transition.target.getVariableName()%], [%=transition.getVariableName(start_transition)%]Actions); | ||
[% | ||
} else { | ||
%] | ||
const [%=sm.name%]::Transition [%=sm.name%]::[%=transition.getVariableName(start_transition)%]([%=transition.target.getVariableName()%]); | ||
[% | ||
} | ||
} else if (transition.target.isChoiceState()) { | ||
for (outgoing_transition in transition.target.getOutgoingTransitions()) { | ||
transitionVariableTemplate.populate("actions", actions); | ||
transitionVariableTemplate.populate("start_transition", start_transition); | ||
transitionVariableTemplate.populate("transition", outgoing_transition); | ||
transitionVariableTemplate.populate("state", state); | ||
transitionVariableTemplate.populate("sm", sm); | ||
%] | ||
[%=transitionVariableTemplate.process()%] | ||
[% | ||
} | ||
} | ||
%] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
rule StatemachineDeclaration | ||
transform sm : UML!StateMachine { | ||
|
||
pre { | ||
var java = new Native("org.eclipse.epsilon.egl.formatter.language.JavaFormatter"); | ||
} | ||
|
||
template : "Declaration.egl" | ||
|
||
formatter : java | ||
|
||
target : "gen/" + sm.name + "Declaration.hxx" | ||
} | ||
|
||
rule StatemachineInstance | ||
transform sm : UML!StateMachine { | ||
|
||
pre { | ||
var java = new Native("org.eclipse.epsilon.egl.formatter.language.JavaFormatter"); | ||
} | ||
|
||
template : "Instance.egl" | ||
|
||
formatter : java | ||
|
||
target : "gen/" + sm.name + "Instance.hxx" | ||
} |
Oops, something went wrong.