Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
verimag
synchrone
lutin
Commits
dbb5c443
Commit
dbb5c443
authored
Aug 28, 2017
by
erwan
Browse files
Fix some examples as the priority was not the one I have expected
I migth change the operator priority later on.
parent
25eb7e2b
Changes
9
Hide whitespace changes
Inline
Side-by-side
_oasis
View file @
dbb5c443
OASISFormat: 0.4
Name: Lutin
Version: 2.2
6
Version: 2.2
7
Authors: Erwan Jahier
Maintainers: erwan.jahier@imag.fr
License: PROP
...
...
examples/lutin/bug/Pannes.lut
View file @
dbb5c443
...
...
@@ -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
...
...
examples/lutin/crazy-rabbit/rabbit.lut
View file @
dbb5c443
...
...
@@ -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
...
...
examples/lutin/external_code/call_external_c_code.lut
View file @
dbb5c443
...
...
@@ -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
examples/lutin/external_code/polar.lut
View file @
dbb5c443
...
...
@@ -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
examples/lutin/misc/bug01.lut
View file @
dbb5c443
node
m1
()
returns
(
cpt
:
int
)
=
extern
sqrt
(
x
:
real
)
:
real
node
m1
()
returns
(
cpt
:
real
)
=
loop
{
cpt
=
1
|>
cpt
=
2
cpt
=
1
0
.
fby
cpt
=
sqrt
(
-
4
.
0
)
|>
cpt
=
2
0
.
}
...
...
lutin/src/lexeme.ml
View file @
dbb5c443
...
...
@@ -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
...
...
lutin/src/mainArg.ml
View file @
dbb5c443
...
...
@@ -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: u
n
e luciole-rif instead.
Call Luciole the provide inputs
"
];
[
"not working anymore: u
s
e luciole-rif instead."
];
mkopt
opt
~
hide
:
true
[
"--2c-4alice"
]
...
...
lutin/src/version.ml
View file @
dbb5c443
let
str
=
"2.2
6
"
let
sha
=
"
1af0fb6
"
let
str
=
"2.2
7
"
let
sha
=
"
25eb7e2
"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment