Skip to content

Commit

Permalink
Start working on eclipse epsilon generator
Browse files Browse the repository at this point in the history
  • Loading branch information
dziegel committed Dec 20, 2023
1 parent bc07185 commit cb8abf7
Show file tree
Hide file tree
Showing 21 changed files with 757 additions and 0 deletions.
7 changes: 7 additions & 0 deletions experimental_epsilon/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>
28 changes: 28 additions & 0 deletions experimental_epsilon/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>EMF</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
9 changes: 9 additions & 0 deletions experimental_epsilon/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: EMF
Bundle-SymbolicName: EMF; singleton:=true
Bundle-Version: 0.1.0.qualifier
Require-Bundle: org.eclipse.emf.ecore,
org.eclipse.epsilon.emc.uml;bundle-version="2.5.0",
org.eclipse.epsilon.emc.uml.dt;bundle-version="2.5.0",
org.eclipse.ocl.uml;bundle-version="5.19.0"
16 changes: 16 additions & 0 deletions experimental_epsilon/bin/Declaration.egl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Statemachine [%=sm.name%] declaration

#pragma once

class [%=sm.name%] : public [%=sm.name%]Base
{
public:
static const StatePtr kInitialState;
[% for (region in sm.regions) {
var regionTemplate : Template = TemplateFactory.load("DeclarationRegion.egl");
regionTemplate.populate("region", region);
regionTemplate.populate("sm", sm);
%]
[%=regionTemplate.process()%]
[%}%]
};
8 changes: 8 additions & 0 deletions experimental_epsilon/bin/DeclarationRegion.egl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[% for (state in region.subvertices.select(s|s.type.name == "State")) {
var stateTemplate : Template = TemplateFactory.load("DeclarationState.egl");
stateTemplate.populate("state", state);
stateTemplate.populate("sm", sm);
%]

[%=stateTemplate.process()%]
[%}%]
19 changes: 19 additions & 0 deletions experimental_epsilon/bin/DeclarationState.egl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// State [%=state.name%]
static Transition [%=state.name%]Handler(ImplPtr impl, Event event);
static const State k[%=state.name%];
[% for (outgoing_transition in state.outgoing) {
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);
%]
[%=transitionTemplate.process()%]
[%}%]
[% for (sub_region in state.regions) {
var regionTemplate : Template = TemplateFactory.load("DeclarationRegion.egl");
regionTemplate.populate("region", sub_region);
regionTemplate.populate("sm", sm);
%]
[%=regionTemplate.process()%]
[%}%]
14 changes: 14 additions & 0 deletions experimental_epsilon/bin/DeclarationTransition.egl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[%if (transition.target.type.name == "State") {%]
// Transition [%=start_transition.trigger.first.event.name%]: [%=start_transition.source.name%] -> [%=transition.target.name%]
static const Transition::ActionType k[%=start_transition.source.name%]To[%=transition.target.name%]By[%=start_transition.trigger.first.event.name%]Actions[];
static const Transition k[%=start_transition.source.name%]To[%=transition.target.name%]By[%=start_transition.trigger.first.event.name%];
[%} else if ((transition.target.type.name == "Pseudostate") and (transition.target.kind.name == "choice")) {
for (choice_transition in transition.target.outgoing) {
var transitionTemplate : Template = TemplateFactory.load("DeclarationTransition.egl");
transitionTemplate.populate("start_transition", start_transition);
transitionTemplate.populate("transition", choice_transition);
transitionTemplate.populate("state", state);
transitionTemplate.populate("sm", sm);
%]
[%=transitionTemplate.process()%]
[%}}%]
9 changes: 9 additions & 0 deletions experimental_epsilon/bin/Instance.egl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Statemachine [%=sm.name%] instance

[% for (region in sm.regions) {
var regionTemplate : Template = TemplateFactory.load("DeclarationRegion.egl");
regionTemplate.populate("region", region);
regionTemplate.populate("sm", sm);
%]
[%=regionTemplate.process()%]
[%}%]
15 changes: 15 additions & 0 deletions experimental_epsilon/bin/Program.egx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
rule StatemachineDeclaration
transform sm : UML!StateMachine {

template : "Declaration.egl"

target : "gen/" + sm.name + "Declaration.hxx"
}

rule StatemachineInstance
transform sm : UML!StateMachine {

template : "Instance.egl"

target : "gen/" + sm.name + "Instance.hxx"
}
139 changes: 139 additions & 0 deletions experimental_epsilon/bin/gen/IoArHandlerMainDeclaration.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
// Statemachine IoArHandlerMain declaration

#pragma once

