| RoomModel generic_fsm_gen { |
| |
| SubSystemClass Main { |
| ActorRef sys: AC |
| ActorRef peer: Peer |
| Binding sys.fct and peer.fct |
| } |
| |
| ActorClass Peer { |
| Interface { |
| conjugated Port fct: PC |
| } |
| Structure { |
| external Port fct |
| } |
| Behavior { |
| StateMachine { |
| Transition init: initial -> state0 { |
| action { |
| "PCConjPort_m1(&self->constData->fct);" |
| } |
| } |
| Transition tr0: state0 -> state0 { |
| triggers { |
| <m2: fct> |
| } |
| action { |
| "printf(\"Peer\\n\");" |
| "PCConjPort_m1(&self->constData->fct);" |
| } |
| } |
| State state0 |
| } |
| } |
| } |
| |
| ActorClass AC { |
| Interface { |
| Port fct: PC |
| } |
| Structure { |
| external Port fct |
| } |
| Behavior { |
| StateMachine { |
| Transition init: initial -> state0 { } |
| Transition tr0: state0 -> state0 { |
| triggers { |
| <m1: fct> |
| } |
| action { |
| "printf(\"AC\\n\");" |
| "static int32 counter = 0;" |
| "if (++counter < 3){" |
| "\tPCPort_m2(&self->constData->fct);" |
| "}" |
| } |
| } |
| State state0 |
| } |
| } |
| } |
| |
| ProtocolClass PC { |
| incoming { |
| Message m1() |
| } |
| outgoing { |
| Message m2() |
| } |
| } |
| |
| DataClass DC { |
| Attribute ival: int32 |
| Operation mult(a: int32, b: int32): int32 { |
| "return a*b;" |
| } |
| } |
| |
| PrimitiveType int32 : ptInteger -> int (Integer) default "0" |
| } |