Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
verimag
synchrone
lutin
Commits
72e31b8a
Commit
72e31b8a
authored
Apr 27, 2020
by
erwan
Browse files
Chore: untrack very old stuff
parent
8671d38c
Changes
268
Expand all
Hide whitespace changes
Inline
Side-by-side
archive/examples/lucky/C/Makefile
deleted
100644 → 0
View file @
8671d38c
CC
=
gcc
-g
LINKER
=
gcc
-g
EXE
=
CFLAGS
=
\
-L
../../../lib
\
-I
../../../include
LIBS
=
-lluc4c_nc
-llucky_nc
-lgmp
-lm
-ldl
-lstdc
++
LUC2C
=
../../../bin/luc2c
ifeq
($(HOSTTYPE),mac)
LINKER
=
g++
-g
LIBS
=
-lluc4c_nc
-llucky_nc
-lgmp
-lm
-ldl
endif
ifeq
($(HOSTTYPE),cross-win32)
EXE
=
CFLAGS
=
\
-L
../../../lib
\
-I
../../../include
\
-Winline
-Wimplicit-function-declaration
LIBS
=
-lluc4c_nc
-llucky_nc
-lgmp
-lws2_32
-lm
-lstdc
++
-lole32
LUC2C
=
../../../bin/luc2c
$(EXE)
LINKER
=
i586-mingw32msvc-gcc
CC
=
i586-mingw32msvc-cc
endif
ifeq
($(HOSTTYPE),cross-win32)
EXE
=
CFLAGS
=
\
-L
../../../lib
\
-I
../../../include
\
-Winline
-Wimplicit-function-declaration
LIBS
=
-lluc4c_nc
-llucky_nc
-lgmp
-lws2_32
-lm
-lstdc
++
-mno-cygwin
-lole32
LUC2C
=
../../../bin/luc2c
$(EXE)
endif
ifeq
($(HOSTTYPE),cygwin)
EXE
=
.exe
CFLAGS
=
\
-L
../../../lib
\
-I
../../../include
\
-Winline
-Wimplicit-function-declaration
LIBS
=
-lluc4c_nc
-llucky_nc
-lgmp
-lws2_32
-lm
-lstdc
++
LUC2C
=
../../../bin/luc2c
$(EXE)
endif
################################################################
# Calling lucky from C
foo.c
:
foo.luc
$(LUC2C)
foo.luc
foo.o
:
foo.c
$(CC)
-c
$(CFLAGS)
foo.c
call_foo.o
:
call_foo.c
$(CC)
-c
$(CFLAGS)
call_foo.c
foo$(EXE)
:
foo.o call_foo.o
$(LINKER)
$(CFLAGS)
-o
$@
$^
$(LIBS)
################################################################
clean
:
rm
-f
run
*
.o
*
~ foo foo.h foo.c
*
.gp
*
.plot
*
.rif
test
:
clean foo$(EXE)
ifeq
($(HOSTTYPE),win32)
foo
$(EXE)
else
./foo
>
test.rif
rm
-f
test.res
&&
diff
-u
-i
test.rif.exp test.rif
>
test.res
[
!
-s
test.res
]
&&
make clean
endif
utest
:
cp
test.rif test.rif.exp
archive/examples/lucky/C/call_foo.c
deleted
100644 → 0
View file @
8671d38c
#include <stdlib.h>
#include <stdio.h>
#include "foo.h"
// Output procedures
void
foo_O_x
(
foo_ctx
*
ctx
,
int
v
)
{
ctx
->
_x
=
v
;
};
void
foo_O_y
(
foo_ctx
*
ctx
,
int
v
)
{
ctx
->
_y
=
v
;
};
void
foo_O_z
(
foo_ctx
*
ctx
,
double
v
)
{
ctx
->
_z
=
v
;
};
// a little main that calls the foo.luc program
int
main
(){
int
i
=
0
;
foo_ctx
*
ctx
;
ctx
=
foo_new_ctx
(
NULL
);
lucky_set_seed
(
1
);
// setting inputs
foo_I_a
(
ctx
,
10
);
foo_I_b
(
ctx
,
0
);
foo_I_c
(
ctx
,
20
.
0
);
printf
(
"#inputs
\"
a
\"
:int
\"
b
\"
:bool
\"
c
\"
:real
\n
"
);
printf
(
"#outputs
\"
x
\"
:int
\"
y
\"
:bool
\"
z
\"
:real
\n
"
);
for
(
i
=
0
;
i
<
10
;
i
++
){
foo_step
(
ctx
,
step_inside
);
printf
(
"# step %d
\n
%d %d %f
\n
#outs %d %d %f
\n
"
,
i
,
ctx
->
_a
,
ctx
->
_b
,
ctx
->
_c
,
ctx
->
_x
,
ctx
->
_y
,
ctx
->
_z
);
}
return
0
;
}
archive/examples/lucky/C/foo.luc
deleted
100644 → 0
View file @
8671d38c
--
inputs { a:int; b:bool; c:float }
outputs { x:int; y:bool; z:float }
states { 0:stable }
start_state { 0 }
transitions { 0 -> 0 ~cond
b=>y and abs(x - a) < 5 and abs(z - c) < 5.0 }
archive/examples/lucky/C/test.res
deleted
100644 → 0
View file @
8671d38c
archive/examples/lucky/external_code/Makefile
deleted
100644 → 0
View file @
8671d38c
#-----------------------------------------------------
# Dynamic linking of C code with Lucky
#
#-----------------------------------------------------
# Directories
SRCDIR
=
.
OBJDIR
=
./obj
MAIN
=
foo
#settings for Linux (and other posix systems ?)
DLEXT
=
so
EXE
=
CC
=
gcc
MKDLLFLAGS
=
LFLAGS
=
SOFLAGS
=
-shared
#settings for WIN32
ifeq
($(HOSTTYPE),win32)
DLEXT
=
dll
EXE
=
.exe
CC
=
$(GCC)
MKDLLFLAGS
=
-Wl
,--out-implib,
$(OBJDIR)
/
$(MAIN)
.a
LFLAGS
=
-lm
LD_ARCH
=
-DWIN32
endif
ifeq
($(HOSTTYPE),cygwin)
DLEXT
=
dll
EXE
=
.exe
LD
=
gcc
-DWIN32
CC
=
gcc
-DWIN32
MKDLLFLAGS
=
-Wl
,--out-implib,
$(OBJDIR)
/
$(MAIN)
.a
LFLAGS
=
-lm
LD_ARCH
=
-DWIN32
endif
ifeq
($(HOSTTYPE),mac)
LD
=
g++
CC
=
gcc
SOFLAGS
=
-dynamiclib
LD_ARCH
=
-DMAC
endif
all
:
$(OBJDIR)/$(MAIN).$(DLEXT)
$(OBJDIR)
:
mkdir
$(OBJDIR)
$(OBJDIR)/$(MAIN).$(DLEXT)
:
$(OBJDIR)/$(MAIN).o
$(LD)
$(LFLAGS)
$(SOFLAGS)
-o
$(OBJDIR)
/
$(MAIN)
.
$(DLEXT)
\
$(OBJDIR)
/
$(MAIN)
.o
\
$(MKDLLFLAGS)
$(OBJDIR)/%.o
:
$(OBJDIR) $(SRCDIR)/%.c
$(CC)
-c
$(CFLAGS)
$(SRCDIR)
/
$*
.c
-o
$(OBJDIR)
/
$*
.o
call_external_c_code.luc_pp
:
call_external_c_code.luc
../../../bin/lucky_cpp call_external_c_code.luc call_external_c_code.luc_pp
$(LD_ARCH)
EXPDIR
=
`
../../../bin/lutin
$(EXE)
--ocaml-version
`
$(EXPDIR)
:
[
-d
$(EXPDIR)
]
||
mkdir
-p
$(EXPDIR)
;
make utest
test
:
clean $(OBJDIR)/$(MAIN).$(DLEXT) call_external_c_code.luc_pp $(EXPDIR)
rm
-f
test.rif0
&&
\
../../../bin/lucky
$(EXE)
-l
10
$(OPT)
-seed
834966010
\
call_external_c_code.luc_pp |
sed
-e
"s/^M//"
|
grep
-v
" Lucky Version"
>
test.rif
rm
-f
test.res
&&
diff
-u
-i
$(EXPDIR)
/test.rif.exp test.rif
>
test.res
[
!
-s
test.res
]
&&
make clean
utest
:
cp
test.rif
$(EXPDIR)
/test.rif.exp
clean
:
rm
-rf
$(OBJDIR)
*
.rif
*
.rif0 call_external_c_code.luc_pp
archive/examples/lucky/external_code/call_external_c_code.luc
deleted
100644 → 0
View file @
8671d38c
--
-- A simple Lucky program calling a function "bar" defined in "foo.so"
--
libraries {
#ifdef MAC
foo_lib = "./obj/foo.so";
math_lib = "libm.dylib" -- the standard C math lib (which path ougth to be in LD_LIBRARY_PATH)
#else
#ifdef WIN32
foo_lib = "./obj/foo.dll";
math_lib = "libm.dll"
#else
foo_lib = "./obj/foo.so";
math_lib = "libm.so"
#endif
#endif
}
functions {
sqrt : float -> float : math_lib;
sin : float -> float : math_lib;
rand_up_to : int * int -> int : foo_lib;
}
outputs {
f1 : float ~init 1.0;
f2 : float;
i : int;
}
nodes {0: stable }
start_node { 0 }
transitions {
0 -> 0 ~cond
0.0 < f1 and f1 < 100.0
and f2 = sin(sqrt(pre f1))
and i = rand_up_to(0,10)
}
-- "lucky -l 10 call_external_c_code.luc" generates outputs such as:
--
-- #The random engine was initialized with the seed 3064352
-- #inputs
-- #outputs "f1":real "f2":real "i":int
-- #step 1
--
-- #outs 51.62 0.84 9
-- #step 2
--
-- #outs 64.93 0.78 4
-- #step 3
--
-- #outs 27.27 0.98 8
-- #step 4
--
-- #outs 22.90 -0.87 8
-- #step 5
--
-- #outs 82.37 -1.00 10
-- #step 6
--
-- #outs 51.41 0.34 2
-- #step 7
--
-- #outs 61.45 0.78 3
-- #step 8
--
-- #outs 18.72 1.00 8
-- #step 9
--
-- #outs 93.14 -0.93 3
-- #step 10
--
-- #outs 31.45 -0.22 6
archive/examples/lucky/external_code/foo.c
deleted
100644 → 0
View file @
8671d38c
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#define EXPORT __declspec(dllexport)
#else
#define EXPORT
#endif
EXPORT
int
rand_up_to
(
int
min
,
int
max
){
// uniformly draws an integer between O and max.
// Not the most useful function for Lucky...
double
r
=
((
double
)
random
());
int
res
=
min
+
((
int
)
((
r
*
(((
double
)
(
max
-
min
+
1
))
/
((
double
)
RAND_MAX
)))));
return
res
;
}
EXPORT
double
msin
(
double
x
){
double
res
=
sin
(
x
);
return
res
;
};
EXPORT
double
msqrt
(
double
x
)
{
double
res
=
sqrt
(
x
);
return
res
;
};
archive/examples/lucky/external_code/test.res
deleted
100644 → 0
View file @
8671d38c
archive/examples/lucky/luciole/Makefile
deleted
100644 → 0
View file @
8671d38c
-include
Makefile.foo
export
LURETTE_PATH
=
../../..
go
:
../../../bin/luc2c
--luciole
foo.luc
test
:
go
make
-f
Makefile.foo
&&
make clean
archive/examples/lucky/luciole/foo.luc
deleted
100644 → 0
View file @
8671d38c
--
inputs {
a:int;
b:bool;
c:float
}
outputs {
x:int;
y:bool;
z:float
}
states { 0:stable }
start_state { 0 }
transitions { 0 -> 0
~cond
b=>y and abs(x - a) < 5
and abs(z - c) < 5.0
}
archive/examples/lucky/lustre/Makefile
deleted
100644 → 0
View file @
8671d38c
CC
=
gcc
-g
LD
=
gcc
-g
EXE
=
CFLAGS
=
\
-L
../../../lib
\
-I
../../../include
LIBS
=
-lluc4c_nc
-llucky_nc
-lgmp
-lm
-ldl
-lstdc
++
LUC2C
=
../../../bin/luc2c
ifeq
($(HOSTTYPE),win32)
EXE
=
.exe
CFLAGS
=
\
-L
../../../lib
-L
/cygdrive/c/TEMP/MinGW/lib
\
-I
../../../include
\
-Winline
-Wimplicit-function-declaration
LIBS
=
-lluc4c_nc
-llucky_nc
-lgmp
-lws2_32
-lm
-lstdc
++
LUC2C
=
../../../bin/luc2c
$(EXE)
endif
ifeq
($(HOSTTYPE),mac)
LD
=
g++
-g
LIBS
=
-lluc4c_nc
-llucky_nc
-lgmp
-lm
-ldl
endif
################################################################
# Calling lucky from Lustre
# SOURCE_FILES = call_foo.lus foo.luc
foo.c
:
foo.luc
$(LUC2C)
--lustre
"call_foo"
--seed
42 foo.luc
foo.o
:
foo.c
$(CC)
-c
$(CFLAGS)
foo.c
call_foo.ec
:
lus2ec call_foo.lus call_foo
call_foo.c
:
call_foo.ec
ec2c
-loop
call_foo.ec
call_foo.o
:
call_foo.c
$(CC)
-c
$(CFLAGS)
call_foo.c
call_foo_loop.o
:
call_foo_loop.c
$(CC)
-c
$(CFLAGS)
call_foo_loop.c
call_foo_ext_func.o
:
call_foo_ext_func.c
$(CC)
-c
$(CFLAGS)
call_foo_ext_func.c
foo
:
foo.o call_foo.o call_foo_ext_func.o call_foo_loop.o
$(LD)
$(CFLAGS)
-o
$@
$^
$(LIBS)
################################################################
clean
:
rm
-f
run
*
.o
*
~ call_foo_ext
*
call_foo.c call_foo.h call_foo_loop.c call_foo_loop.h foo.h foo.c
*
.gp
*
.plot
*
.rif
*
.ec foo
$(EXE)
#*
test
:
clean foo
ifeq
($(HOSTTYPE),win32)
foo
$(EXE)
else
touch
test.rif
;
rm
test.rif
echo
"1 1 1 1 1 1 1 1 1 1 1"
| ./foo
>
test.rif
rm
-f
test.res
&&
diff
-u
-i
test.rif.exp test.rif
>
test.res
[
!
-s
test.res
]
&&
make clean
endif
utest
:
cp
test.rif test.rif.exp
archive/examples/lucky/lustre/call_foo.lus
deleted
100644 → 0
View file @
8671d38c
-- Time-stamp: <modified the 07/12/2006 (at 16:06) by Erwan Jahier>
function
foo
(
x
:
int
;
y
:
bool
;
z
:
real
)
returns
(
a
:
int
;
b
:
bool
;
c
:
real
);
node
call_foo
(
dummy
:
int
)
returns
(
a
:
int
;
b
:
bool
;
c
:
real
);
let
a
,
b
,
c
=
foo
(
1
->
pre
a
,
true
->
pre
b
,
10
.
0
->
pre
c
);
tel
;
archive/examples/lucky/lustre/foo.luc
deleted
100644 → 0
View file @
8671d38c
--
inputs { a:int; b:bool; c:float }
outputs { x:int; y:bool; z:float }
states { 0:stable }
start_state { 0 }
transitions { 0 -> 0
~cond b=>y and abs(x - a) < 5 and abs(z - c) < 5.0 }
archive/examples/lucky/lustre/test.res
deleted
100644 → 0
View file @
8671d38c
archive/examples/lucky/other/Makefile
deleted
100644 → 0
View file @
8671d38c
EXE
=
ifeq
($(HOSTTYPE),win32)
EXE
=
.exe
endif
LUCKY
=
../../../bin/lucky
$(EXE)
-seed
1
test1
:
$(LUCKY)
-l
1000
\
losange-3d2.luc |
sed
-e
"s/^M//"
|
grep
-v
" Lucky Version"
>
test1.rif
rm
-f
test1.res
&&
diff
-u
-i
test1.rif.exp test1.rif
>
test1.res
[
!
-s
test1.res
]
&&
make clean
test2
:
rm
-f
test2.rif0
&&
\
$(LUCKY)
\
infinite_weight.luc |
sed
-e
"s/^M//"
|
grep
-v
" Lucky Version"
>
test2.rif
rm
-f
test2.res
&&
diff
-u
-i
test2.rif.exp test2.rif
>
test2.res
[
!
-s
test2.res
]
&&
make clean
test3
:
rm
-f
test3.rif0
&&
\
$(LUCKY)
-l
20
\
dynamic_weight.luc |
sed
-e
"s/^M//"
|
grep
-v
" Lucky Version"
>
test3.rif
rm
-f
test3.res
&&
diff
-u
-i
test3.rif.exp test3.rif
>
test3.res
[
!
-s
test3.res
]
&&
make clean
test4
:
rm
-f
test4.rif0
&&
\
$(LUCKY)
-l
10
\
structured_type.luc |
sed
-e
"s/^M//"
|
grep
-v
" Lucky Version"
>
test4.rif
rm
-f
test4.res
&&
diff
-u
-i
test4.rif.exp test4.rif
>
test4.res
[
!
-s
test4.res
]
&&
make clean
test5
:
rm
-f
test5.rif0
&&
\
$(LUCKY)
-l
10
\
bj.luc |
sed
-e
"s/^M//"
|
grep
-v
" Lucky Version"
>
test5.rif
rm
-f
test5.res
&&
diff
-u
-i
test5.rif
$(EXP)
test5.rif
>
test5.res
[
!
-s
test5.res
]
&&
make clean
test
:
test1 test2 test3 test4 test5
utest1
:
cp
test1.rif test1.rif.exp
utest2
:
cp
test2.rif test2.rif.exp
utest3
:
cp
test3.rif test3.rif.exp
utest4
:
cp
test4.rif test4.rif.exp
utest
:
utest1 utest2 utest3 utest4
clean
:
rm
-rf
$(OBJDIR)
rm
-rf
*
.log
*
~
*
.rif0
*
.rif
*
.gp
*
.plot
archive/examples/lucky/other/bj.luc
deleted
100644 → 0
View file @
8671d38c
This diff is collapsed.
Click to expand it.
archive/examples/lucky/other/dynamic_weight.luc
deleted
100644 → 0
View file @
8671d38c
-- A lucky example illustrating the use of dynamic weigths
inputs { }
outputs {
x : float
}
locals {
cpt : int ~init 0
}
nodes {
In_use : stable ;
Breakdown : stable }
start_node { In_use }
transitions {
In_use -> In_use
~weight 100
~cond
cpt = pre cpt + 1
and 5.0 < x and x < 10.0;
In_use -> Breakdown
~weight pre cpt
-- Breaking down becomes more and more likely to happen
~cond x = 0.0;
Breakdown -> Breakdown
~cond x = -1.0
}
-- Generates sequences such as:
-- 5.33 5.46 7.92 8.91 9.45 7.58 8.63 5.13 9.51 5.26 8.13 8.74 7.67 9.04 7.46 5.64 0.00 -1.00 -1.00 -1.00 ...
archive/examples/lucky/other/infinite_weight.luc
deleted
100644 → 0
View file @
8671d38c
-- A lucky example illustrating the use of infinite weigths
-- as well as the ~default option
inputs { }
outputs {
cpt : int
~init 0
-- initial value of pre cpt is 0
~default (pre cpt + 1)
-- if cpt does not appear in a transition,
-- cpt is incremented at each step
}
locals {
}
states {
0 : stable ; 1 : stable ; 2 : stable ; 3 : final
}
start_state { 0 }
transitions {
0 -> 0 ;
0 -> 1 ~weight infinity ~cond pre cpt = 3 and cpt = pre cpt;
-- -- This infinitely weighted transition will always be taken
-- -- as soon as it is possible (ie, when pre cpt = 3)
1 -> 1 ;
1 -> 2 ~weight infinity ~cond cpt = 6 and cpt = pre cpt;
2 -> 2;
2 -> 3 ~weight infinity ~cond cpt = 10 and cpt = pre cpt
}
-- generates the sequence of integers:
-- 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 10, 10
-- The integer 3 is generated twice
-- * once at step 3 when cpt is bound to 3
-- * once at step 4 because the transition "0 -> 1" is satisfiable
-- iff the previous value of cpt is 3.
-- Ditto for 6 and 10
archive/examples/lucky/other/losange-3d.luc
deleted