Commit b3a85b8e authored by dbarbera's avatar dbarbera
Browse files

Merge remote-tracking branch 'upstream/master'

parents 1a1c5d75 90ee507e
......@@ -31,7 +31,7 @@ import os
import logging
import traceback
from itertools import chain, permutations, combinations
from collections import defaultdict
from collections import defaultdict, Counter
import antlr3
import antlr3.tree
......@@ -1675,8 +1675,13 @@ def variables(root, ta_ast, context):
str(child.type))
for variable in var:
# Add to the context and text area AST entries
context.variables[variable] = (asn1_sort, def_value)
ta_ast.variables[variable] = (asn1_sort, def_value)
if variable.lower() in context.variables \
or variable.lower() in ta_ast.variables:
errors.append('Variable "{}" is declared more than once'
.format(variable))
else:
context.variables[variable.lower()] = (asn1_sort, def_value)
ta_ast.variables[variable.lower()] = (asn1_sort, def_value)
if not DV:
errors.append('Cannot do semantic checks on variable declarations')
return errors, warnings
......@@ -2538,7 +2543,7 @@ def state(root, parent, context):
state_def.charPositionInLine = child.getCharPositionInLine()
exceptions = [c.toString() for c in child.getChildren()]
for st in context.mapping:
if st not in (exceptions, 'START'):
if st not in exceptions + ['START']:
state_def.statelist.append(st)
elif child.type == lexer.INPUT:
# A transition triggered by an INPUT
......@@ -2548,6 +2553,19 @@ def state(root, parent, context):
warnings.extend(warn)
try:
for statename in state_def.statelist:
# check that input is not already defined
existing = context.mapping.get(statename.lower(), [])
dupl = set()
for each in inp.inputlist:
for ex_input in (name for i in existing
for name in i.inputlist):
if unicode(each) == unicode(ex_input):
dupl.add(each)
for each in dupl:
errors.append('Input "{}" is defined more '
'than once for state "{}"'
.format(each, statename.lower()))
# then update the mapping state-input
context.mapping[statename.lower()].append(inp)
except KeyError:
warnings.append('State definition missing')
......@@ -2955,6 +2973,7 @@ def decision(root, parent, context):
covered_ranges = defaultdict(list)
qmin, qmax = 0, 0
need_else = False
is_enum = False
for ans in dec.answers:
if ans.kind in ('constant', 'open_range'):
expr = ans.openRangeOp()
......@@ -2967,6 +2986,13 @@ def decision(root, parent, context):
ans.constant = expr.right
q_basic = find_basic_type(dec.question.exprType)
a_basic = find_basic_type(ans.constant.exprType)
if q_basic.kind.endswith('EnumeratedType'):
if not ans.constant.is_raw:
# Ref to a variable -> can't guarantee coverage
need_else = True
continue
covered_ranges[ans].append(ans.inputString)
is_enum = True
if not q_basic.kind.startswith('Integer'):
continue
# numeric type -> find the range covered by this answer
......@@ -3077,14 +3103,17 @@ def decision(root, parent, context):
l=a0_val, h=a1_val))
covered_ranges[ans].append((int(float(a0_basic.Min)),
int(float(a1_basic.Max))))
# Check the following:
# Check the following
# (1) no overlap between covered ranges in decision answers
# (2) no gap in the coverage of the decision possible values
# (3) ELSE branch, if present, can be reached
# (4) if an answer uses a non-ground expression an ELSE is there
# (5) present() operator and enumerated question are fully covered
q_ranges = [(qmin, qmax)] if is_numeric(dec.question.exprType) else []
for each in combinations(covered_ranges.viewitems(), 2):
if not q_ranges:
continue
for comb in combinations(
chain.from_iterable(val[1] for val in each), 2):
comb_overlap = (max(comb[0][0], comb[1][0]),
......@@ -3099,9 +3128,10 @@ def decision(root, parent, context):
o1=comb_overlap[0],
o2=comb_overlap[1]))
new_q_ranges = []
# for minq, maxq in q_ranges:
# (2) Check that decision range is fully covered
for ans_ref, ranges in covered_ranges.viewitems():
if is_enum:
continue
for mina, maxa in ranges:
for minq, maxq in q_ranges:
left = (minq, min(maxq, mina - 1))
......@@ -3129,6 +3159,21 @@ def decision(root, parent, context):
warnings.append('Decision "{}": Missing ELSE branch'
.format(dec.inputString))
# (5) check coverage of enumerated types
if is_enum:
# check duplicate answers
answers = list(chain.from_iterable(covered_ranges.viewvalues()))
dupl = [a for a, v in Counter(answers).items() if v > 1]
if dupl:
errors.append('Decision "{}": duplicate answers "{}"'
.format(dec.inputString, '", "'.join(dupl)))
enumerants = [en.replace('-', '_') for en in q_basic.EnumValues.keys()]
# check for missing answers
if set(answers) != set(enumerants) and not has_else:
errors.append('Decision "{}": Missing branches for answer(s) "{}"'
.format(dec.inputString,
'", "'.join(set(enumerants) - set(answers))))
return dec, errors, warnings
......
......@@ -95,7 +95,8 @@ try:
import LlvmGenerator
except ImportError:
# not sure if LLVM is available on the Windows platform
pass
LlvmGenerator = None
print 'LLVM is not available'
__all__ = ['opengeode']
__version__ = '0.994'
......@@ -1799,9 +1800,9 @@ def init_logging(options):
for module in modules:
module.LOG.addHandler(handler_console)
module.LOG.setLevel(level)
except NameError:
except (NameError, AttributeError) as err:
# Some modules may not be loaded (like llvm on Windows)
pass;
LOG.info(str(err))
def parse(files):
......
......@@ -10,7 +10,7 @@ test-parse:
../../../opengeode.py myfunction.pr system_structure.pr --check
test-ada:
../../../opengeode.py --toAda myfunction.pr system_structure.pr 2>&1 | diff expected - || exit 0
../../../opengeode.py --toAda myfunction.pr system_structure.pr 2>&1 | sort | diff expected - || exit 0
coverage:
coverage run -p ../../../opengeode.py myfunction.pr system_structure.pr --toAda
......
[ERROR] Decision "var1": answers -500:500 and /=1 are overlapping in range [-500 .. 0]
[ERROR] Decision "var1": answers -500:500 and /=1 are overlapping in range [2 .. 500]
[ERROR] Decision "var1": answers -500:500 and =0 are overlapping in range [0 .. 0]
[ERROR] Decision "var1": answers -500:500 and >0 are overlapping in range [1 .. 500]
[ERROR] Decision "var1": answers =0 and /=1 are overlapping in range [0 .. 0]
[ERROR] Decision "var1": answers >0 and /=1 are overlapping in range [2 .. 2147483647]
[ERROR] Decision "var2": No answer to cover range [0 .. 255]
[ERROR] Decision "var3": No answer to cover range [50 .. 50]
[ERROR] Decision "var3": answers /=50 and 10:20 are overlapping in range [10 .. 20]
[ERROR] Too many errors, cannot generate code
[INFO] Checking ['myfunction.pr', 'system_structure.pr']
[INFO] Parsing complete. Summary, found 6 warnings and 6 errors
[WARNING] Decision "var2": Unreachable branch "<0"
[WARNING] Decision "var2": Unreachable branch ">300"
[INFO] Parsing complete. Summary, found 6 warnings and 9 errors
[WARNING] Decision "var2": Range [-10 .. -1] is unreachable
[WARNING] Decision "var2": Unreachable branch
[WARNING] Decision "var2": Range [256 .. 300] is unreachable
[WARNING] Decision "var2": Unreachable branch
[ERROR] Non-determinism in decision "var1": answers -500:500 and >0 are overlapping in range [1 .. 500]
[ERROR] Non-determinism in decision "var1": answers -500:500 and /=1 are overlapping in range [-500 .. 0]
[ERROR] Non-determinism in decision "var1": answers -500:500 and /=1 are overlapping in range [2 .. 500]
[ERROR] Non-determinism in decision "var1": answers -500:500 and =0 are overlapping in range [0 .. 0]
[ERROR] Non-determinism in decision "var1": answers >0 and /=1 are overlapping in range [2 .. 2147483647]
[ERROR] Non-determinism in decision "var1": answers /=1 and =0 are overlapping in range [0 .. 0]
[ERROR] Too many errors, cannot generate code
[WARNING] Decision "var2": Unreachable branch "<0"
[WARNING] Decision "var2": Unreachable branch ">300"
[WARNING] Decision "var2": Unreachable branch -10:-5
[WARNING] Decision "var2": Unreachable branch 256:300
/* CIF PROCESS (200, 143), (150, 75) */
PROCESS myfunction;
/* CIF TEXT (0, 142), (282, 128) */
/* CIF TEXT (0, 43), (360, 41) */
-- Test the branch coverage checker in decision answers
/* CIF ENDTEXT */
/* CIF TEXT (78, 142), (282, 184) */
dcl var1 t_Int32 := 0;
dcl var2 t_uint8 := 0;
dcl var3 t_uInt8 := 0;
dcl var4 mychoice := a: false;
dcl var5 myenum := hello;
dcl VAR5 mychoice;
/* CIF ENDTEXT */
/* CIF TEXT (36, 43), (360, 41) */
-- Test the branch coverage checker in decision answers
/* CIF ENDTEXT */
/* CIF START (243, 292), (70, 35) */
/* CIF START (525, 71), (70, 35) */
START;
/* CIF DECISION (243, 342), (70, 50) */
/* CIF DECISION (525, 121), (70, 50) */
DECISION var1
/* CIF COMMENT (333, 349), (191, 35) */
/* CIF COMMENT (615, 128), (191, 35) */
COMMENT 'Check range overlapping';
/* CIF ANSWER (96, 412), (90, 24) */
/* CIF ANSWER (370, 191), (90, 24) */
(-500:500):
/* CIF ANSWER (198, 412), (70, 24) */
/* CIF ANSWER (480, 191), (70, 24) */
(=0):
/* CIF ANSWER (288, 412), (70, 24) */
/* CIF ANSWER (570, 191), (70, 24) */
(/=1):
/* CIF ANSWER (378, 412), (70, 24) */
/* CIF ANSWER (660, 191), (70, 24) */
(>0):
ENDDECISION;
/* CIF DECISION (243, 470), (70, 50) */
/* CIF DECISION (525, 245), (70, 50) */
DECISION var2
/* CIF COMMENT (333, 477), (241, 35) */
/* CIF COMMENT (615, 252), (241, 35) */
COMMENT 'Check unreachable branch check';
/* CIF ANSWER (115, 540), (53, 33) */
/* CIF ANSWER (389, 315), (53, 33) */
(<0):
/* CIF ANSWER (197, 540), (68, 33) */
/* CIF ANSWER (471, 315), (68, 33) */
(>300):
/* CIF ANSWER (286, 540), (72, 33) */
/* CIF ANSWER (568, 315), (72, 33) */
(-10:-5):
/* CIF ANSWER (369, 540), (86, 24) */
/* CIF ANSWER (642, 315), (86, 24) */
(256:300):
ENDDECISION;
/* CIF DECISION (242, 602), (71, 50) */
/* CIF DECISION (525, 405), (71, 50) */
DECISION var3;
/* CIF ANSWER (196, 672), (71, 24) */
/* CIF ANSWER (470, 475), (71, 24) */
(10:20):
/* CIF ANSWER (288, 672), (70, 24) */
/* CIF ANSWER (570, 475), (70, 24) */
(/=50):
ENDDECISION;
/* CIF NEXTSTATE (243, 716), (70, 35) */
/* CIF DECISION (499, 529), (123, 50) */
DECISION present(var4)
/* CIF COMMENT (643, 536), (252, 35) */
COMMENT 'Check coverage of CHOICE answers';
/* CIF ANSWER (527, 599), (66, 34) */
(a):
ENDDECISION;
/* CIF DECISION (523, 693), (74, 50) */
DECISION var5
/* CIF COMMENT (611, 691), (241, 50) */
COMMENT 'Check duplicates and
coverage of ENUMERATED values';
/* CIF ANSWER (390, 763), (70, 24) */
(hello):
/* CIF ANSWER (470, 763), (72, 24) */
(world):
/* CIF ANSWER (562, 763), (72, 24) */
(world):
/* CIF ANSWER (661, 763), (70, 24) */
(hello):
ENDDECISION;
/* CIF DECISION (525, 837), (70, 50) */
DECISION var5
/* CIF COMMENT (615, 844), (224, 35) */
COMMENT 'should be no error due to ELSE';
/* CIF ANSWER (412, 907), (105, 24) */
(howareyou):
/* CIF ANSWER (608, 907), (70, 24) */
else:
ENDDECISION;
/* CIF NEXTSTATE (525, 981), (70, 35) */
NEXTSTATE wait;
/* CIF STATE (868, 313), (70, 35) */
/* CIF STATE (1324, 193), (80, 35) */
STATE *(wait);
/* CIF INPUT (1277, 248), (173, 35) */
INPUT start_something(var2);
/* CIF NEXTSTATE (1329, 298), (70, 35) */
NEXTSTATE -;
ENDSTATE;
/* CIF STATE (1215, 52), (70, 35) */
STATE wait;
/* CIF INPUT (1166, 107), (137, 40) */
INPUT start_something
(var2);
/* CIF NEXTSTATE (1203, 162), (70, 35) */
NEXTSTATE -;
ENDSTATE;
/* CIF STATE (958, 325), (70, 35) */
STATE *;
/* CIF INPUT (905, 380), (173, 35) */
INPUT start_something(var2);
/* CIF NEXTSTATE (958, 430), (70, 35) */
NEXTSTATE wait;
ENDSTATE;
/* CIF STATE (1129, 294), (97, 35) */
STATE wait, toto;
/* CIF INPUT (1089, 349), (178, 35) */
INPUT start_something (var2);
/* CIF NEXTSTATE (1144, 399), (70, 35) */
NEXTSTATE -;
ENDSTATE;
ENDPROCESS myfunction;
\ No newline at end of file
/* CIF PROCESS (200, 143), (150, 75) */
PROCESS myfunction;
/* CIF TEXT (0, 133), (282, 128) */
/* CIF TEXT (7, 43), (334, 41) */
-- Test substrings in various contexts and operators
/* CIF ENDTEXT */
/* CIF TEXT (0, 133), (282, 136) */
dcl str MyOctStr := 'abc';
dcl variable_str String := 'Hello!';
......@@ -9,9 +12,6 @@ dcl seqof MySeqOf := {hello, world};
dcl seqint seqInt := {1};
dcl seqbool seqBool := { true, false};
dcl seqbool2 seqBool2 := { true, false};
/* CIF ENDTEXT */
/* CIF TEXT (7, 43), (327, 41) */
-- Test substrings in various contexts and operators
/* CIF ENDTEXT */
/* CIF PROCEDURE (1416, 490), (91, 35) */
PROCEDURE factorial;
......@@ -37,129 +37,131 @@ endfor;
/* CIF COMMENT (218, 326), (179, 53) */
COMMENT 'Check IN operator with
enumerated type';
/* CIF ANSWER (4, 395), (70, 23) */
/* CIF ANSWER (4, 395), (70, 24) */
(true):
/* CIF PROCEDURECALL (-49, 433), (177, 35) */
/* CIF PROCEDURECALL (-49, 434), (177, 35) */
CALL writeln(hello in seqof)
/* CIF COMMENT (148, 433), (111, 35) */
/* CIF COMMENT (148, 434), (114, 35) */
COMMENT 'print "TRUE"';
/* CIF ANSWER (269, 395), (70, 23) */
/* CIF ANSWER (268, 395), (70, 24) */
(false):
ENDDECISION;
/* CIF DECISION (59, 483), (155, 50) */
/* CIF DECISION (59, 484), (155, 50) */
DECISION hello in seqof(0,0)
/* CIF COMMENT (242, 466), (236, 53) */
/* CIF COMMENT (242, 462), (236, 56) */
COMMENT 'Check IN operator with
list substring - first element only
should go to branch TRUE';
/* CIF ANSWER (8, 526), (66, 33) */
/* CIF ANSWER (7, 522), (66, 33) */
(true):
/* CIF PROCEDURECALL (-59, 574), (201, 35) */
/* CIF PROCEDURECALL (-59, 570), (201, 35) */
CALL writeln(hello in seqof(0,1))
/* CIF COMMENT (162, 574), (111, 35) */
/* CIF COMMENT (162, 570), (114, 35) */
COMMENT 'print "TRUE"';
/* CIF ANSWER (286, 527), (70, 23) */
/* CIF ANSWER (285, 523), (70, 24) */
(false):
ENDDECISION;
/* CIF PROCEDURECALL (41, 624), (190, 35) */
/* CIF PROCEDURECALL (40, 620), (191, 35) */
CALL writeln(variable_str(0,4))
/* CIF COMMENT (243, 579), (113, 35) */
/* CIF COMMENT (243, 570), (113, 35) */
COMMENT 'print "Hello"';
/* CIF TASK (48, 674), (176, 53) */
/* CIF TASK (48, 670), (176, 56) */
TASK for x in seqof:
call writeln(num(x));
endfor
/* CIF COMMENT (242, 636), (96, 53) */
/* CIF COMMENT (242, 628), (96, 56) */
COMMENT 'print:
12
13';
/* CIF TASK (47, 742), (178, 53) */
/* CIF TASK (46, 741), (180, 56) */
TASK for x in seqof(0,1):
call writeln(-num(x));
endfor
/* CIF COMMENT (243, 697), (96, 53) */
/* CIF COMMENT (244, 692), (96, 56) */
COMMENT 'print:
-12
-13';
/* CIF PROCEDURECALL (46, 810), (180, 35) */
/* CIF PROCEDURECALL (46, 812), (180, 35) */
CALL writeln(length(seqof))
/* CIF COMMENT (246, 780), (77, 35) */
/* CIF COMMENT (246, 777), (77, 35) */
COMMENT 'print 2';
/* CIF PROCEDURECALL (32, 860), (209, 35) */
/* CIF PROCEDURECALL (32, 862), (209, 35) */
CALL writeln(length(seqof(0,1)))
/* CIF COMMENT (261, 830), (77, 35) */
/* CIF COMMENT (261, 827), (77, 35) */
COMMENT 'print 2';
/* CIF LABEL (55, 910), (162, 35) */
/* CIF LABEL (55, 912), (162, 35) */
variable_length_seq:
/* CIF TASK (65, 960), (142, 53) */
/* CIF TASK (65, 962), (142, 56) */
TASK for x in seqint:
call writeln(x);
endfor
/* CIF COMMENT (227, 915), (96, 53) */
/* CIF COMMENT (227, 913), (96, 53) */
COMMENT 'print:
1';
/* CIF TASK (61, 1028), (150, 53) */
/* CIF TASK (60, 1033), (152, 56) */
TASK for x in seqint(0,0):
call writeln(x);
endfor
/* CIF COMMENT (231, 983), (96, 53) */
/* CIF COMMENT (232, 984), (96, 53) */
COMMENT 'print:
1';
/* CIF DECISION (75, 1096), (123, 50) */
/* CIF DECISION (75, 1104), (123, 50) */
DECISION 1 in seqint
/* CIF COMMENT (217, 1056), (179, 53) */
/* CIF COMMENT (217, 1059), (179, 53) */
COMMENT 'Check IN operator with
variable-length seqOf';
/* CIF ANSWER (7, 1148), (66, 33) */
/* CIF ANSWER (6, 1151), (66, 33) */
(true):
/* CIF PROCEDURECALL (-48, 1196), (177, 35) */
/* CIF PROCEDURECALL (-48, 1199), (177, 35) */
CALL writeln(1 in seqint)
/* CIF COMMENT (149, 1196), (111, 35) */
/* CIF COMMENT (149, 1199), (114, 35) */
COMMENT 'print "TRUE"';
/* CIF ANSWER (267, 1148), (70, 23) */
/* CIF ANSWER (266, 1151), (70, 24) */
(false):
ENDDECISION;
/* CIF DECISION (73, 1246), (126, 50) */
/* CIF DECISION (72, 1249), (128, 50) */
DECISION 1 in seqint(0,0)
/* CIF COMMENT (218, 1206), (179, 53) */
/* CIF COMMENT (219, 1204), (179, 53) */
COMMENT 'Check IN operator with
variable-length seqOf';
/* CIF ANSWER (5, 1298), (70, 23) */
/* CIF ANSWER (5, 1296), (70, 24) */
(true):
/* CIF PROCEDURECALL (-49, 1336), (179, 35) */
/* CIF PROCEDURECALL (-51, 1335), (182, 35) */
CALL writeln(1 in seqint(0,0))
/* CIF COMMENT (150, 1336), (111, 35) */
/* CIF COMMENT (151, 1335), (114, 35) */
COMMENT 'print "TRUE"';
/* CIF ANSWER (268, 1298), (70, 23) */
/* CIF ANSWER (267, 1296), (70, 24) */
(false):
ENDDECISION;
/* CIF PROCEDURECALL (46, 1386), (180, 35) */
/* CIF PROCEDURECALL (46, 1385), (180, 35) */
CALL writeln(length(seqint))
/* CIF COMMENT (246, 1356), (77, 35) */
/* CIF COMMENT (246, 1350), (77, 35) */
COMMENT 'print 1';
/* CIF PROCEDURECALL (30, 1436), (212, 35) */
/* CIF PROCEDURECALL (30, 1435), (212, 35) */
CALL writeln(length(seqint(0,0)))
/* CIF COMMENT (262, 1406), (77, 35) */
/* CIF COMMENT (262, 1400), (77, 35) */
COMMENT 'print 1';
/* CIF TASK (56, 1486), (161, 35) */
/* CIF TASK (54, 1485), (163, 35) */
TASK seqint := seqint // {2};
/* CIF TASK (43, 1536), (186, 35) */
/* CIF TASK (41, 1535), (190, 35) */
TASK seqint := seqint(0,0) // {5};
/* CIF TASK (65, 1586), (142, 53) */
/* CIF TASK (65, 1585), (142, 56) */
TASK for x in seqint:
call writeln(x);
endfor
/* CIF COMMENT (229, 1565), (96, 53) */
/* CIF COMMENT (229, 1560), (96, 56) */
COMMENT 'print:
1
5';
/* CIF TASK (20, 1654), (233, 35) */
/* CIF TASK (20, 1656), (233, 35) */
TASK seqbool := seqbool and seqbool
/* CIF COMMENT (273, 1648), (193, 35) */
/* CIF COMMENT (273, 1645), (194, 35) */
COMMENT 'should not raise any error';
/* CIF TASK (10, 1704), (253, 38) */
TASK seqbool2 := seqbool2 and seqbool2;
/* CIF NEXTSTATE (104, 1757), (65, 33) */
/* CIF TASK (7, 1706), (258, 38) */
TASK 'seqbool2 := seqbool2 and seqbool2'
/* CIF COMMENT (285, 1707), (213, 35) */
COMMENT 'Variable-length -> raise error';
/* CIF NEXTSTATE (102, 1759), (68, 33) */
NEXTSTATE Wait;
/* CIF STATE (839, 313), (70, 35) */
STATE wait;
......
all: test-ada
edit:
../../../opengeode.py orchestrator.pr system_structure.pr
test-parse:
../../../opengeode.py orchestrator.pr system_structure.pr --check
......
all: test-ada
edit:
../../../opengeode.py challenge.pr system_structure.pr
test-parse:
../../../opengeode.py challenge.pr system_structure.pr --check
......
/* CIF PROCESS (150, 150), (150, 75) */
PROCESS challenge;
/* CIF TEXT (922, 91), (298, 120) */
dcl count, actual_count CountTab;
dcl pow_value T_UInt32 := 0;
dcl check T_UInt8;
dcl bitwise SeqBit;
dcl bitwise2 SeqBit2;
dcl boolwise t_Boolean;
/* CIF ENDTEXT */
/* CIF TEXT (0, 26), (502, 179) */
procedure test;
fpar in first t_UInt8,
......@@ -10,19 +19,10 @@ dcl testvalue t_boolean := true;
dcl nested Nested := {a {b {c {p {x 1, y 2}, l {3, 4}}}}};
/* CIF ENDTEXT */
/* CIF TEXT (922, 91), (298, 120) */
dcl count, actual_count CountTab;
dcl pow_value T_UInt32 := 0;
dcl check T_UInt8;
dcl bitwise SeqBit;
dcl bitwise2 SeqBit2;
dcl boolwise t_Boolean;
/* CIF ENDTEXT */
/* CIF START (672, 14), (68, 37) */
START;
/* CIF TASK (614, 66), (184, 72) */
/* CIF TASK (613, 66), (184, 72) */
TASK for x in count:
count(x) := count_max
actual_count(x) := 0
......@@ -31,23 +31,23 @@ endfor;
TASK nested := {a {b {c {p {x 1, y 2}, l {3, 4}}}}};
/* CIF NEXTSTATE (671, 203), (70, 35) */
NEXTSTATE Wait;
/* CIF STATE (760, 11), (68, 35) */
/* CIF STATE (759, 11), (68, 35) */
STATE Wait;
ENDSTATE;
/* CIF STATE (671, 203), (70, 35) */
STATE Wait;
/* CIF INPUT (671, 258), (70, 35) */
INPUT run;
/* CIF PROCEDURECALL (623, 308), (166, 35) */
/* CIF PROCEDURECALL (622, 308), (166, 35) */
CALL writeln('Computing');
/* CIF TASK (500, 358), (412, 216) */
/* CIF TASK (499, 358), (412, 216) */
TASK for x in range(exceed_nb):
for n in range(nb_bit):
call pow(2, n, pow_value);
check := if val_max - x>0 and pow_value>0 then 1 else 0 fi
bitwise := bitwise and bitwise
bitwise2 := bitwise2 xor {true, false}
bitwise2 := bitwise2 and bitwise2
-- bitwise2 := bitwise2 xor {true, false}
-- bitwise2 := bitwise2 and bitwise2
boolwise := boolwise and boolwise
check := if (check=0) and pow_value>1 then 1 else 0 fi
count(n) := count(n) - check
......
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