Commit 2e1f106e authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

stop with mono

parent 5238b2f2
......@@ -7,7 +7,7 @@ mc: observer/my_observer.adb mcsrc/mc.adb mcsrc/properties.adb
observer/my_observer.adb: observer/observer.pr observer/observer.asn
cd observer && opengeode --toAda observer.pr && \
asn1.exe -Ada -typePrefix asn1scc -equal --target allboards observer.asn my_observer_datamodel.asn && \
asn1scc -Ada -typePrefix asn1scc -equal --target allboards observer.asn my_observer_datamodel.asn && \
mv src/my_observer_datamodel.ad? .
# generate Ada package to print asn1 values
taste-asn1-gser --raw -o observer --module gser observer/observer.asn observer/my_observer_datamodel.asn
......
......@@ -104,10 +104,14 @@ BEGIN
Observable-Event ::= CHOICE {
no-event SEQUENCE {},
system-startup SEQUENCE {},
input-event Interface-Event,
output-event Interface-Event
input-event Interface-Event, -- input event is evaluated after the transition
output-event Interface-Event, -- output event is evaluated before the message is sent
unhandled-input Interface-Event -- message received in a state where it is not expected
}
-- constant that can be used to refer to the absence of an input/output event
nothing Observable-Event ::= no-event : {}
-- Define a queue of events, corresponding to the input queue for each function
max-events INTEGER ::= 10
Events-Ty ::= SEQUENCE (SIZE (0 .. max-events)) OF Observable-Event
......@@ -128,7 +132,7 @@ IMPORTS
T-Null, T-Int, T-SeqOf FROM Iterators-Types
T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean, T-Null-Record FROM TASTE-BasicTypes;
Orchestrator-States ::= ENUMERATED {step-2, all-done, wait}
Orchestrator-States ::= ENUMERATED {all-done, step-2, wait}
Orchestrator-Context ::= SEQUENCE {
state Orchestrator-States,
......
system my_observer;
/* CIF TEXT (145, 177), (507, 168) */
/* CIF TEXT (144, 214), (507, 312) */
use datamodel comment 'observer.asn';
exported procedure observe;
......@@ -9,22 +9,27 @@ system my_observer;
signal pre_in_orchestrator_pulse (t_int) renames input pulse to orchestrator;
signal foo renames input pulse to orchestrator;
signal foo (T_Uint32)
renames output do_something
from orchestrator
to another_function;
/* CIF ENDTEXT */
channel c
from env to my_observer with observe,
pre_in_orchestrator_pulse,
foo;
from my_observer to env with foo;
endchannel;
block my_observer;
signalroute r
from env to my_observer with observe,
pre_in_orchestrator_pulse,
foo;
from my_observer to env with foo;
connect c and r;
/* CIF PROCESS (250, 87), (150, 75) */
/* CIF PROCESS (259, 87), (150, 75) */
process my_observer;
/* CIF TEXT (0, 57), (256, 184) */
/* CIF TEXT (0, 57), (256, 216) */
monitor st System_State;
monitor event Observable_Event;
......@@ -37,23 +42,32 @@ foo;
dcl p1 T_Int;
/* CIF ENDTEXT */
/* CIF procedure (2060, 152), (70, 35) */
/* CIF procedure (161, 457), (106, 35) */
procedure Discard_Event;
/* CIF START (182, 39), (70, 35) */
START;
/* CIF task (142, 94), (148, 35) */
task Event := No_Event : {};
/* CIF return (199, 149), (35, 35) */
return ;
endprocedure;
/* CIF procedure (2145, 152), (70, 35) */
procedure observe;
/* CIF TEXT (140, 48), (313, 120) */
/* CIF TEXT (285, 48), (313, 120) */
-- this procedure could be generated automatically,
-- and be read-only.
fpar in/out model System_State,
in/out last_event Observable_Event;
/* CIF ENDTEXT */
/* CIF START (464, 153), (70, 35) */
/* CIF START (609, 153), (70, 35) */
START;
/* CIF task (430, 208), (137, 40) */
/* CIF task (575, 208), (137, 40) */
task st := model,
Event := Last_Event;
/* CIF PROCEDURECALL (345, 268), (308, 35) */
/* CIF PROCEDURECALL (490, 268), (308, 35) */
call writeln('[observer] Event: ', present(event));
/* CIF decision (442, 323), (113, 50) */
/* CIF decision (587, 323), (113, 50) */
decision present(event);
/* CIF ANSWER (97, 393), (93, 24) */
(input_event):
......@@ -61,142 +75,140 @@ Event := Last_Event;
call writeln('FROM: ', event.input_event.source);
/* CIF PROCEDURECALL (0, 492), (289, 35) */
call writeln('TO: ', event.input_event.dest);
/* CIF ANSWER (392, 393), (103, 24) */
/* CIF ANSWER (393, 393), (103, 24) */
(output_event):
/* CIF PROCEDURECALL (299, 437), (290, 35) */
/* CIF PROCEDURECALL (300, 437), (290, 35) */
call writeln('FROM: ', event.output_event.source);
/* CIF PROCEDURECALL (300, 492), (289, 35) */
call writeln('TO: ', event.output_event.dest);
/* CIF ANSWER (627, 393), (114, 24) */
/* CIF ANSWER (629, 393), (114, 24) */
(system_startup):
/* CIF PROCEDURECALL (600, 437), (169, 35) */
/* CIF PROCEDURECALL (601, 437), (169, 35) */
call writeln('system startup');
/* CIF ANSWER (825, 393), (78, 24) */
/* CIF ANSWER (827, 393), (78, 24) */
(no_event):
/* CIF PROCEDURECALL (780, 437), (169, 35) */
/* CIF PROCEDURECALL (781, 437), (169, 35) */
call writeln('no_event');
/* CIF ANSWER (984, 393), (123, 24) */
(unhandled_input):
/* CIF PROCEDURECALL (974, 437), (142, 35) */
call writeln('Lost input');
enddecision;
/* CIF return (481, 543), (35, 35) */
/* CIF return (626, 543), (35, 35) */
return ;
endprocedure;
/* CIF START (683, 86), (70, 35) */
/* CIF START (589, 96), (70, 35) */
START;
/* CIF PROCEDURECALL (638, 141), (159, 35) */
call writeln ('observer init');
/* CIF NEXTSTATE (676, 191), (83, 35) */
/* CIF NEXTSTATE (582, 151), (83, 35) */
NEXTSTATE first_state;
/* CIF state (662, 434), (101, 34) */
state second_state;
/* CIF provided (594, 489), (239, 45) */
provided st.orchestrator.magic_number = 42;
/* CIF NEXTSTATE (663, 554), (101, 35) */
NEXTSTATE third_state;
endstate;
/* CIF state (663, 324), (101, 35) */
state Wait_count;
/* CIF provided (671, 379), (85, 35) */
provided count = 3
/* CIF comment (780, 376), (104, 40) */
comment 'Called AFTER
the input';
/* CIF NEXTSTATE (662, 434), (101, 34) */
NEXTSTATE second_state;
endstate;
/* CIF state (676, 191), (83, 35) */
state first_state;
/* CIF provided (644, 248), (139, 56) */
provided input pulse
to orchestrator
/* CIF comment (810, 256), (111, 40) */
comment 'Called BEFORE
the input';
/* CIF NEXTSTATE (663, 324), (101, 35) */
NEXTSTATE Wait_count;
endstate;
/* CIF state (992, 237), (97, 40) */
/* CIF state (1169, 237), (97, 40) */
state fourth_state;
/* CIF provided (943, 297), (193, 79) */
/* CIF provided (1121, 297), (193, 79) */
provided output do_something(p)
from orchestrator
to another_function
/* CIF comment (1159, 308), (146, 56) */
/* CIF comment (1337, 308), (146, 56) */
comment 'intercept the output
and modify the value
of the parameter';
/* CIF decision (1005, 396), (70, 50) */
/* CIF decision (1182, 396), (70, 50) */
decision p = 42;
/* CIF ANSWER (939, 466), (70, 24) */
/* CIF ANSWER (1117, 466), (70, 24) */
(true):
/* CIF task (939, 510), (70, 35) */
/* CIF task (1117, 510), (70, 35) */
task p := 99;
/* CIF NEXTSTATE (932, 565), (85, 35) */
/* CIF NEXTSTATE (1109, 565), (85, 35) */
NEXTSTATE fifth_state;
/* CIF ANSWER (1039, 466), (70, 24) */
/* CIF ANSWER (1217, 466), (70, 24) */
(false):
/* CIF NEXTSTATE (1028, 510), (92, 35) */
/* CIF NEXTSTATE (1205, 510), (92, 35) */
NEXTSTATE unexpected;
enddecision;
endstate;
/* CIF state (1286, 90), (88, 35) */
/* CIF state (1371, 90), (88, 35) */
state third_state;
/* CIF provided (954, 145), (173, 72) */
/* CIF input (1495, 147), (70, 35) */
input Foo (pr);
/* CIF output (1495, 202), (70, 35) */
output foo (pr);
/* CIF NEXTSTATE (1495, 252), (70, 35) */
NEXTSTATE -;
/* CIF provided (1132, 145), (173, 72) */
provided output paramesstogui
from orchestrator;
/* CIF NEXTSTATE (992, 237), (97, 40) */
/* CIF NEXTSTATE (1169, 237), (97, 40) */
NEXTSTATE fourth_state;
/* CIF input (1317, 145), (218, 49) */
input pre_in_orchestrator_pulse(toto)
/* CIF comment (1555, 152), (127, 56) */
comment 'alias for
input pulse to
orchestrator';
/* CIF decision (1391, 214), (70, 50) */
decision toto;
/* CIF ANSWER (1335, 284), (70, 24) */
(1):
/* CIF ANSWER (1425, 284), (70, 24) */
else:
enddecision;
/* CIF NEXTSTATE (1391, 324), (70, 35) */
NEXTSTATE -;
endstate;
/* CIF state (154, 262), (95, 35) */
state end_success;
endstate;
/* CIF state (157, 314), (92, 35) */
state unexpected;
endstate;
/* CIF state (1710, 437), (87, 35) */
/* CIF state (1808, 437), (87, 35) */
state sixth_state;
/* CIF provided (1694, 492), (121, 50) */
/* CIF provided (1792, 492), (121, 50) */
provided actual_val = 100;
/* CIF NEXTSTATE (1706, 562), (95, 35) */
/* CIF NEXTSTATE (1804, 562), (95, 35) */
NEXTSTATE end_success;
endstate;
/* CIF state (1728, 88), (145, 57) */
/* CIF state (1826, 88), (145, 57) */
state fifth_state;
/* CIF provided (1708, 165), (184, 68) */
/* CIF provided (1806, 165), (184, 68) */
provided input do_something(val)
to another_function
/* CIF comment (1915, 163), (134, 72) */
/* CIF comment (2013, 163), (134, 72) */
comment 'intercept the input
before execution
(=post-output)
alter it again';
/* CIF decision (1750, 253), (99, 68) */
/* CIF decision (1848, 253), (99, 68) */
decision val = 99;
/* CIF ANSWER (1723, 343), (62, 24) */
/* CIF ANSWER (1821, 343), (62, 24) */
(true):
/* CIF task (1707, 387), (93, 35) */
/* CIF task (1805, 387), (93, 35) */
task val := val + 1;
/* CIF NEXTSTATE (1710, 437), (87, 35) */
/* CIF NEXTSTATE (1808, 437), (87, 35) */
NEXTSTATE sixth_state;
/* CIF ANSWER (1839, 343), (70, 24) */
/* CIF ANSWER (1937, 343), (70, 24) */
(false):
/* CIF NEXTSTATE (1827, 387), (92, 35) */
/* CIF NEXTSTATE (1925, 387), (92, 35) */
NEXTSTATE unexpected;
enddecision;
endstate;
/* CIF state (242, 314), (92, 35) */
state unexpected;
endstate;
/* CIF state (266, 262), (95, 35) */
state end_success;
endstate;
/* CIF state (403, 394), (101, 34) */
state second_state;
/* CIF provided (335, 449), (239, 45) */
provided st.orchestrator.magic_number = 42;
/* CIF NEXTSTATE (404, 514), (101, 35) */
NEXTSTATE third_state;
endstate;
/* CIF state (404, 284), (101, 35) */
state Wait_count;
/* CIF provided (412, 339), (85, 35) */
provided count = 3
/* CIF comment (521, 336), (136, 56) */
comment 'Called immediately
if true';
/* CIF NEXTSTATE (403, 394), (101, 34) */
NEXTSTATE second_state;
endstate;
/* CIF state (582, 151), (83, 35) */
state first_state;
/* CIF provided (385, 208), (139, 56) */
provided input pulse
to orchestrator
/* CIF comment (551, 216), (111, 40) */
comment 'Called AFTER
the input';
/* CIF NEXTSTATE (404, 284), (101, 35) */
NEXTSTATE Wait_count;
/* CIF provided (672, 206), (148, 40) */
provided unhandled input
pulse to orchestrator;
/* CIF NEXTSTATE (712, 266), (70, 35) */
NEXTSTATE -;
endstate;
endprocess my_observer;
endblock;
endsystem;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment