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
lustre-v6
Commits
4e5bcd7a
Commit
4e5bcd7a
authored
Aug 29, 2019
by
erwan
Browse files
Update: use dune instead of oasis
Remove a lot of warnings (considered as errors by dune).
parent
4ce7c4ac
Pipeline
#28371
failed with stages
in 2 minutes and 44 seconds
Changes
163
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
4e5bcd7a
image
:
ocaml/opam:ubuntu
image
:
ocaml/opam
2
:ubuntu
variables
:
GIT_STRATEGY
:
clone
...
...
@@ -11,9 +11,10 @@ stages:
build
:
stage
:
build
script
:
-
sudo apt-get install -y m4
-
opam repo add verimag-sync-repo "http://www-verimag.imag.fr/DIST-TOOLS/SYNCHRONE/test/opam-repository"
-
opam update
-
opam install -y
camlp4
ocamlfind
oasis
extlib
-
opam install -y ocamlfind
dune
extlib
-
opam install rdbg
-
make
-
make install
...
...
Makefile
View file @
4e5bcd7a
all
:
build man
build
:
setup.data src
/lv6version.ml
ocaml setup.ml
-build
build
:
lib
/lv6version.ml
dune build @install
-include
./Makefile.version
setup.ml
:
_oasis
oasis setup
PROF
=
--enable-profile
PROF
=
--disable-profile
PREFIX
=
$(
shell
opam config var prefix
)
setup.data
:
setup.ml
ocaml setup.ml
-configure
$(PROF)
--prefix
$(PREFIX)
install
:
ocaml setup.ml
-
install
dune
install
uninstall
:
ocaml setup.ml
-
uninstall
dune
uninstall
reinstall
:
ocaml setup.ml
-re
install
dune
install
clean
:
ocaml setup.ml
-clean
rm
-f
setup.data
rm
-f
src/lv6version.ml
distclean
:
ocaml setup.ml
-distclean
dune clean
rm
-f
lib/lv6version.ml
man
:
cd
lv6-ref-man
&&
make
||
echo
"*** ref manual building failed"
...
...
Makefile.version
View file @
4e5bcd7a
...
...
@@ -5,9 +5,9 @@ BRANCH:=$(shell git branch | grep "*" | cut -d ' ' -f 2 || basename `pwd` | echo
VERSION
=
$(
shell
git describe
--tags
||
basename
`
pwd
`
|
cut
-d
'.'
-f2-4
)
gen_version
:
rm
-f
src
/lv6version.ml
rm
-f
lib
/lv6version.ml
src
/lv6version.ml
:
Makefile
lib
/lv6version.ml
:
Makefile
echo
"(** Automatically generated from Makefile.version *) "
>
$@
echo
"let tool =
\"
lv6
\"
"
>>
$@
echo
"let str=
\"
$(VERSION)
\"
"
>>
$@
...
...
src
/assertion2lutin.ml
→
bin
/assertion2lutin.ml
View file @
4e5bcd7a
(* Time-stamp: <modified the
18
/08/201
7
(at 1
1:44
) by Erwan Jahier> *)
(* Time-stamp: <modified the
29
/08/201
9
(at 1
7:03
) by Erwan Jahier> *)
open
Lxm
open
Lic
open
Lv6MainArgs
open
Lxm
(* *)
exception
Not_handled
let
rec
is_not_atomic
=
function
|
CallByPosLic
({
it
=
CONST_REF
_
}
,_
)
|
CallByPosLic
({
it
=
VAR_REF
_
}
,
_
)
->
false
|
CallByPosLic
({
it
=
TUPLE
}
,
[
ve
])
->
is_not_atomic
ve
.
ve_core
|
CallByPosLic
({
it
=
CONST_REF
_
;
_
}
,_
)
|
CallByPosLic
({
it
=
VAR_REF
_
;
_
}
,
_
)
->
false
|
CallByPosLic
({
it
=
TUPLE
;
_
}
,
[
ve
])
->
is_not_atomic
ve
.
ve_core
|
_
->
true
let
rec
(
string_of_val_exp_eff
:
Lic
.
val_exp
->
string
)
=
fun
ve
->
string_of_val_exp_eff_core
ve
.
ve_core
and
string_of_val_exp_eff_core
ve_core
=
match
ve_core
with
|
CallByPosLic
(
by_pos_op_eff
,
vel
)
->
(* ICI : on pourrait afficher en commentaire l'éventuel type_matches ? *)
(
string_of_by_pos_op_eff
by_pos_op_eff
vel
)
|
CallByPosLic
(
by_pos_op_eff
,
vel
)
->
(* ICI : on pourrait afficher en commentaire l'éventuel type_matches ? *)
(
string_of_by_pos_op_eff
by_pos_op_eff
vel
)
|
Merge
_
|
CallByNameLic
_
->
raise
Not_handled
|
Merge
_
|
CallByNameLic
_
->
raise
Not_handled
and
(
string_of_by_pos_op_eff
:
Lic
.
by_pos_op
srcflagged
->
Lic
.
val_exp
list
->
string
)
=
fun
posop
vel
->
...
...
@@ -35,87 +35,87 @@ and (string_of_by_pos_op_eff: Lic.by_pos_op srcflagged -> Lic.val_exp list -> st
let
tuple_par
vel
=
"("
^
(
tuple
vel
)
^
")"
in
let
str
=
match
posop
.
it
,
vel
with
|
CONST
c
,_
->
LicDump
.
string_of_const_eff
true
c
|
CALL
({
it
=
(
"Lustre"
,
"not"
)
,
[]
})
,
[
ve1
]
|
PREDEF_CALL
({
it
=
(
"Lustre"
,
"not"
)
,
[]
})
,
[
ve1
]
->
((
AstPredef
.
op2string
AstPredef
.
NOT_n
)
^
" "
^
(
tuple_par
[
ve1
]))
|
CALL
({
it
=
(
"Lustre"
,
"diese"
)
,
[]
})
,
_
|
CALL
({
it
=
(
"Lustre"
,
"nor"
)
,
[]
})
,
_
->
raise
Not_handled
|
PREDEF_CALL
({
it
=
(
"Lustre"
,
"nor"
)
,
[]
})
,
[
ve1
]
->
raise
Not_handled
|
CALL
({
it
=
(
"Lustre"
,
"if"
)
,
[]
})
,
[
ve1
;
ve2
;
ve3
]
|
PREDEF_CALL
({
it
=
(
"Lustre"
,
"if"
)
,
[]
})
,
[
ve1
;
ve2
;
ve3
]
->
let
ve2str
=
string_of_val_exp_eff
ve2
in
let
ve2str
=
if
LicDump
.
is_a_tuple
ve2
then
"("
^
ve2str
^
")"
else
ve2str
in
let
ve3str
=
string_of_val_exp_eff
ve3
in
let
ve3str
=
if
LicDump
.
is_a_tuple
ve3
then
"("
^
ve3str
^
")"
else
ve3str
in
" if "
^
(
string_of_val_exp_eff
ve1
)
^
" then "
^
ve2str
^
" else "
^
ve3str
|
CALL
(
op
)
,
vel
|
PREDEF_CALL
(
op
)
,
vel
->
(
|
CONST
c
,_
->
LicDump
.
string_of_const_eff
true
c
|
CALL
({
it
=
(
"Lustre"
,
"not"
)
,
[]
;
_
})
,
[
ve1
]
|
PREDEF_CALL
({
it
=
(
"Lustre"
,
"not"
)
,
[]
;
_
})
,
[
ve1
]
->
((
AstPredef
.
op2string
AstPredef
.
NOT_n
)
^
" "
^
(
tuple_par
[
ve1
]))
|
CALL
({
it
=
(
"Lustre"
,
"diese"
)
,
[]
;
_
})
,
_
|
CALL
({
it
=
(
"Lustre"
,
"nor"
)
,
[]
;
_
})
,
_
->
raise
Not_handled
|
PREDEF_CALL
({
it
=
(
"Lustre"
,
"nor"
)
,
[]
;
_
})
,
[
_
ve1
]
->
raise
Not_handled
|
CALL
({
it
=
(
"Lustre"
,
"if"
)
,
[]
;
_
})
,
[
ve1
;
ve2
;
ve3
]
|
PREDEF_CALL
({
it
=
(
"Lustre"
,
"if"
)
,
[]
;
_
})
,
[
ve1
;
ve2
;
ve3
]
->
let
ve2str
=
string_of_val_exp_eff
ve2
in
let
ve2str
=
if
LicDump
.
is_a_tuple
ve2
then
"("
^
ve2str
^
")"
else
ve2str
in
let
ve3str
=
string_of_val_exp_eff
ve3
in
let
ve3str
=
if
LicDump
.
is_a_tuple
ve3
then
"("
^
ve3str
^
")"
else
ve3str
in
" if "
^
(
string_of_val_exp_eff
ve1
)
^
" then "
^
ve2str
^
" else "
^
ve3str
|
CALL
(
op
)
,
vel
|
PREDEF_CALL
(
op
)
,
vel
->
(
if
AstPredef
.
is_a_predef_op
(
snd
(
fst
op
.
it
))
then
let
op_str
=
snd
(
fst
op
.
it
)
in
let
op_short_str
=
AstPredef
.
op2string
(
AstPredef
.
string_to_op
op_str
)
in
if
AstPredef
.
is_infix
(
AstPredef
.
string_to_op
op_str
)
then
(
match
vel
with
|
[
ve1
;
ve2
]
->
"("
^
(
string_of_val_exp_eff
ve1
)
^
") "
^
op_short_str
^
" ("
^
(
string_of_val_exp_eff
ve2
)
^
")"
|
_
->
assert
false
|
[
ve1
;
ve2
]
->
"("
^
(
string_of_val_exp_eff
ve1
)
^
") "
^
op_short_str
^
" ("
^
(
string_of_val_exp_eff
ve2
)
^
")"
|
_
->
assert
false
)
else
(
op_short_str
^
(
match
op_str
with
|
"true"
|
"false"
->
tuple
vel
|
_
->
tuple_par
vel
)
(
match
op_str
with
|
"true"
|
"false"
->
tuple
vel
|
_
->
tuple_par
vel
)
)
else
let
nk
=
op
.
it
in
((
string_of_node_key
nk
)
^
(
tuple_par
vel
))
)
|
CONST_REF
idl
,
_
->
LicDump
.
dump_long
true
idl
|
VAR_REF
id
,
_
->
id
|
PRE
,
[
ve
]
->
if
is_not_atomic
ve
.
ve_core
then
raise
Not_handled
else
"pre "
^
(
string_of_val_exp_eff
ve
)
|
ARROW
,
[
ve1
;
ve2
]
->
(
if
LicDump
.
is_a_tuple
ve1
then
tuple_par
[
ve1
]
else
string_of_val_exp_eff
ve1
)
^
" fby loop { "
^
(
if
LicDump
.
is_a_tuple
ve1
then
tuple_par
[
ve2
]
else
string_of_val_exp_eff
ve2
)
^
" } "
|
FBY
,
[
ve1
;
ve2
]
->
if
is_not_atomic
ve1
.
ve_core
then
raise
Not_handled
else
(
if
LicDump
.
is_a_tuple
ve1
then
tuple_par
[
ve1
]
else
string_of_val_exp_eff
ve1
)
^
" fby loop pre "
^
(
if
LicDump
.
is_a_tuple
ve1
then
tuple_par
[
ve2
]
else
string_of_val_exp_eff
ve2
)
|
TUPLE
,_
->
(
tuple
vel
)
|
ARRAY_ACCES
(
i
)
,
[
ve1
]
->
(
string_of_val_exp_eff
ve1
)
^
"_"
^
(
string_of_int
i
)
|
STRUCT_ACCESS
(
id
)
,
[
ve1
]
->
(
string_of_val_exp_eff
ve1
)
^
"_"
^
(
Lv6Id
.
to_string
id
)
|
STRUCT_ACCESS
_
,
_
|
PRE
,
_
|
WHEN
_
,
_
|
CURRENT
_
,_
|
CONCAT
,
_
|
HAT
(
_
)
,
_
|
ARRAY
,
_
|
ARRAY_SLICE
(
_
)
,
_
|
ARROW
,
_
|
FBY
,
_
|
ARRAY_ACCES
(
_
)
,
_
->
raise
Not_handled
|
CONST_REF
idl
,
_
->
LicDump
.
dump_long
true
idl
|
VAR_REF
id
,
_
->
id
|
PRE
,
[
ve
]
->
if
is_not_atomic
ve
.
ve_core
then
raise
Not_handled
else
"pre "
^
(
string_of_val_exp_eff
ve
)
|
ARROW
,
[
ve1
;
ve2
]
->
(
if
LicDump
.
is_a_tuple
ve1
then
tuple_par
[
ve1
]
else
string_of_val_exp_eff
ve1
)
^
" fby loop { "
^
(
if
LicDump
.
is_a_tuple
ve1
then
tuple_par
[
ve2
]
else
string_of_val_exp_eff
ve2
)
^
" } "
|
FBY
,
[
ve1
;
ve2
]
->
if
is_not_atomic
ve1
.
ve_core
then
raise
Not_handled
else
(
if
LicDump
.
is_a_tuple
ve1
then
tuple_par
[
ve1
]
else
string_of_val_exp_eff
ve1
)
^
" fby loop pre "
^
(
if
LicDump
.
is_a_tuple
ve1
then
tuple_par
[
ve2
]
else
string_of_val_exp_eff
ve2
)
|
TUPLE
,_
->
(
tuple
vel
)
|
ARRAY_ACCES
(
i
)
,
[
ve1
]
->
(
string_of_val_exp_eff
ve1
)
^
"_"
^
(
string_of_int
i
)
|
STRUCT_ACCESS
(
id
)
,
[
ve1
]
->
(
string_of_val_exp_eff
ve1
)
^
"_"
^
(
Lv6Id
.
to_string
id
)
|
STRUCT_ACCESS
_
,
_
|
PRE
,
_
|
WHEN
_
,
_
|
CURRENT
_
,_
|
CONCAT
,
_
|
HAT
(
_
)
,
_
|
ARRAY
,
_
|
ARRAY_SLICE
(
_
)
,
_
|
ARROW
,
_
|
FBY
,
_
|
ARRAY_ACCES
(
_
)
,
_
->
raise
Not_handled
in
let
do_not_parenthesize
=
function
|
VAR_REF
_
,_
|
CONST_REF
_
,_
|
PREDEF_CALL
({
it
=
(
"Lustre"
,
"true"
)
,
[]
})
,_
|
PREDEF_CALL
({
it
=
(
"Lustre"
,
"false"
)
,
[]
})
,_
|
PREDEF_CALL
({
it
=
(
"Lustre"
,
"true"
)
,
[]
;
_
})
,_
|
PREDEF_CALL
({
it
=
(
"Lustre"
,
"false"
)
,
[]
;
_
})
,_
|
ARRAY_ACCES
_
,_
|
STRUCT_ACCESS
_
,_
->
true
|
_
,_
->
false
...
...
@@ -123,12 +123,12 @@ and (string_of_by_pos_op_eff: Lic.by_pos_op srcflagged -> Lic.val_exp list -> st
if
(* already parenthesized *)
(
Str
.
string_match
(
Str
.
regexp
"^("
)
str
0
&&
Str
.
string_match
(
Str
.
regexp
")$"
)
str
0
)
Str
.
string_match
(
Str
.
regexp
")$"
)
str
0
)
||
(* ident or predef constants *)
(
do_not_parenthesize
(
posop
.
it
,
vel
))
(* ident or predef constants *)
(
do_not_parenthesize
(
posop
.
it
,
vel
))
||
global_opt
.
one_op_per_equation
global_opt
.
one_op_per_equation
then
str
else
...
...
bin/dune
0 → 100644
View file @
4e5bcd7a
(executable
(name main)
(libraries lutils extlib lustre-v6)
)
(install
(section bin)
(package lustre-v6)
(files (main.exe as lv6))
)
src
/genOcamlGlue.ml
→
bin
/genOcamlGlue.ml
View file @
4e5bcd7a
File moved
src
/l2lAliasType.ml
→
bin
/l2lAliasType.ml
View file @
4e5bcd7a
File moved
src
/l2lAliasType.mli
→
bin
/l2lAliasType.mli
View file @
4e5bcd7a
File moved
src
/main.ml
→
bin
/main.ml
View file @
4e5bcd7a
(* Time-stamp: <modified the
05
/0
4
/2019 (at 1
3
:0
4
) by Erwan Jahier> *)
(* Time-stamp: <modified the
29
/0
8
/2019 (at 1
7
:0
7
) by Erwan Jahier> *)
open
Lv6Verbose
open
AstV6
open
AstCore
open
Lxm
open
Lv6errors
open
Parsing
...
...
@@ -104,7 +102,7 @@ let (gen_autotest_files : LicPrg.t -> Lv6Id.idref option -> Lv6MainArgs.t -> uni
let
assertions
=
let
main_node_lic
=
LicPrg
.
find_node
lic_prg
(
Lic
.
node_key_of_idref
main_node
)
in
match
main_node_lic
with
|
Some
({
Lic
.
def_eff
=
Lic
.
BodyLic
nlic
})
->
nlic
.
Lic
.
asserts_eff
|
Some
({
Lic
.
def_eff
=
Lic
.
BodyLic
nlic
;
_
})
->
nlic
.
Lic
.
asserts_eff
|
_
->
[]
in
let
assertion_to_lutin_cstr
a
=
Assertion2lutin
.
f
a
.
it
in
...
...
@@ -173,7 +171,7 @@ let (gen_autotest_files : LicPrg.t -> Lv6Id.idref option -> Lv6MainArgs.t -> uni
res
:=
!
res
@
aux
(
x
^
"["
^
istr
^
"]"
)
(
y
^
"["
^
istr
^
"]"
)
t
done
;
!
res
|
Data
.
Struct
(
n
,
fl
)
->
|
Data
.
Struct
(
_
n
,
fl
)
->
let
do_field
(
fn
,
ft
)
=
aux
(
x
^
"."
^
fn
)
(
y
^
"."
^
fn
)
ft
in
List
.
flatten
(
List
.
map
do_field
fl
)
|
_
->
[
x
^
"="
^
y
]
...
...
@@ -209,7 +207,7 @@ let (gen_autotest_files : LicPrg.t -> Lv6Id.idref option -> Lv6MainArgs.t -> uni
res
:=
!
res
@
aux
(
x
^
"["
^
istr
^
"]"
)
(
y
^
"["
^
istr
^
"]"
)
t
done
;
!
res
|
Data
.
Struct
(
n
,
fl
)
->
|
Data
.
Struct
(
_
n
,
fl
)
->
let
do_field
(
fn
,
ft
)
=
aux
(
x
^
"."
^
fn
)
(
y
^
"."
^
fn
)
ft
in
List
.
flatten
(
List
.
map
do_field
fl
)
|
_
->
[
x
^
"="
^
y
]
...
...
src
/soc2c.ml
→
bin
/soc2c.ml
View file @
4e5bcd7a
(* Time-stamp: <modified the
06
/0
7
/201
8
(at 17:
07
) by Erwan Jahier> *)
(* Time-stamp: <modified the
29
/0
8
/201
9
(at 17:
11
) by Erwan Jahier> *)
(* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *)
...
...
@@ -17,7 +17,7 @@ let rec (type_to_string2 : Data.t -> string) =
|
Int
->
"int"
|
Real
->
"real"
|
Extern
s
->
id2s
s
|
Enum
(
s
,
sl
)
->
id2s
s
|
Enum
(
s
,
_
sl
)
->
id2s
s
|
Struct
(
sid
,_
)
->
(
id2s
sid
)
|
Array
(
ty
,
sz
)
->
Printf
.
sprintf
"%s_%d"
(
type_to_string2
ty
)
sz
|
Alpha
nb
->
"alpha_"
^
(
string_of_int
nb
)
...
...
@@ -107,51 +107,51 @@ let (gao2c : Soc.tbl -> 'a soc_pp -> Soc.gao -> unit) =
let
(
step2c
:
Soc
.
tbl
->
'
a
soc_pp
->
Soc
.
step_method
->
unit
)
=
fun
stbl
sp
sm
->
if
inlined_soc
sp
.
soc
.
key
then
()
(* don't generate code if inlined *)
else
(* let sname = Soc2cDep.step_name sp.soc.key sm.name in *)
(* let sname = Soc2cDep.step_name sp.soc.key sm.name in *)
let
sname
=
Soc2cDep
.
step_name
sp
.
soc
.
key
sm
.
name
in
if
sm
.
impl
<>
Extern
then
(
let
decl
,
def
,
ctype
=
Soc2cDep
.
get_step_prototype
sm
sp
.
soc
in
sp
.
hput
(
Printf
.
sprintf
"%s
\n
"
decl
);
sp
.
cput
(
Printf
.
sprintf
"%s"
def
);
(
match
sm
.
impl
with
|
Extern
->
()
|
Predef
->
(
match
sp
.
soc
.
key
with
|
(
"Lustre::eq"
,
(
Array
_
)
::_,_
)
->
let
str
=
Printf
.
sprintf
" *out = memcmp((const void *) i1, (const void *) i2, %s)==0;
\n
"
ctype
in
sp
.
cput
str
|
(
"Lustre::eq"
,
(
Struct
_
)
::_,_
)
->
let
str
=
Printf
.
sprintf
" *out = memcmp((const void *) &i1, (const void *) &i2, %s)==0;
\n
"
ctype
in
sp
.
cput
str
|
(
"Lustre::neq"
,
(
Array
_
)
::_,_
)
->
let
str
=
Printf
.
sprintf
" *out = !memcmp((const void *) i1, (const void *) i2, %s)==0;
\n
"
ctype
in
sp
.
cput
str
|
(
"Lustre::neq"
,
(
Struct
_
)
::_,_
)
->
let
str
=
Printf
.
sprintf
" *out = !memcmp((const void *) &i1, (const void *) &i2, %s)==0;
\n
"
ctype
in
sp
.
cput
str
|
n
->
sp
.
cput
(
Soc2cDep
.
get_predef_op
n
)
)
|
Gaol
(
vl
,
gaol
)
->
(
if
Lv6MainArgs
.
global_opt
.
Lv6MainArgs
.
gen_wcet
then
List
.
iter
(
fun
v
->
sp
.
cput
(
Soc2cUtil
.
string_of_flow_decl_w7annot
gaol
v
))
vl
else
List
.
iter
(
fun
v
->
sp
.
cput
(
Soc2cUtil
.
string_of_flow_decl
v
))
vl
;
sp
.
cput
"
\n
"
;
List
.
iter
(
gao2c
stbl
sp
)
gaol
)
|
Iterator
(
it
,
it_soc_key
,
s
)
->
let
it_soc
=
SocUtils
.
find
sm
.
lxm
it_soc_key
stbl
in
sp
.
cput
(
Soc2cDep
.
get_iterator
sp
.
soc
it
it_soc
s
)
|
Boolred
(
i
,
j
,
k
)
->
sp
.
cput
(
Soc2cDep
.
get_boolred
sp
.
soc
i
j
k
)
|
Condact
(
k
,
el
)
->
sp
.
cput
(
Soc2cDep
.
get_condact
sp
.
soc
(
SocUtils
.
find
sm
.
lxm
k
stbl
)
el
)
|
Extern
->
()
|
Predef
->
(
match
sp
.
soc
.
key
with
|
(
"Lustre::eq"
,
(
Array
_
)
::_,_
)
->
let
str
=
Printf
.
sprintf
" *out = memcmp((const void *) i1, (const void *) i2, %s)==0;
\n
"
ctype
in
sp
.
cput
str
|
(
"Lustre::eq"
,
(
Struct
_
)
::_,_
)
->
let
str
=
Printf
.
sprintf
" *out = memcmp((const void *) &i1, (const void *) &i2, %s)==0;
\n
"
ctype
in
sp
.
cput
str
|
(
"Lustre::neq"
,
(
Array
_
)
::_,_
)
->
let
str
=
Printf
.
sprintf
" *out = !memcmp((const void *) i1, (const void *) i2, %s)==0;
\n
"
ctype
in
sp
.
cput
str
|
(
"Lustre::neq"
,
(
Struct
_
)
::_,_
)
->
let
str
=
Printf
.
sprintf
" *out = !memcmp((const void *) &i1, (const void *) &i2, %s)==0;
\n
"
ctype
in
sp
.
cput
str
|
n
->
sp
.
cput
(
Soc2cDep
.
get_predef_op
n
)
)
|
Gaol
(
vl
,
gaol
)
->
(
if
Lv6MainArgs
.
global_opt
.
Lv6MainArgs
.
gen_wcet
then
List
.
iter
(
fun
v
->
sp
.
cput
(
Soc2cUtil
.
string_of_flow_decl_w7annot
gaol
v
))
vl
else
List
.
iter
(
fun
v
->
sp
.
cput
(
Soc2cUtil
.
string_of_flow_decl
v
))
vl
;
sp
.
cput
"
\n
"
;
List
.
iter
(
gao2c
stbl
sp
)
gaol
)
|
Iterator
(
it
,
it_soc_key
,
s
)
->
let
it_soc
=
SocUtils
.
find
sm
.
lxm
it_soc_key
stbl
in
sp
.
cput
(
Soc2cDep
.
get_iterator
sp
.
soc
it
it_soc
s
)
|
Boolred
(
i
,
j
,
k
)
->
sp
.
cput
(
Soc2cDep
.
get_boolred
sp
.
soc
i
j
k
)
|
Condact
(
k
,
el
)
->
sp
.
cput
(
Soc2cDep
.
get_condact
sp
.
soc
(
SocUtils
.
find
sm
.
lxm
k
stbl
)
el
)
);
sp
.
cput
(
sprintf
"
\n
} // End of %s
\n\n
"
sname
)
)
...
...
@@ -309,11 +309,11 @@ let (type_to_format_string : Data.t -> string) =
|
Bool
->
"%d"
|
Int
->
"%d"
|
Real
->
"%f"
|
Extern
s
->
"%d"
|
Enum
(
s
,
sl
)
->
"%d"
|
Struct
(
sid
,_
)
->
"%s"
|
Array
(
ty
,
sz
)
->
"%s"
|
Alpha
nb
->
assert
false
|
Extern
_
s
->
"%d"
|
Enum
(
_
s
,
_
sl
)
->
"%d"
|
Struct
(
_
sid
,_
)
->
"%s"
|
Array
(
_
ty
,
_
sz
)
->
"%s"
|
Alpha
_
nb
->
assert
false
|
Alias
_
->
assert
false
...
...
@@ -370,7 +370,7 @@ let user_typedef licprg =
fst
(
LicPrg
.
fold_types
typedef_to_string
licprg
(
""
,
ItemKeySet
.
empty
))
let
(
typedef_all
:
LicPrg
.
t
->
Soc
.
tbl
->
Soc
.
t
->
string
)
=
fun
licprg
soc_tbl
main_soc
->
fun
_
licprg
soc_tbl
main_soc
->
(* We need to print the ctx typedef in a good order
(w.r.t. typedef dependencies). To do that, we traverse
the tree of soc instances which root is the main soc.
...
...
@@ -387,7 +387,7 @@ let (typedef_all : LicPrg.t -> Soc.tbl -> Soc.t -> string) =
let
visited
=
KeySet
.
add
soc
.
key
visited
in
let
acc
,
visited
=
List
.
fold_left
(
fun
(
acc
,
visited
)
(
iname
,
sk
)
->
(
fun
(
acc
,
visited
)
(
_
iname
,
sk
)
->
let
soc
=
SocUtils
.
find_no_exc
sk
soc_tbl
in
soc_with_mem
(
acc
,
visited
)
soc
)
...
...
@@ -429,11 +429,11 @@ let rec (const_to_c: Lic.const -> string) =
|
Lic
.
Bool_const_eff
false
->
"0"
|
Lic
.
Int_const_eff
i
->
(
sprintf
"%s"
i
)
|
Lic
.
Real_const_eff
r
->
r
|
Lic
.
Extern_const_eff
(
s
,
t
)
->
(
long2s
s
)
|
Lic
.
Abstract_const_eff
(
s
,
t
,
v
,_
)
->
const_to_c
v
|
Lic
.
Extern_const_eff
(
s
,
_
t
)
->
(
long2s
s
)
|
Lic
.
Abstract_const_eff
(
_
s
,
_
t
,
v
,_
)
->
const_to_c
v
|
Lic
.
Enum_const_eff
(
s
,
Lic
.
Enum_type_eff
(
_
,
ll
))
->
Lic
.
enum_to_string
s
ll
|
Lic
.
Enum_const_eff
_
->
assert
false
(* SNO *)
|
Lic
.
Struct_const_eff
(
fl
,
t
)
->
(
|
Lic
.
Struct_const_eff
(
fl
,
_
t
)
->
(
let
string_of_field
=
function
(
id
,
veff
)
->
(
Lv6Id
.
to_string
id
)
^
" = "
^
(
const_to_c
veff
)
...
...
@@ -442,11 +442,11 @@ let rec (const_to_c: Lic.const -> string) =
(* (string_of_type_eff t)^ *)
"{"
^
(
String
.
concat
"; "
flst
)
^
"}"
)
|
Lic
.
Array_const_eff
(
ctab
,
t
)
->
(
|
Lic
.
Array_const_eff
(
ctab
,
_
t
)
->
(
let
vl
=
List
.
map
const_to_c
ctab
in
"{"
^
(
String
.
concat
", "
vl
)
^
"}"
)
|
Lic
.
Tuple_const_eff
cl
->
assert
false
|
Lic
.
Tuple_const_eff
_
cl
->
assert
false
(* returns a pair: the lhs for the .h, the rhs for the .c
Indeed, arrays constant need to be defined in a .c
...
...
@@ -456,7 +456,7 @@ let (constdef : LicPrg.t -> string*string) =
let
to_c
k
=
function
|
Lic
.
Extern_const_eff
_
->
""
,
""
(* | Lic.Array_const_eff (ctab, Array_type_eff(_t,s)) -> ( *)
|
Lic
.
Array_const_eff
(
ctab
,
t
)
->
(
|
Lic
.
Array_const_eff
(
ctab
,
_
t
)
->
(
let
vl
=
List
.
map
const_to_c
ctab
in
let
s
=
List
.
length
vl
in
let
tab_exp
=
"{"
^
(
String
.
concat
", "
vl
)
^
"}"
in
...
...
@@ -482,7 +482,7 @@ let (constdef : LicPrg.t -> string*string) =
let
(
gen_memoryless_ctx
:
Soc
.
tbl
->
string
)
=
fun
stbl
->
let
do_soc
sk
soc
acc
=
let
do_soc
_
sk
soc
acc
=
if
(
SocUtils
.
ctx_is_global
soc
)
&&
not
(
inlined_soc
soc
.
key
)
then
let
ctx_name
=
get_ctx_name
soc
.
key
in
let
ctx_name_type
=
ctx_name
^
"_type"
in
...
...
@@ -556,7 +556,7 @@ let gen_main_loop_body inputs outputs soc ctx =
(****************************************************************************)
let
(
gen_main_wcet_file
:
Soc
.
t
->
string
->
Soc
.
tbl
->
unit
)
=
fun
soc
base
stbl
->
fun
soc
base
_
stbl
->
let
mainfile
=
base
^
"_main.c"
in
let
oc
=
open_out
mainfile
in
...
...
@@ -826,7 +826,7 @@ int main(){
let
(
gen_loop_file4ogensim
:
Soc
.
t
->
string
->
out_channel
->
Soc
.
tbl
->
unit
)
=
fun
soc
base
oc
stbl
->
fun
soc
base
oc
_
stbl
->
let
putc
s
=
output_string
oc
s
in
let
ctx
=
get_ctx_name
soc
.
key
in
let
step
=
Soc2cDep
.
step_name
soc
.
key
"step"
in
...
...
src
/soc2c.mli
→
bin
/soc2c.mli
View file @
4e5bcd7a
File moved
src
/soc2cDep.ml
→
bin
/soc2cDep.ml
View file @
4e5bcd7a
File moved
src
/soc2cDep.mli
→
bin
/soc2cDep.mli
View file @
4e5bcd7a
File moved
src
/soc2cExtern.ml
→
bin
/soc2cExtern.ml
View file @
4e5bcd7a
(* Time-stamp: <modified the
10
/0
7
/201
7
(at 1
0:52
) by Erwan Jahier> *)
(* Time-stamp: <modified the
29
/0
8
/201
9
(at 1
7:04
) by Erwan Jahier> *)
open
Soc2cIdent
...
...
@@ -7,7 +7,7 @@ let (is_extern_type: Lic.type_ -> bool) =
|
Lic
.
External_type_eff
_
->
true
|
_
->
false
let
(
is_extern_const
:
Lic
.
const
->
bool
)
=
let
(
_
is_extern_const
:
Lic
.
const
->
bool
)
=
function
|
Lic
.
Extern_const_eff
_
->
true
|
_
->
false
...
...
@@ -115,9 +115,9 @@ open Soc
let
(
gen_files
:
Soc
.
t
->
Soc
.
tbl
->
LicPrg
.
t
->
string
->
string
->
string
->
bool
*
bool
)
=
fun
msoc
stbl
licprg
ext_cfile
ext_hfile
hfile
->
fun
_
msoc
stbl
licprg
ext_cfile
ext_hfile
hfile
->
let
extern_steps
=
SocMap
.
fold
(
fun
sk
soc
acc
->
(
fun
_
sk
soc
acc
->
List
.
fold_left
(
fun
acc
sm
->
if
sm
.
impl
=
Extern
then
(
sm
,
soc
)
::
acc
else
acc
)
acc
soc
.
step
)
...
...
src
/soc2cExtern.mli
→
bin
/soc2cExtern.mli
View file @
4e5bcd7a
File moved
src
/soc2cGenAssign.ml
→
bin
/soc2cGenAssign.ml
View file @
4e5bcd7a
(* Time-stamp: <modified the
05
/0
5
/201
7
(at 1
5
:0
0
) by Erwan Jahier> *)
(* Time-stamp: <modified the
29
/0
8
/201
9
(at 1
7
:0
7
) by Erwan Jahier> *)
open
Data
open
Lic
open
Lxm
module
OrderedData
=
struct
type
t
=
Data
.
t
...
...
@@ -17,7 +15,7 @@ fun acc t ->
|
Data
.
Array
(
st
,_
)
->
update_set
(
DataSet
.
add
t
acc
)
st
|
Data
.
Extern
_
->
DataSet
.
add
t
acc
|
Struct
(
_
,
fl
)
->
List
.
fold_left
(
fun
acc
(
_
,
t
)
->
update_set
acc
t
)
acc
fl
|
Alias
(
n
,
t
)
->
update_set
acc
t
|
Alias
(
_
n
,
t
)
->
update_set
acc
t
|
_
->
acc
open
Soc
...
...
@@ -36,7 +34,7 @@ let (update_set_step: DataSet.t -> Soc.step_method -> DataSet.t) =
(* exported *)