Commit dbb5c443 authored by erwan's avatar erwan

Fix some examples as the priority was not the one I have expected

I migth change the operator priority later on.
parent 25eb7e2b
OASISFormat: 0.4
Name: Lutin
Version: 2.26
Version: 2.27
Authors: Erwan Jahier
Maintainers: erwan.jahier@imag.fr
License: PROP
......
......@@ -108,7 +108,7 @@ node pannes_interactif(n:int; reset: bool) returns (
(EXE701PO_Panne1_OnOff = pre EXE701PO_Panne1_OnOff) and
(EXE702PO_Panne1_OnOff = pre EXE702PO_Panne1_OnOff)
in
let urgence = deux_vrai(EXE701PO_Panne1_OnOff, EXE702PO_Panne1_OnOff)
let urgence = deux_vrai(EXE701PO_Panne1_OnOff, EXE702PO_Panne1_OnOff)
or
trois_vrai(
EXE101MN_Panne2_OnOff,
......@@ -126,8 +126,27 @@ node pannes_interactif(n:int; reset: bool) returns (
assert EXE102MN_Panne2_Valeur = 0.0 or EXE102MN_Panne2_Valeur > 0.0 in
assert EXE103MN_Panne2_Valeur = 0.0 or EXE103MN_Panne2_Valeur > 0.0 in
assert EXE104MN_Panne2_Valeur = 0.0 or EXE104MN_Panne2_Valeur > 0.0 in
assert Urgence = urgence in
-- XXX si je déplie la def de urgence ici, ca na se comporte pas pareil !!!
-- Plus précisément, Urgence ne passe jamais a faux
-- c'est un pb de parenthesage ! la priorité du = est contre-intuitive... la changer ?
assert
Urgence = (
deux_vrai(EXE701PO_Panne1_OnOff, EXE702PO_Panne1_OnOff)
or
trois_vrai(
EXE101MN_Panne2_OnOff,
EXE102MN_Panne2_OnOff,
EXE103MN_Panne2_OnOff,
EXE104MN_Panne2_OnOff)
or
trois_vrai(
EXE101MN_Panne2_Valeur > 0.0,
EXE102MN_Panne2_Valeur > 0.0,
EXE103MN_Panne2_Valeur > 0.0,
EXE104MN_Panne2_Valeur > 0.0)
)
in
-- assert Urgence = urgence in
loop {
loop {
(not Urgence and (nb_pannes = n)) fby
......
......@@ -8,8 +8,8 @@ node rabbit_speed (low, high:real) returns (Speed: real) =
between(SpeedLow, 0.0, low) and between(SpeedHigh, 1.0, high)
in
let keep_params() =
Delta = pre Delta and SpeedLow = pre SpeedLow and
SpeedHigh = pre SpeedHigh
(Delta = pre Delta) and (SpeedLow = pre SpeedLow) and
(SpeedHigh = pre SpeedHigh)
in
{
&> loop { draw_params() fby loop ~100: 10 { keep_params() } }
......@@ -26,16 +26,16 @@ exception Pb
node rabbit (x_min, x_max, y_min, y_max : real)
returns(x, y, p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y: real ; freeze:bool) =
exist Speed, Alpha, Beta : real in
let keep_position() = (x = pre x and y = pre y) in
let keep_position() = ((x = pre x) and (y = pre y)) in
let draw_params() = between(Alpha, -3.14, 3.14) and between(Beta, -0.3, 0.3)
in
-- The beginning
run Speed := rabbit_speed(5.0, 50.0) in
run p1x,p1y, p2x,p2y, p3x,p3y, p4x,p4y := obstacle(x_min, x_max, y_min, y_max) in
let line() =
x = (pre x + Speed * cos(pre Alpha)) and
y = (pre y + Speed * sin(pre Alpha)) and
Alpha = pre Alpha and
(x = (pre x + Speed * cos(pre Alpha))) and
(y = (pre y + Speed * sin(pre Alpha))) and
(Alpha = pre Alpha) and
-- And he always avoids the obstacle
not is_inside(x,y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y)
in
......@@ -47,15 +47,15 @@ returns(x, y, p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y: real ; freeze:bool) =
do raise Pb
in
let curve() =
x = (pre x + Speed * cos(pre Alpha)) and
y = (pre y + Speed * sin(pre Alpha)) and
Alpha = pre Alpha - Beta and Beta = pre Beta and
(x = (pre x + Speed * cos(pre Alpha))) and
(y = (pre y + Speed * sin(pre Alpha))) and
(Alpha = pre Alpha - Beta) and (Beta = pre Beta) and
not is_inside(x,y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y)
in
let spiral() =
x = (pre x + Speed * cos(pre Alpha)) and
y = (pre y + Speed * sin(pre Alpha)) and
Alpha = pre Alpha - Beta and Beta = pre Beta- 0.02 and
(x = (pre x + Speed * cos(pre Alpha))) and
(y = (pre y + Speed * sin(pre Alpha))) and
(Alpha = pre Alpha - Beta) and (Beta = pre Beta- 0.02) and
not is_inside(x,y,p1x,p1y,p2x,p2y,p3x,p3y,p4x,p4y)
in
assert
......
......@@ -5,6 +5,6 @@ extern rand_up_to(min, max: int): int
node Fun_Call() returns (f1: real = 1.0; f2: real; i: int) =
loop {
0.0 < f1 and f1 < 100.0
and f2 = sin(sqrt(pre f1))
and i = rand_up_to(0, 10)
and (f2 = sin(sqrt(pre f1)))
and (i = rand_up_to(0, 10))
}
\ No newline at end of file
......@@ -3,6 +3,6 @@ extern cos(x: real) : real
node cartesian(r, alpha: real) returns (x, y: real) =
loop {
x = r * cos (alpha) and
y = r * sin (alpha)
(x = r * cos (alpha)) and
(y = r * sin (alpha))
}
\ No newline at end of file
node m1() returns (cpt: int ) =
extern sqrt(x: real) : real
node m1() returns (cpt: real ) =
loop {
cpt = 1
|> cpt = 2
cpt = 10. fby cpt = sqrt(-4.0)
|> cpt = 20.
}
......
......@@ -65,7 +65,7 @@ let make lexbuf =
let l = !line_num in
let ch1 = (Lexing.lexeme_start lexbuf)
and ch2 = (Lexing.lexeme_end lexbuf)
and c1 = (Lexing.lexeme_start lexbuf - !line_start_pos + 1)
and c1 = (Lexing.lexeme_start lexbuf - !line_start_pos)
and c2 = (Lexing.lexeme_end lexbuf - !line_start_pos)
in
......
......@@ -464,12 +464,12 @@ let (mkoptab : t -> unit) =
Luc2c.option.Luc2c.calling_module_name <- str))
["Generate C code to be called from Scade "];
mkopt opt
mkopt opt ~hide:true
["-luciole"; "--2c-4luciole"]
(Arg.Unit(fun _ ->
opt._gen_mode <- Cstubs;
Luc2c.option.Luc2c.gen_mode <- Luc2c.Luciole))
["not working anymore: une luciole-rif instead.Call Luciole the provide inputs"];
["not working anymore: use luciole-rif instead."];
mkopt opt ~hide:true
["--2c-4alice"]
......
let str="2.26"
let sha="1af0fb6"
let str="2.27"
let sha="25eb7e2"
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