Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: a28ca74bd96159f2815c66433f151d6cf86e5060 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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"
}

Back to the top