Commit 0a732acc authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add body of the callback registration function (Ada)

parent 46c55074
......@@ -125,9 +125,9 @@ def _process(process, simu=False, **kwargs):
res.append('FEATURES')
for param_name, sort, direction in io_param:
res.append(' {pname}: {io} PARAMETER DataView::{sort} '
'{encoding=>Native;};'.format(pname=param_name,
sort=sort,
io=direction))
'{{encoding=>Native;}};'.format(pname=param_name,
sort=sort,
io=direction))
res.append('END {};\n'.format(sp_name))
res.append('SUBPROGRAM IMPLEMENTATION {}.GUI_{}'
.format(sp_name, pi_or_ri))
......@@ -320,7 +320,8 @@ package {process_name} is'''.format(process_name=process_name,
# output signals are the asynchronous RI - only one parameter
for signal in process.output_signals:
param_name = signal.get('param_name') or 'MISSING_PARAM_NAME'
param_name = signal.get('param_name') \
or u'{}_param'.format(signal['name'])
# Add (optional) RI parameter
param_spec = ''
if 'type' in signal:
......@@ -346,6 +347,13 @@ package {process_name} is'''.format(process_name=process_name,
'IN')] if 'type' in signal else []
minicv.append(aadl_template(signal['name'], params, 'RI'))
taste_template.append('procedure Register_{sig}'
'(Callback:{sig}_T) is'
.format(sig=signal['name']))
taste_template.append('begin')
taste_template.append('{} := Callback;'.format(signal['name']))
taste_template.append('end Register_{};'.format(signal['name']))
taste_template.append('')
else:
ads_template.append(u'procedure {}{};'
.format(signal['name'], param_spec))
......
......@@ -15,7 +15,10 @@ test-ada: orchestrator.ali dataview-uniq.o | test_ada.o
test-llvm: orchestrator.o
test-python: orchestrator.ali
test-python:
$(OPENGEODE) orchestrator.pr system_structure.pr --shared
$(ASN1SCC) -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
$(GNATMAKE) -O$(O) -c *.adb
$(GNATBIND) -n -Llibrorchestrator orchestrator
$(GNATMAKE) -c b~orchestrator.adb
$(CC) -shared -o liborchestrator.so b~orchestrator.o orchestrator.o taste_basictypes.o adaasn1rtl.o -lgnat
......
......@@ -2,7 +2,7 @@
PROCESS orchestrator
/* CIF COMMENT (405, 192), (71, 35) */
COMMENT 'Hello';
/* CIF TEXT (39, 94), (398, 293) */
/* CIF TEXT (0, 94), (398, 293) */
dcl seq tastE_Peek_id_list;
dcl fixed FixedString := 'Hello';
......@@ -23,7 +23,10 @@ dcl choice Mychoice;
dcl opt SeqOpt := { A TRUE, b FALSE }; -- test optional fields
/* CIF ENDTEXT */
/* CIF PROCEDURE (760, 371), (91, 35) */
/* CIF PROCEDURE (1273, 175), (106, 35) */
PROCEDURE emptyproc;
ENDPROCEDURE;
/* CIF PROCEDURE (1306, 371), (91, 35) */
PROCEDURE numProc;
/* CIF START (161, 82), (70, 35) */
START;
......@@ -34,124 +37,127 @@ dcl opt SeqOpt := { A TRUE, b FALSE }; -- test optional fields
ENDDECISION;
/* CIF DECISION (135, 240), (122, 50) */
DECISION num(myenum);
/* CIF ANSWER (163, 280), (70, 23) */
/* CIF ANSWER (163, 265), (70, 23) */
else:
ENDDECISION;
/* CIF RETURN (178, 318), (35, 35) */
/* CIF RETURN (178, 303), (35, 35) */
RETURN ;
ENDPROCEDURE;
/* CIF PROCEDURE (727, 175), (106, 35) */
PROCEDURE emptyproc;
ENDPROCEDURE;
/* CIF START (502, 224), (80, 36) */
/* CIF START (596, 224), (80, 36) */
START;
/* CIF TASK (470, 275), (144, 35) */
/* CIF TASK (564, 275), (144, 35) */
TASK opt := { B TRUE }
/* CIF COMMENT (634, 275), (155, 35) */
/* CIF COMMENT (728, 275), (155, 35) */
COMMENT 'Test optional fields';
/* CIF DECISION (481, 325), (122, 50) */
/* CIF DECISION (575, 325), (122, 50) */
DECISION num(myenum);
/* CIF ANSWER (462, 395), (70, 23) */
/* CIF ANSWER (556, 395), (70, 23) */
(0):
/* CIF ANSWER (553, 395), (70, 23) */
/* CIF ANSWER (647, 395), (70, 23) */
else:
ENDDECISION;
/* CIF DECISION (481, 433), (122, 50) */
/* CIF DECISION (575, 433), (122, 50) */
DECISION num(myenum);
/* CIF ANSWER (460, 473), (70, 23) */
/* CIF ANSWER (547, 503), (70, 23) */
(0):
/* CIF ANSWER (550, 473), (70, 23) */
/* CIF ANSWER (644, 503), (70, 23) */
else:
ENDDECISION;
/* CIF DECISION (492, 511), (99, 50) */
/* CIF DECISION (586, 541), (99, 50) */
DECISION 'informal'
/* CIF COMMENT (611, 473), (179, 53) */
/* CIF COMMENT (716, 536), (179, 53) */
COMMENT 'Informal decision -
check that it is ignored
by the code generator';
/* CIF ANSWER (462, 551), (70, 33) */
/* CIF ANSWER (543, 611), (70, 33) */
('a'):
/* CIF ANSWER (550, 551), (70, 33) */
/* CIF ANSWER (647, 611), (70, 33) */
('2'):
ENDDECISION;
/* CIF TASK (430, 599), (223, 38) */
/* CIF TASK (524, 659), (223, 38) */
TASK seqboolean := {true, false},
seqboolean := not {true, false};
/* CIF TASK (438, 652), (208, 83) */
/* CIF TASK (532, 712), (208, 83) */
TASK for x in seqen:
call writeln(num(x));
call writeln(num(myenum));
call writeln(num(myenum));
endfor
/* CIF COMMENT (666, 676), (174, 38) */
/* CIF COMMENT (760, 736), (174, 38) */
COMMENT 'Check that num is not
declared twice';
/* CIF TASK (460, 750), (164, 53) */
/* CIF TASK (554, 810), (164, 53) */
TASK for x in seqen2:
call writeln(num(x));
endfor;
/* CIF TASK (461, 818), (162, 53) */
/* CIF TASK (555, 878), (162, 53) */
TASK for x in seqboolean:
call writeln(x);
endfor
/* CIF COMMENT (643, 827), (168, 38) */
/* CIF COMMENT (737, 887), (168, 38) */
COMMENT 'FOR with a basic type';
/* CIF TASK (431, 886), (222, 35) */
/* CIF TASK (525, 946), (222, 35) */
TASK seqboolean := not seqboolean
/* CIF COMMENT (673, 886), (279, 35) */
/* CIF COMMENT (767, 946), (279, 35) */
COMMENT 'check NOT on a SEQUENCE of BOOLEAN';
/* CIF TASK (461, 936), (162, 53) */
/* CIF TASK (555, 996), (162, 53) */
TASK for x in seqboolean:
call writeln(x);
endfor;
/* CIF TASK (479, 1004), (126, 38) */
/* CIF TASK (573, 1064), (126, 38) */
TASK fixed := 'hello';
/* CIF TASK (467, 1057), (149, 35) */
/* CIF TASK (561, 1117), (149, 35) */
TASK variable := 'HELLO';
/* CIF PROCEDURECALL (454, 1107), (176, 35) */
/* CIF PROCEDURECALL (548, 1167), (176, 35) */
CALL writeln(variable // '!!!');
/* CIF PROCEDURECALL (406, 1157), (272, 35) */
/* CIF PROCEDURECALL (500, 1217), (272, 35) */
CALL writeln(variable // variable // variable);
/* CIF TASK (496, 1207), (91, 35) */
/* CIF TASK (590, 1267), (91, 35) */
TASK seq := {1};
/* CIF TASK (465, 1257), (153, 35) */
/* CIF TASK (559, 1317), (153, 35) */
TASK seq := {1} // {2} // {3};
/* CIF TASK (456, 1307), (172, 35) */
/* CIF TASK (550, 1367), (172, 35) */
TASK seq := seq // {2} // {1};
/* CIF DECISION (507, 1357), (70, 50) */
/* CIF DECISION (601, 1417), (70, 50) */
DECISION any;
/* CIF ANSWER (462, 1427), (70, 23) */
/* CIF ANSWER (556, 1487), (70, 23) */
('a'):
/* CIF ANSWER (552, 1427), (70, 23) */
/* CIF ANSWER (646, 1487), (70, 23) */
('b'):
ENDDECISION;
/* CIF DECISION (497, 1465), (89, 50) */
/* CIF DECISION (591, 1525), (89, 50) */
DECISION myenum
/* CIF COMMENT (606, 1472), (183, 35) */
/* CIF COMMENT (700, 1532), (183, 35) */
COMMENT 'Check case insensitivity';
/* CIF ANSWER (314, 1535), (70, 23) */
/* CIF ANSWER (408, 1595), (70, 23) */
(a):
/* CIF ANSWER (394, 1535), (70, 23) */
/* CIF ANSWER (488, 1595), (70, 23) */
(B):
/* CIF ANSWER (474, 1535), (70, 23) */
/* CIF ANSWER (568, 1595), (70, 23) */
(c):
/* CIF ANSWER (552, 1535), (70, 23) */
/* CIF ANSWER (646, 1595), (70, 23) */
(d):
/* CIF ANSWER (640, 1535), (70, 23) */
/* CIF ANSWER (734, 1595), (70, 23) */
(Ee):
ENDDECISION;
/* CIF DECISION (473, 1573), (138, 50) */
/* CIF DECISION (567, 1633), (138, 50) */
DECISION present(choice)
/* CIF COMMENT (630, 1580), (183, 35) */
/* CIF COMMENT (724, 1640), (183, 35) */
COMMENT 'Check case insensitivity';
/* CIF ANSWER (425, 1643), (70, 23) */
/* CIF ANSWER (519, 1703), (70, 23) */
(cde2):
/* CIF ANSWER (596, 1643), (70, 23) */
/* CIF ANSWER (690, 1703), (70, 23) */
ELSE:
ENDDECISION;
/* CIF NEXTSTATE (483, 1681), (116, 33) */
/* CIF NEXTSTATE (577, 1741), (116, 33) */
NEXTSTATE Wait_for_GUI;
/* CIF STATE (438, 163), (116, 33) */
/* CIF STATE (1063, 119), (116, 33) */
STATE Wait_for_GUI;
/* CIF INPUT (1056, 172), (130, 35) */
INPUT pulse(myenum);
/* CIF OUTPUT (1041, 222), (160, 35) */
OUTPUT telemetry(myenum);
/* CIF NEXTSTATE (1086, 272), (70, 35) */
NEXTSTATE -;
ENDSTATE;
ENDPROCESS orchestrator;
\ No newline at end of file
......@@ -2,9 +2,9 @@
USE Datamodel;
SYSTEM orchestrator;
SIGNAL pulse;
SIGNAL pulse(myenum);
SIGNAL telemetry;
SIGNAL telemetry(myenum);
CHANNEL c
......
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