class IoArHandlerMain : public IoArHandlerMainBase
{
public:
static const StatePtr kInitialState;

// State Closed
static Transition ClosedHandler(ImplPtr impl, Event event);
static const State kClosed;
// Transition S_PNS_ArOpend_ind: Closed -> Open
static const Transition::ActionType kClosedToOpenByS_PNS_ArOpend_indActions[];
static const Transition kClosedToOpenByS_PNS_ArOpend_ind;
// Transition S_PNS_SwitchoverRequestPrimary: Closed -> Closed
static const Transition::ActionType kClosedToClosedByS_PNS_SwitchoverRequestPrimaryActions[];
static const Transition kClosedToClosedByS_PNS_SwitchoverRequestPrimary;
// Transition S_PNS_SwitchoverRequestBackup: Closed -> Closed
static const Transition::ActionType kClosedToClosedByS_PNS_SwitchoverRequestBackupActions[];
static const Transition kClosedToClosedByS_PNS_SwitchoverRequestBackup;
// Transition S_PNS_ReadReq: Closed -> Closed
static const Transition::ActionType kClosedToClosedByS_PNS_ReadReqActions[];
static const Transition kClosedToClosedByS_PNS_ReadReq;
// Transition S_PNS_WriteReq: Closed -> Closed
static const Transition::ActionType kClosedToClosedByS_PNS_WriteReqActions[];
static const Transition kClosedToClosedByS_PNS_WriteReq;

// State Open
static Transition OpenHandler(ImplPtr impl, Event event);
static const State kOpen;
// Transition S_PNS_SwitchoverRequestPrimary: Open -> Open
static const Transition::ActionType kOpenToOpenByS_PNS_SwitchoverRequestPrimaryActions[];
static const Transition kOpenToOpenByS_PNS_SwitchoverRequestPrimary;
// Transition S_PNS_SwitchoverRequestBackup: Open -> Open
static const Transition::ActionType kOpenToOpenByS_PNS_SwitchoverRequestBackupActions[];
static const Transition kOpenToOpenByS_PNS_SwitchoverRequestBackup;
// Transition S_PNS_WriteReq: Open -> Open
static const Transition::ActionType kOpenToOpenByS_PNS_WriteReqActions[];
static const Transition kOpenToOpenByS_PNS_WriteReq;
// Transition S_PNS_ReadReq: Open -> Open
static const Transition::ActionType kOpenToOpenByS_PNS_ReadReqActions[];
static const Transition kOpenToOpenByS_PNS_ReadReq;
// Transition S_PNS_ArClosed_ind: Open -> Closed
static const Transition::ActionType kOpenToClosedByS_PNS_ArClosed_indActions[];
static const Transition kOpenToClosedByS_PNS_ArClosed_ind;
// Transition S_PNS_CheckModuleDiff: Open -> Open
static const Transition::ActionType kOpenToOpenByS_PNS_CheckModuleDiffActions[];
static const Transition kOpenToOpenByS_PNS_CheckModuleDiff;

// State WaitApplicationReadyCnf
static Transition WaitApplicationReadyCnfHandler(ImplPtr impl, Event event);
static const State kWaitApplicationReadyCnf;
// Transition S_PNS_ApplicationReady_cnf: WaitApplicationReadyCnf -> ApplicationReady
static const Transition::ActionType kWaitApplicationReadyCnfToApplicationReadyByS_PNS_ApplicationReady_cnfActions[];
static const Transition kWaitApplicationReadyCnfToApplicationReadyByS_PNS_ApplicationReady_cnf;
// Transition S_PNS_ApplicationReady_cnf: WaitApplicationReadyCnf -> WaitApplicationReadyCnf
static const Transition::ActionType kWaitApplicationReadyCnfToWaitApplicationReadyCnfByS_PNS_ApplicationReady_cnfActions[];
static const Transition kWaitApplicationReadyCnfToWaitApplicationReadyCnfByS_PNS_ApplicationReady_cnf;

// State WaitApplicationReady
static Transition WaitApplicationReadyHandler(ImplPtr impl, Event event);
static const State kWaitApplicationReady;
// Transition SPnpbAppTimeout: WaitApplicationReady -> WaitApplicationReadyCnf
static const Transition::ActionType kWaitApplicationReadyToWaitApplicationReadyCnfBySPnpbAppTimeoutActions[];
static const Transition kWaitApplicationReadyToWaitApplicationReadyCnfBySPnpbAppTimeout;
// Transition SPnpbAppTimeout: WaitApplicationReady -> WaitApplicationReady
static const Transition::ActionType kWaitApplicationReadyToWaitApplicationReadyBySPnpbAppTimeoutActions[];
static const Transition kWaitApplicationReadyToWaitApplicationReadyBySPnpbAppTimeout;

// State Parameterizing
static Transition ParameterizingHandler(ImplPtr impl, Event event);
static const State kParameterizing;
// Transition S_PNS_ParamEndInd: Parameterizing -> WaitApplicationReady
static const Transition::ActionType kParameterizingToWaitApplicationReadyByS_PNS_ParamEndIndActions[];
static const Transition kParameterizingToWaitApplicationReadyByS_PNS_ParamEndInd;
// Transition S_PNS_ParamEndInd: Parameterizing -> WaitApplicationReadyCnf
static const Transition::ActionType kParameterizingToWaitApplicationReadyCnfByS_PNS_ParamEndIndActions[];
static const Transition kParameterizingToWaitApplicationReadyCnfByS_PNS_ParamEndInd;

// State ApplicationReady
static Transition ApplicationReadyHandler(ImplPtr impl, Event event);
static const State kApplicationReady;

// State DynamicReconfigurationRunning
static Transition DynamicReconfigurationRunningHandler(ImplPtr impl, Event event);
static const State kDynamicReconfigurationRunning;
// Transition SPnioAppTimeoutDynReconf: DynamicReconfigurationRunning -> DynamicReconfigurationRunning
static const Transition::ActionType kDynamicReconfigurationRunningToDynamicReconfigurationRunningBySPnioAppTimeoutDynReconfActions[];
static const Transition kDynamicReconfigurationRunningToDynamicReconfigurationRunningBySPnioAppTimeoutDynReconf;

// State DrWaitPullCnf
static Transition DrWaitPullCnfHandler(ImplPtr impl, Event event);
static const State kDrWaitPullCnf;
// Transition S_PNS_PullSubmodule_cnf: DrWaitPullCnf -> Ready
static const Transition::ActionType kDrWaitPullCnfToReadyByS_PNS_PullSubmodule_cnfActions[];
static const Transition kDrWaitPullCnfToReadyByS_PNS_PullSubmodule_cnf;

// State DrWaitApplicationReadyCnfPlugSubmodule
static Transition DrWaitApplicationReadyCnfPlugSubmoduleHandler(ImplPtr impl, Event event);
static const State kDrWaitApplicationReadyCnfPlugSubmodule;
// Transition S_PNS_PlugApplicationReady_cnf: DrWaitApplicationReadyCnfPlugSubmodule -> Ready
static const Transition::ActionType kDrWaitApplicationReadyCnfPlugSubmoduleToReadyByS_PNS_PlugApplicationReady_cnfActions[];
static const Transition kDrWaitApplicationReadyCnfPlugSubmoduleToReadyByS_PNS_PlugApplicationReady_cnf;

// State DrPlugPrmSequence
static Transition DrPlugPrmSequenceHandler(ImplPtr impl, Event event);
static const State kDrPlugPrmSequence;
// Transition S_PNS_PlugParamEndInd: DrPlugPrmSequence -> DrWaitApplicationReadyPlugSubmodule
static const Transition::ActionType kDrPlugPrmSequenceToDrWaitApplicationReadyPlugSubmoduleByS_PNS_PlugParamEndIndActions[];
static const Transition kDrPlugPrmSequenceToDrWaitApplicationReadyPlugSubmoduleByS_PNS_PlugParamEndInd;

// State DrWaitPlugCnf
static Transition DrWaitPlugCnfHandler(ImplPtr impl, Event event);
static const State kDrWaitPlugCnf;
// Transition S_PNS_PlugSubmodule_cnf: DrWaitPlugCnf -> DrPlugPrmSequence
static const Transition::ActionType kDrWaitPlugCnfToDrPlugPrmSequenceByS_PNS_PlugSubmodule_cnfActions[];
static const Transition kDrWaitPlugCnfToDrPlugPrmSequenceByS_PNS_PlugSubmodule_cnf;

// State DrWaitApplicationReadyPlugSubmodule
static Transition DrWaitApplicationReadyPlugSubmoduleHandler(ImplPtr impl, Event event);
static const State kDrWaitApplicationReadyPlugSubmodule;
// Transition SPnpbAppTimeout: DrWaitApplicationReadyPlugSubmodule -> DrWaitApplicationReadyCnfPlugSubmodule
static const Transition::ActionType kDrWaitApplicationReadyPlugSubmoduleToDrWaitApplicationReadyCnfPlugSubmoduleBySPnpbAppTimeoutActions[];
static const Transition kDrWaitApplicationReadyPlugSubmoduleToDrWaitApplicationReadyCnfPlugSubmoduleBySPnpbAppTimeout;
// Transition SPnpbAppTimeout: DrWaitApplicationReadyPlugSubmodule -> DrWaitApplicationReadyPlugSubmodule
static const Transition::ActionType kDrWaitApplicationReadyPlugSubmoduleToDrWaitApplicationReadyPlugSubmoduleBySPnpbAppTimeoutActions[];
static const Transition kDrWaitApplicationReadyPlugSubmoduleToDrWaitApplicationReadyPlugSubmoduleBySPnpbAppTimeout;

// State Ready
static Transition ReadyHandler(ImplPtr impl, Event event);
static const State kReady;
// Transition S_PNS_DynReconfPull: Ready -> DrWaitPullCnf
static const Transition::ActionType kReadyToDrWaitPullCnfByS_PNS_DynReconfPullActions[];
static const Transition kReadyToDrWaitPullCnfByS_PNS_DynReconfPull;
// Transition S_PNS_DynReconfPlug: Ready -> DrWaitPlugCnf
static const Transition::ActionType kReadyToDrWaitPlugCnfByS_PNS_DynReconfPlugActions[];
static const Transition kReadyToDrWaitPlugCnfByS_PNS_DynReconfPlug;
};
Loading

0 comments on commit cb8abf7

Please sign in to comment.