Commit 84ed9813 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix size issue with embedded sequence of primaries

parent ad0f9b0f
...@@ -1655,7 +1655,6 @@ def _choiceitem(choice): ...@@ -1655,7 +1655,6 @@ def _choiceitem(choice):
stmts, choice_str, local_decl = expression(choice.value['value']) stmts, choice_str, local_decl = expression(choice.value['value'])
if isinstance(choice.value['value'], (ogAST.PrimSequenceOf, if isinstance(choice.value['value'], (ogAST.PrimSequenceOf,
ogAST.PrimStringLiteral)): ogAST.PrimStringLiteral)):
print choice.value['value'].exprType
choice_str = array_content(choice.value['value'], choice_str, choice_str = array_content(choice.value['value'], choice_str,
find_basic_type(choice.value['value'].exprType)) find_basic_type(choice.value['value'].exprType))
ada_string = u'{cType}_{opt}_set({expr})'.format( ada_string = u'{cType}_{opt}_set({expr})'.format(
...@@ -1972,10 +1971,14 @@ def array_content(prim, values, asnty): ...@@ -1972,10 +1971,14 @@ def array_content(prim, values, asnty):
inputs: prim is of type PrimStringLiteral or PrimSequenceOf inputs: prim is of type PrimStringLiteral or PrimSequenceOf
values is a string with the sequence of numbers as processed by expression values is a string with the sequence of numbers as processed by expression
asnty is the reference type of the string literal ''' asnty is the reference type of the string literal '''
rtype = find_basic_type(prim.exprType) #rtype = find_basic_type(prim.exprType)
if asnty.Min != asnty.Max: if asnty.Min != asnty.Max:
length = len(prim.value)
if isinstance(prim, ogAST.PrimStringLiteral):
# Quotes are kept in string literals
length -= 2
# Reference type can vary -> there is a Length field # Reference type can vary -> there is a Length field
rlen = u", Length => {}".format(rtype.Min) rlen = u", Length => {}".format(length) # rtype.Min)
else: else:
rlen = u"" rlen = u""
if isinstance(prim, ogAST.PrimStringLiteral): if isinstance(prim, ogAST.PrimStringLiteral):
......
...@@ -16,102 +16,103 @@ dcl V5 Toto := { elem_1 'Hello' }; ...@@ -16,102 +16,103 @@ dcl V5 Toto := { elem_1 'Hello' };
dcl V6 Toto := { elem_1 'Hello', elem_2 {'Hello', 'World'} }; dcl V6 Toto := { elem_1 'Hello', elem_2 {'Hello', 'World'} };
dcl V7 AChoice := a: TRUE; dcl V7 AChoice := a: TRUE;
dcl V8 ACHoice := b: {'Hello', 'World!'}; dcl V8 ACHoice := b: {'Hello', 'World!'};
/* CIF ENDTEXT */ /* CIF ENDTEXT */
/* CIF START (1262, 95), (100, 50) */ /* CIF START (1109, 72), (60, 30) */
START; START;
/* CIF LABEL (1277, 160), (70, 35) */ /* CIF TASK (1050, 118), (177, 35) */
TASK v8 := b: {'hello', 'world'} ;
/* CIF LABEL (1104, 168), (70, 35) */
one: one:
/* CIF DECISION (1263, 210), (98, 50) */ /* CIF DECISION (1090, 218), (98, 50) */
DECISION V1 = V2; DECISION V1 = V2;
/* CIF ANSWER (1135, 280), (73, 28) */ /* CIF ANSWER (962, 288), (73, 28) */
(true): (true):
/* CIF TASK (1110, 323), (123, 35) */ /* CIF TASK (937, 331), (123, 35) */
TASK fail := false; TASK fail := false;
/* CIF PROCEDURECALL (1097, 373), (150, 38) */ /* CIF PROCEDURECALL (923, 381), (150, 38) */
CALL writeln('2'); CALL writeln('2');
/* CIF LABEL (1137, 426), (70, 35) */ /* CIF LABEL (963, 434), (70, 35) */
two: two:
/* CIF DECISION (1123, 476), (98, 50) */ /* CIF DECISION (949, 484), (98, 50) */
DECISION V3 = V4; DECISION V3 = V4;
/* CIF ANSWER (789, 546), (73, 28) */ /* CIF ANSWER (616, 554), (73, 28) */
(true): (true):
/* CIF TASK (764, 589), (123, 35) */ /* CIF TASK (591, 597), (123, 35) */
TASK fail := false; TASK fail := false;
/* CIF PROCEDURECALL (750, 639), (150, 38) */ /* CIF PROCEDURECALL (577, 647), (150, 38) */
CALL writeln('4'); CALL writeln('4');
/* CIF LABEL (784, 692), (82, 35) */ /* CIF LABEL (611, 700), (82, 35) */
three: three:
/* CIF DECISION (747, 742), (156, 95) */ /* CIF DECISION (574, 750), (156, 95) */
DECISION V5 /= V6 DECISION V5 /= V6
and V7 /= V8; and V7 /= V8;
/* CIF ANSWER (713, 857), (73, 28) */ /* CIF ANSWER (540, 865), (73, 28) */
(true): (true):
/* CIF PROCEDURECALL (674, 900), (150, 38) */ /* CIF PROCEDURECALL (501, 908), (150, 38) */
CALL writeln('5'); CALL writeln('5');
/* CIF TASK (627, 953), (245, 68) */ /* CIF TASK (454, 961), (245, 68) */
TASK V5 := V6, TASK V5 := V6,
V7 := b: {'Hello', 'World'}, V7 := b: {'Hello', 'World'},
V8!b(1) := V7!b(1)(0 ,4); V8!b(1) := V7!b(1)(0 ,4);
/* CIF JOIN (732, 1036), (35, 35) */ /* CIF JOIN (559, 1044), (35, 35) */
JOIN three; JOIN three;
/* CIF ANSWER (918, 857), (78, 28) */ /* CIF ANSWER (745, 865), (78, 28) */
(false): (false):
/* CIF PROCEDURECALL (882, 900), (150, 38) */ /* CIF PROCEDURECALL (709, 908), (150, 38) */
CALL writeln('6'); CALL writeln('6');
/* CIF NEXTSTATE (922, 953), (70, 35) */ /* CIF NEXTSTATE (749, 961), (70, 35) */
NEXTSTATE wait; NEXTSTATE wait;
ENDDECISION; ENDDECISION;
/* CIF ANSWER (1703, 546), (78, 28) */ /* CIF ANSWER (1530, 554), (78, 28) */
(false): (false):
/* CIF DECISION (1703, 589), (78, 50) */ /* CIF DECISION (1530, 597), (78, 50) */
DECISION fail; DECISION fail;
/* CIF ANSWER (1596, 659), (73, 28) */ /* CIF ANSWER (1423, 667), (73, 28) */
(true): (true):
/* CIF PROCEDURECALL (1406, 702), (452, 38) */ /* CIF PROCEDURECALL (1233, 710), (452, 38) */
CALL writeln('FAIL: V3 = V4 reports FALSE, but...'); CALL writeln('FAIL: V3 = V4 reports FALSE, but...');
/* CIF PROCEDURECALL (1363, 755), (539, 35) */ /* CIF PROCEDURECALL (1190, 763), (539, 35) */
CALL writeln('Length of V3(1) =', Length(V3(1)), ' and Value = ', V3(1)); CALL writeln('Length of V3(1) =', Length(V3(1)), ' and Value = ', V3(1));
/* CIF PROCEDURECALL (1358, 805), (549, 35) */ /* CIF PROCEDURECALL (1185, 813), (549, 35) */
CALL writeln('Length of V4(1) =', Length(V4(1)), ' and Value = ', V4(1)); CALL writeln('Length of V4(1) =', Length(V4(1)), ' and Value = ', V4(1));
/* CIF NEXTSTATE (1597, 855), (70, 35) */ /* CIF NEXTSTATE (1424, 863), (70, 35) */
NEXTSTATE wait; NEXTSTATE wait;
/* CIF ANSWER (1976, 659), (78, 28) */ /* CIF ANSWER (1803, 667), (78, 28) */
(false): (false):
/* CIF PROCEDURECALL (1940, 702), (150, 38) */ /* CIF PROCEDURECALL (1767, 710), (150, 38) */
CALL writeln('3'); CALL writeln('3');
/* CIF TASK (1917, 755), (196, 35) */ /* CIF TASK (1744, 763), (196, 35) */
TASK V3(1) := V4(1)(0,4); TASK V3(1) := V4(1)(0,4);
/* CIF TASK (1956, 805), (118, 35) */ /* CIF TASK (1783, 813), (118, 35) */
TASK fail := true; TASK fail := true;
/* CIF JOIN (1997, 855), (35, 35) */ /* CIF JOIN (1824, 863), (35, 35) */
JOIN two; JOIN two;
ENDDECISION; ENDDECISION;
ENDDECISION; ENDDECISION;
/* CIF ANSWER (2205, 280), (78, 28) */ /* CIF ANSWER (2032, 288), (78, 28) */
(false): (false):
/* CIF DECISION (2205, 323), (78, 50) */ /* CIF DECISION (2032, 331), (78, 50) */
DECISION fail; DECISION fail;
/* CIF ANSWER (2163, 393), (73, 28) */ /* CIF ANSWER (1990, 401), (73, 28) */
(true): (true):
/* CIF PROCEDURECALL (2123, 436), (153, 38) */ /* CIF PROCEDURECALL (1950, 444), (153, 38) */
CALL writeln('FAIL'); CALL writeln('FAIL');
/* CIF NEXTSTATE (2164, 489), (70, 35) */ /* CIF NEXTSTATE (1991, 497), (70, 35) */
NEXTSTATE wait; NEXTSTATE wait;
/* CIF ANSWER (2323, 393), (78, 28) */ /* CIF ANSWER (2150, 401), (78, 28) */
(false): (false):
/* CIF PROCEDURECALL (2287, 436), (150, 38) */ /* CIF PROCEDURECALL (2114, 444), (150, 38) */
CALL writeln('1'); CALL writeln('1');
/* CIF TASK (2308, 489), (108, 35) */ /* CIF TASK (2135, 497), (108, 35) */
TASK V2 := V1; TASK V2 := V1;
/* CIF TASK (2303, 539), (118, 35) */ /* CIF TASK (2130, 547), (118, 35) */
TASK fail := true; TASK fail := true;
/* CIF JOIN (2344, 589), (35, 35) */ /* CIF JOIN (2171, 597), (35, 35) */
JOIN one; JOIN one;
ENDDECISION; ENDDECISION;
ENDDECISION; ENDDECISION;
/* CIF STATE (715, 549), (70, 35) */ /* CIF STATE (130, 407), (70, 35) */
STATE wait; STATE wait;
ENDSTATE; ENDSTATE;
ENDPROCESS og; ENDPROCESS og;
\ 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