Newer
Older
Erwan Jahier
committed
Non-regression tests
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/CURRENT.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/CURRENT.lus
node CURRENT::CURRENT(x:bool; y:bool when x) returns (z:bool when x);
-- end of node CURRENT::CURRENT
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/Int.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/Int.lus
const Int8::n = 8;
type _Int8::Int = bool^8;
const Int8::zero = [false, false, false, false, false, false, false, false];
function Int8::fulladd(
ci:bool;
x:bool;
y:bool)
returns (
s:bool;
co:bool);
let
s = (ci xor (x xor y));
co = (((ci and x) or (x and y)) or (y and ci));
tel
-- end of node Int8::fulladd
function Int8::incr(x:A_bool_8) returns (incr:A_bool_8);
(co, incr) = (fillred<<Int8::fulladd, 8>>true, x, zero);
tel
-- end of node Int8::incr
function Int8::add(x:A_bool_8; y:A_bool_8) returns (sum:A_bool_8);
(co, sum) = (fillred<<Int8::fulladd, 8>>false, x, y);
tel
-- end of node Int8::add
node mainPack::Nat(evt:bool; reset:bool) returns (nat:_Int8::Int);
nat = ( if (true -> reset) then Int8::zero else ( if evt then
(Int8::incr((pre nat))) else (pre nat)));
tel
-- end of node mainPack::Nat
-- automatically defined aliases:
type A_bool_8 = bool^8;
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/PCOND.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/PCOND.lus
node PCOND::PCOND(
hA:bool when h0;
hB:bool when h0;
hC:bool when h0;
A:int when hA;
B:int when hB;
C:bool when hC;
hD:bool when hC;
D:bool when hD)
returns (
hX:bool when h0;
hX = ((hC and (current hD)) and ((hA and (current (current D))) or (hB and
(not (current (current D))))));
X = (( if (hA and (current (current D))) then (current A) else (current
B)) when hX);
-- end of node PCOND::PCOND
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/PCOND1.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/PCOND1.lus
node PCOND1::PCOND1(
hA:bool when h0;
hB:bool when h0;
hC:bool when h0;
A:int when hA;
B:int when hB;
C:bool when hC;
hD:bool when hC;
D:bool when hD)
hX:bool when h0);
hX = ((hC and (current hD)) and (h0 when h0));
-- end of node PCOND1::PCOND1
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/SOURIS.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/SOURIS.lus
node SOURIS::SOURIS(
B1:bool;
B2:bool;
B3:bool;
TOP:bool)
returns (
SIMPLE:bool;
DOUBLE:bool;
TRIPLE:bool;
BOUTON:int);
var
count:int;
prev:int;
date:int;
SIMPLE_2:bool;
clic:bool;
chgt:bool;
fin_tps:bool;
fin_tps2:bool;
etat0:bool;
etat1:bool;
etat2:bool;
etat3:bool;
let
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
date = (0 -> ( if ((etat2 or etat3) and (pre etat1)) then count else (pre
date)));
chgt = (false -> ( if (not clic) then false else ( if (((((B3 and (prev =
3)) or (B1 and (prev = 1))) or (B2 and (prev = 2))) or (prev = 0)) or
(((not B1) and (not B2)) and (not B3))) then false else true)));
clic = (((B1 xor B2) xor B3) and (not ((B1 and B2) and B3)));
prev = (0 -> ( if (pre B1) then 1 else ( if (pre B2) then 2 else ( if (pre
B3) then 3 else (pre prev)))));
fin_tps = (false -> ( if TOP then ((pre count) > 6) else ((pre count) >
7)));
fin_tps2 = (false -> ( if TOP then ((pre count) > 4) else ((pre count) >
5)));
count = (0 -> ( if (etat1 and ((((pre etat0) or ((pre etat1) and chgt)) or
((pre etat2) and chgt)) or ((pre etat3) and chgt))) then ( if TOP then 1
else 0) else ( if (etat1 and ((pre etat2) or (pre etat3))) then ( if TOP
then (((pre count) - (pre date)) + 1) else ((pre count) - (pre date))) else
( if TOP then ((pre count) + 1) else (pre count)))));
etat0 = (true -> ( if (((((((pre etat1) and fin_tps) and (not clic)) or
(((pre etat2) and clic) and (not chgt))) or ((pre etat2) and fin_tps)) or
(((pre etat3) and clic) and (not chgt))) or ((pre etat0) and (not clic)))
then true else false));
etat1 = (false -> ( if ((((((pre etat0) and clic) or ((pre etat2) and
chgt)) or ((pre etat3) and (chgt or fin_tps))) or (((pre etat1) and (not
clic)) and (not fin_tps))) or ((pre etat1) and chgt)) then true else
false));
etat2 = (false -> ( if (((((pre etat1) and clic) and (not fin_tps2)) and
(not chgt)) or (((pre etat2) and (not clic)) and (not fin_tps))) then true
else false));
etat3 = (false -> ( if (((((pre etat1) and clic) and fin_tps2) and (not
chgt)) or (((pre etat3) and (not clic)) and (not fin_tps))) then true else
false));
BOUTON = (0 -> ( if (((SIMPLE and (not (pre SIMPLE_2))) or DOUBLE) or
TRIPLE) then prev else ( if (SIMPLE and (pre SIMPLE_2)) then (pre prev)
else 0)));
SIMPLE = (false -> ((((((pre etat1) and etat0) or ((pre etat1) and chgt))
or (((pre etat3) and etat1) and fin_tps)) or (((pre etat3) and etat1) and
chgt)) or (pre SIMPLE_2)));
SIMPLE_2 = (false -> ((((pre etat3) and etat1) and chgt) or (((pre etat1)
and (pre SIMPLE_2)) and chgt)));
DOUBLE = (false -> (((pre etat2) and chgt) or ((pre etat2) and fin_tps)));
TRIPLE = (false -> (((pre etat3) and etat0) or ((((pre etat2) and (not
fin_tps)) and (not chgt)) and etat0)));
-- end of node SOURIS::SOURIS
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/Watch.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/Watch.lus
type _Watch::STATUS_TYPE;
type _Watch::ALARM_TIME_TYPE;
type _Watch::WATCH_TIME_POSITION;
type _Watch::ALARM_TIME_POSITION;
type _Watch::DISPLAY_TYPE;
type _Watch::WATCH_TIME_TYPE;
type _Watch::STOPWATCH_TIME_TYPE;
type _Watch::MAIN_DISPLAY_TYPE;
type _Watch::LABELS_TYPE;
type _Watch::DISPLAY_POSITION;
type _Watch::MINI_DISPLAY_TYPE;
type _Watch::string;
const Watch::INITIAL_WATCH_POSITION:_Watch::WATCH_TIME_POSITION;
const Watch::INITIAL_WATCH_TIME:_Watch::WATCH_TIME_TYPE;
const Watch::ALARM_DURATION:int;
const Watch::stringST:_Watch::string;
const Watch::stringAL:_Watch::string;
const Watch::INITIAL_ALARM_TIME:_Watch::ALARM_TIME_TYPE;
const Watch::INITIAL_ALARM_POSITION:_Watch::ALARM_TIME_POSITION;
const Watch::NULL_POSITION:_Watch::DISPLAY_POSITION;
const Watch::INITIAL_STOPWATCH_TIME:_Watch::STOPWATCH_TIME_TYPE;
extern function Watch::ALARM_TO_DISPLAY_POS(
apos:_Watch::ALARM_TIME_POSITION)
returns (
dpos:_Watch::DISPLAY_POSITION);
extern function Watch::INCREMENT_STOPWATCH_TIME(
time:_Watch::STOPWATCH_TIME_TYPE)
returns (
newtime:_Watch::STOPWATCH_TIME_TYPE);
node Watch::TWO_STATES(
init:bool;
set:bool;
reset:bool)
returns (
state:bool);
let
state = (init -> ( if (set and (not (pre state))) then true else ( if
(reset and (pre state)) then false else (pre state))));
-- end of node Watch::TWO_STATES
node Watch::DIVIDE(scale:int) returns (quotient:bool);
var
n:int;
let
(n, quotient) = ((0, true) -> ( if (((pre n) + 1) = scale) then (0, true)
else (((pre n) + 1), false)));
-- end of node Watch::DIVIDE
extern function Watch::MAKE_DISPLAY(
main:_Watch::MAIN_DISPLAY_TYPE;
mini:_Watch::MINI_DISPLAY_TYPE;
alpha:_Watch::string;
status:_Watch::STATUS_TYPE;
enhanced:_Watch::DISPLAY_POSITION;
labels:_Watch::LABELS_TYPE)
display:_Watch::DISPLAY_TYPE);
extern function Watch::WATCH_TIME_TO_MAIN_DISPLAY(
time:_Watch::WATCH_TIME_TYPE)
display:_Watch::MAIN_DISPLAY_TYPE);
extern function Watch::WATCH_DATE_TO_MINI_DISPLAY(
time:_Watch::WATCH_TIME_TYPE)
display:_Watch::MINI_DISPLAY_TYPE);
extern function Watch::WATCH_DAY_TO_ALPHA_DISPLAY(
time:_Watch::WATCH_TIME_TYPE)
display:_Watch::string);
extern function Watch::STOPWATCH_TIME_TO_MAIN_DISPLAY(
time:_Watch::STOPWATCH_TIME_TYPE)
display:_Watch::MAIN_DISPLAY_TYPE);
extern function Watch::WATCH_TIME_TO_MINI_DISPLAY(
time:_Watch::WATCH_TIME_TYPE)
display:_Watch::MINI_DISPLAY_TYPE);
extern function Watch::ALARM_TIME_TO_MAIN_DISPLAY(
time:_Watch::ALARM_TIME_TYPE)
display:_Watch::MAIN_DISPLAY_TYPE);
node Watch::DISPLAY(
mode_is_watch:bool;
mode_is_stopwatch:bool;
mode_is_alarm:bool;
watch_time:_Watch::WATCH_TIME_TYPE;
stopwatch_time:_Watch::STOPWATCH_TIME_TYPE;
alarm_time:_Watch::ALARM_TIME_TYPE;
position_enhanced:_Watch::DISPLAY_POSITION;
status:_Watch::STATUS_TYPE;
labels:_Watch::LABELS_TYPE)
display:_Watch::DISPLAY_TYPE);
main_display:_Watch::MAIN_DISPLAY_TYPE;
mini_display:_Watch::MINI_DISPLAY_TYPE;
alpha_display:_Watch::string;
display = (Watch::MAKE_DISPLAY(main_display, mini_display, alpha_display,
status, position_enhanced, labels));
(main_display, mini_display, alpha_display) = ( if mode_is_watch then
((Watch::WATCH_TIME_TO_MAIN_DISPLAY(watch_time)),
(Watch::WATCH_DATE_TO_MINI_DISPLAY(watch_time)),
(Watch::WATCH_DAY_TO_ALPHA_DISPLAY(watch_time))) else ( if
mode_is_stopwatch then
((Watch::STOPWATCH_TIME_TO_MAIN_DISPLAY(stopwatch_time)),
(Watch::WATCH_TIME_TO_MINI_DISPLAY(watch_time)), stringST) else
((Watch::ALARM_TIME_TO_MAIN_DISPLAY(alarm_time)),
(Watch::WATCH_TIME_TO_MINI_DISPLAY(watch_time)), stringAL)));
-- end of node Watch::DISPLAY
extern function Watch::SOMME(i1:int; i2:int; i3:int) returns (somme:int);
extern function Watch::COMPARE_WATCH_ALARM_TIME(
watch_time:_Watch::WATCH_TIME_TYPE;
alarm_time:_Watch::ALARM_TIME_TYPE)
node Watch::EDGE(b:bool) returns (edge:bool);
edge = (b -> (b and (not (pre b))));
-- end of node Watch::EDGE
extern function Watch::TOGGLE_24H_IN_ALARM_MODE(
time:_Watch::ALARM_TIME_TYPE)
newtime:_Watch::ALARM_TIME_TYPE);
extern function Watch::SET_ALARM_TIME(
time:_Watch::ALARM_TIME_TYPE;
position:_Watch::ALARM_TIME_POSITION)
new_time:_Watch::ALARM_TIME_TYPE);
extern function Watch::NEXT_ALARM_TIME_POSITION(
position:_Watch::ALARM_TIME_POSITION)
new_position:_Watch::ALARM_TIME_POSITION);
node Watch::ALARM(
toggle_24h:bool;
toggle_alarm:bool;
in_set:bool;
set:bool;
next_position:bool;
stop_beep:bool;
second:bool;
watch_time:_Watch::WATCH_TIME_TYPE)
time:_Watch::ALARM_TIME_TYPE;
enhance:_Watch::ALARM_TIME_POSITION;
position_set:_Watch::ALARM_TIME_POSITION;
start_beeping:bool;
time_out:bool;
count:int;
internal_status:int;
let
start_beeping = ((Watch::COMPARE_WATCH_ALARM_TIME(watch_time, time)) and
status);
status = (internal_status = 1);
internal_status = (0 -> ( if toggle_alarm then ( if ((pre internal_status)
= 0) then 1 else 0) else ( if ((Watch::EDGE((not in_set))) and ((pre
internal_status) = 0)) then 1 else (pre internal_status))));
count = (0 -> ( if start_beeping then ALARM_DURATION else ( if (((pre
count) <> 0) and second) then ((pre count) - 1) else (0 -> (pre count)))));
time_out = (false -> (((pre count) <> 0) and (count = 0)));
beep = ( if ((Watch::TWO_STATES(false, start_beeping, (stop_beep or
time_out))) and second) then 4 else 0);
time = (INITIAL_ALARM_TIME -> ( if toggle_24h then
(Watch::TOGGLE_24H_IN_ALARM_MODE((pre time))) else ( if set then
(Watch::SET_ALARM_TIME((pre time), position_set)) else (pre time))));
position_set = ( if (true -> (Watch::EDGE(in_set))) then
INITIAL_ALARM_POSITION else ( if next_position then
(Watch::NEXT_ALARM_TIME_POSITION((pre position_set))) else (pre
position_set)));
-- end of node Watch::ALARM
extern function Watch::LABELS(
mode_is_watch:bool;
mode_is_stopwatch:bool;
mode_is_alarm:bool;
mode_is_set_watch:bool;
mode_is_set_alarm:bool)
returns (
labels:_Watch::LABELS_TYPE);
extern function Watch::WATCH_TO_DISPLAY_POS(
wpos:_Watch::WATCH_TIME_POSITION)
dpos:_Watch::DISPLAY_POSITION);
extern function Watch::STATUS(
alarm_is_set:bool;
chime_is_set:bool;
stopwatch_running:bool;
stopwatch_lapping:bool)
returns (
status:_Watch::STATUS_TYPE);
extern function Watch::IS_O_CLOCK(
time:_Watch::WATCH_TIME_TYPE)
extern function Watch::INCREMENT_WATCH_TIME(
time:_Watch::WATCH_TIME_TYPE)
newtime:_Watch::WATCH_TIME_TYPE);
extern function Watch::TOGGLE_24H_IN_WATCH_MODE(
time:_Watch::WATCH_TIME_TYPE)
newtime:_Watch::WATCH_TIME_TYPE);
extern function Watch::CONFIRM_TIME(
time:_Watch::WATCH_TIME_TYPE)
new_time:_Watch::WATCH_TIME_TYPE);
extern function Watch::INCREMENT_WATCH_TIME_IN_SET_MODE(
time:_Watch::WATCH_TIME_TYPE;
position:_Watch::WATCH_TIME_POSITION)
new_time:_Watch::WATCH_TIME_TYPE);
extern function Watch::SET_WATCH_TIME(
time:_Watch::WATCH_TIME_TYPE;
position:_Watch::WATCH_TIME_POSITION)
new_time:_Watch::WATCH_TIME_TYPE);
extern function Watch::NEXT_WATCH_TIME_POSITION(
position:_Watch::WATCH_TIME_POSITION)
new_position:_Watch::WATCH_TIME_POSITION);
node Watch::WATCH(
second:bool;
toggle_24h:bool;
toggle_chime:bool;
in_set:bool;
next_position:bool;
set:bool)
returns (
time:_Watch::WATCH_TIME_TYPE;
enhance:_Watch::WATCH_TIME_POSITION;
chime_is_set:bool;
beep:int);
var
position_set:_Watch::WATCH_TIME_POSITION;
internal_chime_is_set = (0 -> ( if toggle_chime then ( if ((pre
internal_chime_is_set) = 0) then 1 else 0) else (pre
internal_chime_is_set)));
chime_is_set = (internal_chime_is_set = 1);
beep = ( if second then ( if ((Watch::IS_O_CLOCK(time)) and chime_is_set)
then 2 else 0) else 0);
time = (INITIAL_WATCH_TIME -> ( if (not in_set) then ( if second then
(Watch::INCREMENT_WATCH_TIME((pre time))) else ( if toggle_24h then
(Watch::TOGGLE_24H_IN_WATCH_MODE((pre time))) else ( if (Watch::EDGE((not
in_set))) then (Watch::CONFIRM_TIME((pre time))) else (pre time)))) else (
if second then (Watch::INCREMENT_WATCH_TIME_IN_SET_MODE((pre time),
position_set)) else ( if set then (Watch::SET_WATCH_TIME((pre time),
position_set)) else (pre time)))));
position_set = ( if (true -> (Watch::EDGE(in_set))) then
INITIAL_WATCH_POSITION else ( if next_position then
(Watch::NEXT_WATCH_TIME_POSITION((pre position_set))) else (pre
position_set)));
-- end of node Watch::WATCH
extern function Watch::IS_ZERO_MOD_10_MN(
time:_Watch::STOPWATCH_TIME_TYPE)
node Watch::STOPWATCH(
hs:bool;
start_stop:bool;
lap:bool)
returns (
time:_Watch::STOPWATCH_TIME_TYPE;
run_state:bool;
lap_state:bool;
beep:int);
var
reset:bool;
must_beep:bool;
internal_time:_Watch::STOPWATCH_TIME_TYPE;
reset = (false -> (lap and (pre ((not run_state) and (not lap_state)))));
run_state = (Watch::TWO_STATES(false, start_stop, start_stop));
lap_state = (Watch::TWO_STATES(false, (lap and run_state), lap));
time = (current (internal_time when lap_state));
internal_time = ( if (true -> reset) then INITIAL_STOPWATCH_TIME else ( if
(run_state and hs) then (Watch::INCREMENT_STOPWATCH_TIME((pre
internal_time))) else (pre internal_time)));
must_beep = ( if start_stop then true else ( if (hs and run_state) then
(Watch::IS_ZERO_MOD_10_MN(internal_time)) else false));
beep = ( if must_beep then 1 else 0);
-- end of node Watch::STOPWATCH
node Watch::BUTTONS(
UL:bool;
LL:bool;
UR:bool;
LR:bool)
returns (
mode_is_watch:bool;
mode_is_stopwatch:bool;
mode_is_alarm:bool;
mode_is_set_watch:bool;
mode_is_set_alarm:bool;
toggle_24h:bool;
toggle_chime:bool;
toggle_alarm:bool;
next_watch_time_position:bool;
next_alarm_position:bool;
set_watch:bool;
set_alarm:bool;
start_stop:bool;
lap:bool;
stop_alarm_beep:bool);
var
mode_is_standard_watch:bool;
mode_is_standard_alarm:bool;
let
mode_is_watch = (true -> ( if LL then ( if (pre mode_is_watch) then (pre
mode_is_set_watch) else ( if (pre mode_is_stopwatch) then false else (not
(pre mode_is_set_alarm)))) else (pre mode_is_watch)));
mode_is_stopwatch = (false -> ( if LL then ( if (pre mode_is_watch) then
(not (pre mode_is_set_watch)) else false) else (pre mode_is_stopwatch)));
mode_is_alarm = (false -> ( if LL then ( if (pre mode_is_watch) then false
else ( if (pre mode_is_stopwatch) then true else (pre mode_is_set_alarm)))
else (pre mode_is_alarm)));
mode_is_set_watch = ( if mode_is_watch then ( if UL then (false -> (not
(pre mode_is_set_watch))) else (false -> (pre mode_is_set_watch))) else
false);
mode_is_set_alarm = ( if mode_is_alarm then ( if UL then (not (pre
mode_is_set_alarm)) else (pre mode_is_set_alarm)) else false);
mode_is_standard_watch = (mode_is_watch and (not mode_is_set_watch));
mode_is_standard_alarm = (mode_is_alarm and (not mode_is_set_alarm));
toggle_24h = (LR and mode_is_standard_watch);
toggle_chime = (LR and mode_is_standard_alarm);
toggle_alarm = (UR and mode_is_standard_alarm);
next_watch_time_position = (LL and mode_is_set_watch);
next_alarm_position = (LL and mode_is_set_alarm);
set_watch = (LR and mode_is_set_watch);
set_alarm = (LR and mode_is_set_alarm);
start_stop = (LR and mode_is_stopwatch);
lap = (UR and mode_is_stopwatch);
stop_alarm_beep = UR;
tel
-- end of node Watch::BUTTONS
extern function Watch::TIME_SCALE(bidon:int) returns (scale:int);
node Watch::Watch(
UPLEFT:bool;
LOWLEFT:bool;
UPRIGHT:bool;
LOWRIGHT:bool;
time_unit:bool)
returns (
display:_Watch::DISPLAY_TYPE;
watch_time:_Watch::WATCH_TIME_TYPE;
watch_position_enhanced:_Watch::WATCH_TIME_POSITION;
alarm_time:_Watch::ALARM_TIME_TYPE;
alarm_position_enhanced:_Watch::ALARM_TIME_POSITION;
stopwatch_time:_Watch::STOPWATCH_TIME_TYPE;
position_enhanced:_Watch::DISPLAY_POSITION;
status:_Watch::STATUS_TYPE;
labels:_Watch::LABELS_TYPE;
alarm_is_set:bool;
mode_is_watch:bool;
mode_is_stopwatch:bool;
mode_is_alarm:bool;
stopwatch_running:bool;
stopwatch_lapping:bool;
chime_is_set:bool;
toggle_24h:bool;
toggle_chime:bool;
toggle_alarm:bool;
watch_next_position:bool;
alarm_next_position:bool;
set_watch:bool;
set_alarm:bool;
mode_is_set_watch:bool;
mode_is_set_alarm:bool;
start_stop:bool;
lap:bool;
stop_alarm_beep:bool;
second:bool;
alarm_beep:int;
chime_beep:int;
stopwatch_beep:int;
let
display = (Watch::DISPLAY(mode_is_watch, mode_is_stopwatch, mode_is_alarm,
watch_time, stopwatch_time, alarm_time, position_enhanced, status,
labels));
beep = (Watch::SOMME(alarm_beep, chime_beep, stopwatch_beep));
(alarm_time, alarm_is_set, alarm_position_enhanced, alarm_beep) =
(Watch::ALARM(toggle_24h, toggle_alarm, mode_is_set_alarm, set_alarm,
alarm_next_position, stop_alarm_beep, second, watch_time));
labels = (Watch::LABELS(mode_is_watch, mode_is_stopwatch, mode_is_alarm,
mode_is_set_watch, mode_is_set_alarm));
position_enhanced = ( if mode_is_set_watch then
(Watch::WATCH_TO_DISPLAY_POS(watch_position_enhanced)) else ( if
mode_is_set_alarm then
(Watch::ALARM_TO_DISPLAY_POS(alarm_position_enhanced)) else
NULL_POSITION));
status = (Watch::STATUS(alarm_is_set, chime_is_set, stopwatch_running,
stopwatch_lapping));
(watch_time, watch_position_enhanced, chime_is_set, chime_beep) =
(Watch::WATCH(second, toggle_24h, toggle_chime, mode_is_set_watch,
watch_next_position, set_watch));
(stopwatch_time, stopwatch_running, stopwatch_lapping, stopwatch_beep) =
(Watch::STOPWATCH(time_unit, start_stop, lap));
(mode_is_watch, mode_is_stopwatch, mode_is_alarm, mode_is_set_watch,
mode_is_set_alarm, toggle_24h, toggle_chime, toggle_alarm,
watch_next_position, alarm_next_position, set_watch, set_alarm, start_stop,
lap, stop_alarm_beep) = (Watch::BUTTONS(UPLEFT, LOWLEFT, UPRIGHT,
LOWRIGHT));
second = (time_unit and (current (Watch::DIVIDE(((Watch::TIME_SCALE(0))
when time_unit)))));
-- end of node Watch::Watch
node Watch::MORE_RECENT(evt:bool; delay:int) returns (more_recent:bool);
var
deadline:int;
let
(more_recent, deadline) = ( if evt then (true, 0) else ((false, delay) ->
( if evt then (true, 0) else ( if (pre more_recent) then ((deadline <
delay), ((pre deadline) + 1)) else (false, (pre deadline))))));
-- end of node Watch::MORE_RECENT
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/X.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/X.lus
node X::X(
c:bool;
n:int when c)
returns (
d:bool;
m:int when c;
p:int when d);
m = ((0 when c) -> ((pre m) + n));
d = (c and ((current m) <= 10));
p = ((0 when d) -> ((pre p) + (1 when d)));
-- end of node X::X
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/X1.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/X1.lus
node X1::X1(b:bool; n:int) returns (m:int);
m = (current (n when b));
-- end of node X1::X1
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/X2.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/X2.lus
node X2::X2(b:bool; n:int) returns (m:int);
m = (0 -> (current (n when b)));
-- end of node X2::X2
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/X3.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/X3.lus
node X3::X3(n:int; b:bool) returns (m:int);
c:bool when b;
p:int when b;
u:int when b;
q:int when c;
r:int when c;
c = (p >= (0 when b));
p = (n when b);
q = (p when c);
d = (q <= ((10 when b) when c));
r = (current (q when d));
u = (current r);
m = (current u);
-- end of node X3::X3
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/X6.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/X6.lus
node X6::X6(
n:int;
b:bool)
returns (
m:int;
c:bool when b;
p:int when b;
u:int when b;
q:int when c;
r:int when c);
c = (p >= (0 when b));
p = (n when b);
q = (p when c);
d = (q <= ((10 when b) when c));
r = (current (q when d));
u = (current r);
m = (current u);
-- end of node X6::X6
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/_N_uu.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/_N_uu.lus
node _N_uu::_N_uu(I_x:bool; I_y:bool; I_z:bool) returns (O_a:bool);
var
V_V135_A_forbiden:bool;
V_V111_X:bool;
V_V112_X:bool;
V_V136_B_forbiden:bool;
V_V118_X:bool;
V_V125_X:bool;
V_V119_X:bool;
V_V126_X:bool;
let
O_a = ((not (V_V111_X and V_V135_A_forbiden)) and (not (V_V125_X and
V_V112_X = (false -> (pre (I_y or V_V112_X)));
V_V111_X = ( if I_y then I_x else ( if V_V112_X then (I_x or (pre
V_V111_X)) else true));
V_V119_X = (false -> (pre (I_y or V_V119_X)));
V_V118_X = ( if I_y then I_x else ( if V_V119_X then (I_x and (pre
V_V118_X)) else true));
V_V126_X = (false -> (pre (V_V118_X or V_V126_X)));
V_V125_X = ( if V_V118_X then I_z else ( if V_V126_X then (I_z or (pre
V_V125_X)) else true));
V_V135_A_forbiden = (false -> ( if ((pre V_V111_X) and (not V_V111_X))
then true else ( if ((pre V_V125_X) and (not V_V125_X)) then false else
(pre V_V135_A_forbiden))));
V_V136_B_forbiden = (true -> ( if ((pre V_V125_X) and (not V_V125_X)) then
true else ( if ((pre V_V111_X) and (not V_V111_X)) then false else (pre
V_V136_B_forbiden))));
-- end of node _N_uu::_N_uu
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/activation_ec.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/activation_ec.lus
node activation_ec::activation_ec(evt:bool) returns (scie:int);
scie = (0 -> ( if evt then ( if V10_go_up then ((pre scie) + 1) else ((pre
scie) - 1)) else (pre scie)));
V10_go_up = (true -> ( if ((pre scie) >= 5) then false else ( if ((pre
scie) <= 0) then true else (pre V10_go_up))));
-- end of node activation_ec::activation_ec
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/after.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/after.lus
node after::after(x:bool) returns (after:bool);
after = (x or (false -> (pre after)));
-- end of node after::after
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/alarme.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/alarme.lus
const alarme::delai_reprise = 4;
const alarme::delai_vigilence = 3;
const alarme::delai_alarme = 6;
node alarme::edge(in:bool) returns (edge:bool);
edge = (false -> (in and (not (pre in))));
-- end of node alarme::edge
node alarme::bascule(
init:bool;
set:bool;
reset:bool)
returns (
etat:bool);
let
etat = (init -> ( if (set and (not (pre etat))) then true else ( if (reset
and (pre etat)) then false else (pre etat))));
-- end of node alarme::bascule
node alarme::decompte(
init:bool;
val_init:int;
decr:bool)
returns (
n:int);
let
n = (0 -> ( if init then val_init else ( if decr then ((pre n) - 1) else
(pre n))));
-- end of node alarme::decompte
node alarme::alarme(
MA:bool;
code:bool;
pb_hab:bool;
pb_tmp:bool)
returns (
alarme:bool;
en_marche:bool);
var
demande_entree:bool;
vigilence_partielle:bool;
reprise:bool;
tps_vigilence:int;
tps_reprise:int;
tps_alarme:int;
let
assert((#MA, code));
en_marche = (alarme::bascule(false, MA, (MA and (pre demande_entree))));
demande_entree = (alarme::bascule(false, code, ((pre tps_vigilence) =
0)));
vigilence_partielle = (alarme::bascule(false, ((alarme::edge(en_marche))
or (alarme::edge(demande_entree))), ((pre tps_vigilence) = 0)));
tps_vigilence = (alarme::decompte(((alarme::edge(en_marche)) or
(alarme::edge(demande_entree))), delai_vigilence, (en_marche and ((pre
tps_vigilence) > 0))));
tps_alarme = (alarme::decompte((alarme::edge(alarme)), delai_alarme, ((pre
alarme) and ((pre tps_alarme) > 0))));
reprise = (alarme::bascule(false, ((pre alarme) and ((pre tps_alarme) =
0)), ((pre tps_reprise) = 0)));
tps_reprise = (alarme::decompte((alarme::edge(reprise)), delai_reprise,
((pre reprise) and (pre (tps_reprise > 0)))));
alarme = (false -> ( if ((en_marche and (not reprise)) and (pb_hab or
(pb_tmp and (not vigilence_partielle)))) then true else ( if ((pre alarme)
and (((pre tps_alarme) = 0) or (alarme::edge((not en_marche))))) then false
else (pre alarme))));
-- end of node alarme::alarme
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/arbitre.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/arbitre.lus
node arbitre::my_switch(
set:bool;
reset:bool;
initial:bool)
returns (
level:bool);
let
level = (initial -> ( if (set and (not (pre level))) then true else ( if
(reset and (pre level)) then false else (pre level))));
-- end of node arbitre::my_switch
extern node arbitre::xedge(x:bool) returns (y:bool);
node arbitre::process(
request:bool;
token:bool)
returns (
grant:bool;
new_token:bool);
let
grant = (arbitre::my_switch((token and request), (not request), (token and
request)));
new_token = (false -> (((pre token) and (not request)) or
(arbitre::xedge((not grant)))));
-- end of node arbitre::process
node arbitre::mutex(
req0:bool;
req1:bool;
req2:bool;
req3:bool)
returns (
grant0:bool;
grant1:bool;
grant2:bool;
grant3:bool);
var
token0:bool;
token1:bool;
token2:bool;
token3:bool;
new_token0:bool;
new_token1:bool;
new_token2:bool;
new_token3:bool;
let
(grant0, new_token0) = (arbitre::process(req0, token0));
(grant1, new_token1) = (arbitre::process(req1, token1));
(grant2, new_token2) = (arbitre::process(req2, token2));
(grant3, new_token3) = (arbitre::process(req3, token3));
token0 = (true -> (pre new_token3));
token1 = (false -> (pre new_token0));
token2 = (false -> (pre new_token1));
token3 = (false -> (pre new_token2));
-- end of node arbitre::mutex
node arbitre::arbitre(
req0:bool;
req1:bool;
req2:bool;
req3:bool)
returns (
ok:bool);
var
gr0:bool;
gr1:bool;
gr2:bool;
gr3:bool;
let
(gr0, gr1, gr2, gr3) = (arbitre::mutex(req0, req1, req2, req3));
ok = (#gr0, gr1, gr2, gr3);
-- end of node arbitre::arbitre
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/argos.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/argos.lus
node argos::argos(a:bool; b:bool) returns (s0:bool; s1:bool; s2:bool);
var
t0:bool;
t1:bool;
x:bool;
y:bool;
let
s0 = (true -> (pre (s0 and (not a))));
s1 = (false -> (pre (s1 or ((s0 and a) and x))));
s2 = (false -> (pre (s2 or ((s0 and a) and (not x)))));
t0 = (true -> (pre ((t0 and (not b)) or (t1 and b))));
t1 = (false -> (pre ((t1 and (not b)) or (t0 and b))));
-- end of node argos::argos
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/assertion.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/assertion.lus
node assertion::assertion(
a:bool;
b:bool;
c:bool;
d:bool)
returns (
ok:bool);
let
assert((#a));
assert((#a, b));
assert((#a, b, c));
assert((#a, b, c, d));
-- end of node assertion::assertion
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/aux.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/aux.lus
node aux::aux(ck:bool) returns (x:int);
x = ((pre x) + 1);
-- end of node aux::aux
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/aux1.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/aux1.lus
node aux1::aux1(a:int; b:int) returns (c:int; d:int);
(c, d) = ( if (a > 0) then (pre (a, b)) else (((pre a) + 1), ((pre b) +
-- end of node aux1::aux1
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/bascule.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/bascule.lus
node bascule::bascule(r:bool; s:bool) returns (q:bool; n:bool);
q = (true -> ((not (pre r)) and (not (pre n))));
n = (false -> ((not (pre s)) and (not (pre q))));
-- end of node bascule::bascule
----------------------------------------------------------------------
====> ../lus2lic -vl 2 --compile-all-items should_work/NONREG/call.lus
Opening file /home/jahier/lus2lic/src/test/should_work/NONREG/call.lus
extern function call::f(a:int) returns (b:int);