Commit 444c0825 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Build the observer properly

parent 22757a71
......@@ -6,12 +6,15 @@ mc: observer/my_observer.adb mcsrc/mc.adb mcsrc/properties.adb
ADA_PROJECT_PATH=~/.local/share/gpr:${ADA_PROJECT_PATH} gprbuild -p -P mc
observer/my_observer.adb: observer/observer.pr observer/observer.asn
cd observer && opengeode --toAda observer.pr
cd observer && opengeode --toAda observer.pr && \
asn1.exe -Ada -typePrefix asn1scc -equal --target allboards observer.asn my_observer_datamodel.asn && \
mv src/my_observer_datamodel.ad? .
# gather dataviews needed to build an observer
observer/observer.asn: ../dataview/dataview-uniq.asn ../build/simulation.asn ../orchestrator/SDL/code/orchestrator_datamodel.asn ../another_function/SDL/code/another_function_datamodel.asn
observer/observer.asn: ../dataview/dataview-uniq.asn ../build/simulation.asn ../orchestrator/SDL/code/orchestrator_datamodel.asn ../another_function/SDL/code/another_function_datamodel.asn
cat $^ > $@
cd observer && asn1.exe -Ada -typePrefix asn1scc -equal observer.asn
clean:
ADA_PROJECT_PATH=~/.local/share/gpr:${ADA_PROJECT_PATH} gprclean -P mc
rm observer/my_observer.ad?
......@@ -13,7 +13,7 @@ package body Properties is
procedure My_Properties (Id : out Natural; Success : out Boolean) is
begin
Id := 0;
Observe;
Observe (Global_State => Simulator.State);
Success := (Simulator.State.Orchestrator.State = asn1SccWait
and Simulator.State.Orchestrator.SeqOf = (Length => 4, Data => (4, 4, 4, 4)));
end;
......
......@@ -121,17 +121,18 @@ Orchestrator-Context ::= SEQUENCE {
seqof T-SeqOf
}
ENDAnother-function-Datamodel DEFINITIONS ::=
END
Another-function-Datamodel DEFINITIONS ::=
BEGIN
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;
Another-function-States ::= ENUMERATED {two, one}
Another-function-States ::= ENUMERATED {one, two}
Another-function-Context ::= SEQUENCE {
state Another-function-States,
init-done BOOLEAN
}
END
\ No newline at end of file
END
system my_observer;
/* CIF TEXT (147, 177), (267, 126) */
use datamodel comment 'observer.asn';
exported procedure observe;
fpar in/out ctxt System_State;
referenced;
/* CIF ENDTEXT */
block my_observer;
/* CIF PROCESS (249, 86), (150, 75) */
process my_observer;
/* CIF TEXT (0, 57), (183, 56) */
dcl st System_State;
dcl last_event Event;
/* CIF ENDTEXT */
/* CIF procedure (857, 63), (70, 35) */
procedure observe;
/* CIF TEXT (38, 48), (313, 72) */
-- this procedure could be generated automatically,
-- and be read-only.
fpar in/out ctxt System_State;
/* CIF ENDTEXT */
/* CIF START (181, 153), (70, 35) */
START;
/* CIF task (159, 208), (113, 35) */
task st := ctxt;
/* CIF return (198, 263), (35, 35) */
return ;
endprocedure;
/* CIF START (287, 60), (70, 35) */
START;
/* CIF NEXTSTATE (280, 115), (83, 35) */
NEXTSTATE first_state;
/* CIF state (569, 69), (101, 35) */
state second_state;
/* CIF provided (547, 124), (146, 35) */
provided length(st.events) > 0;
/* CIF task (533, 179), (173, 35) */
task last_event := st.events (0);
/* CIF decision (550, 234), (140, 50) */
decision present(last_event);
/* CIF ANSWER (527, 304), (96, 24) */
(orchestrator):
/* CIF decision (466, 348), (217, 50) */
decision present(last_event.orchestrator);
/* CIF ANSWER (495, 418), (70, 24) */
(msg_in):
/* CIF decision (399, 462), (261, 50) */
decision present(last_event.orchestrator.msg_in);
/* CIF ANSWER (318, 532), (70, 24) */
(arr):
/* CIF PROCEDURECALL (270, 576), (166, 35) */
call writeln('Got arr');
/* CIF ANSWER (489, 532), (82, 24) */
(paramless):
/* CIF PROCEDURECALL (447, 576), (166, 35) */
call writeln('Got paramless');
/* CIF ANSWER (672, 532), (70, 24) */
(pulse):
/* CIF PROCEDURECALL (624, 576), (166, 35) */
call writeln('Got pulse');
enddecision;
/* CIF NEXTSTATE (481, 627), (98, 35) */
NEXTSTATE end_success;
/* CIF ANSWER (801, 418), (74, 24) */
(msg_out):
/* CIF NEXTSTATE (803, 462), (70, 35) */
NEXTSTATE -;
enddecision;
/* CIF ANSWER (886, 304), (70, 24) */
else:
/* CIF NEXTSTATE (886, 348), (70, 35) */
NEXTSTATE -;
enddecision;
endstate;
/* CIF state (280, 115), (83, 35) */
state first_state;
/* CIF provided (217, 170), (208, 35) */
provided st.orchestrator.counter = 4 ;
/* CIF PROCEDURECALL (194, 225), (256, 35) */
call writeln ('counter=4, moving to state 2');
/* CIF NEXTSTATE (271, 280), (101, 35) */
NEXTSTATE second_state;
endstate;
/* CIF state (860, 178), (95, 35) */
state end_success;
endstate;
endprocess my_observer;
endblock;
/* CIF TEXT (147, 177), (267, 126) */
use datamodel comment 'observer.asn';
exported procedure observe;
fpar in/out global_state System_State;
referenced;
signal foo;
/* CIF ENDTEXT */
channel c
from env to my_observer with foo;
endchannel;
block my_observer;
signalroute r
from env to my_observer with foo;
connect c and r;
/* CIF PROCESS (250, 86), (150, 75) */
process my_observer;
/* CIF TEXT (0, 57), (183, 56) */
dcl st System_State;
dcl last_event Event;
/* CIF ENDTEXT */
/* CIF procedure (855, 63), (70, 35) */
procedure observe;
/* CIF TEXT (38, 48), (313, 72) */
-- this procedure could be generated automatically,
-- and be read-only.
fpar in/out global_state System_State;
/* CIF ENDTEXT */
/* CIF START (181, 153), (70, 35) */
START;
/* CIF task (154, 208), (123, 35) */
task st := global_state;
/* CIF return (198, 263), (35, 35) */
return ;
endprocedure;
/* CIF START (287, 60), (70, 35) */
START;
/* CIF NEXTSTATE (280, 115), (83, 35) */
NEXTSTATE first_state;
/* CIF state (567, 69), (101, 35) */
state second_state;
/* CIF provided (545, 124), (146, 35) */
provided length(st.events) > 0;
/* CIF task (532, 179), (173, 35) */
task last_event := st.events (0);
/* CIF decision (548, 234), (140, 50) */
decision present(last_event);
/* CIF ANSWER (525, 304), (96, 24) */
(orchestrator):
/* CIF decision (465, 348), (217, 50) */
decision present(last_event.orchestrator);
/* CIF ANSWER (495, 418), (70, 24) */
(msg_in):
/* CIF decision (399, 462), (261, 50) */
decision present(last_event.orchestrator.msg_in);
/* CIF ANSWER (318, 532), (70, 24) */
(arr):
/* CIF PROCEDURECALL (270, 576), (166, 35) */
call writeln('Got arr');
/* CIF ANSWER (487, 532), (82, 24) */
(paramless):
/* CIF PROCEDURECALL (445, 576), (166, 35) */
call writeln('Got paramless');
/* CIF ANSWER (672, 532), (70, 24) */
(pulse):
/* CIF PROCEDURECALL (624, 576), (166, 35) */
call writeln('Got pulse');
enddecision;
/* CIF NEXTSTATE (481, 627), (98, 35) */
NEXTSTATE end_success;
/* CIF ANSWER (799, 418), (74, 24) */
(msg_out):
/* CIF NEXTSTATE (802, 462), (70, 35) */
NEXTSTATE -;
enddecision;
/* CIF ANSWER (886, 304), (70, 24) */
else:
/* CIF NEXTSTATE (886, 348), (70, 35) */
NEXTSTATE -;
enddecision;
endstate;
/* CIF state (858, 178), (95, 35) */
state end_success;
endstate;
/* CIF state (280, 115), (83, 35) */
state first_state;
/* CIF provided (217, 170), (208, 35) */
provided st.orchestrator.counter = 4;
/* CIF PROCEDURECALL (192, 225), (256, 35) */
call writeln ('counter=4, moving to state 2');
/* CIF NEXTSTATE (270, 280), (101, 35) */
NEXTSTATE second_state;
endstate;
endprocess my_observer;
endblock;
endsystem;
\ No newline at end of file
Supports Markdown
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