Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lustre-v6
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
verimag
synchrone
lustre-v6
Commits
2a7db9b8
Commit
2a7db9b8
authored
10 years ago
by
Erwan Jahier
Browse files
Options
Downloads
Patches
Plain Diff
Soc2c: declare the ctx of memoryless nodes in the loop file.
parent
f82064a4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/compile.ml
+1
-1
1 addition, 1 deletion
src/compile.ml
src/soc2c.ml
+27
-13
27 additions, 13 deletions
src/soc2c.ml
test/lus2lic.sum
+2
-2
2 additions, 2 deletions
test/lus2lic.sum
test/lus2lic.time
+1
-1
1 addition, 1 deletion
test/lus2lic.time
with
31 additions
and
17 deletions
src/compile.ml
+
1
−
1
View file @
2a7db9b8
(* Time-stamp: <modified the
12
/0
6
/2014 (at
09:42
) by Erwan Jahier> *)
(* Time-stamp: <modified the
04
/0
7
/2014 (at
16:23
) by Erwan Jahier> *)
open
Lxm
open
Lv6errors
...
...
This diff is collapsed.
Click to expand it.
src/soc2c.ml
+
27
−
13
View file @
2a7db9b8
(* Time-stamp: <modified the 0
4
/07/2014 (at 11:
51
) by Erwan Jahier> *)
(* Time-stamp: <modified the 0
7
/07/2014 (at 11:
49
) by Erwan Jahier> *)
(* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *)
...
...
@@ -227,7 +227,7 @@ let (soc2c: int -> out_channel -> out_channel -> Soc.tbl -> Soc.t -> unit) =
let
ctx_name_type
=
ctx_name
^
"_type"
in
if
pass
=
1
then
(
(* Only for ctx of memoryless nodes + main node *)
if
is_memory_less
soc
then
h
fmt
"%s %s;
\n
"
ctx_name_type
ctx_name
;
if
is_memory_less
soc
then
c
fmt
"%s %s;
\n
"
ctx_name_type
ctx_name
;
)
else
(
if
is_memory_less
soc
then
()
else
(
cfmt
"// Memory initialisation for %s
\n
"
ctx_name
;
...
...
@@ -423,11 +423,22 @@ let (constdef : LicPrg.t -> string) =
(****************************************************************************)
let
(
gen_loop_file
:
Soc
.
t
->
unit
)
=
fun
soc
->
let
(
gen_memoryless_ctx
:
Soc
.
tbl
->
string
)
=
fun
stbl
->
let
acc
=
Printf
.
sprintf
"
\n
// Allocation of memoryless ctx
\n
"
in
let
do_soc
sk
soc
acc
=
if
is_memory_less
soc
&&
not
(
inline_soc
sk
)
then
let
ctx_name
=
get_ctx_name
soc
.
key
in
let
ctx_name_type
=
ctx_name
^
"_type"
in
Printf
.
sprintf
"%sextern %s %s;
\n
"
acc
ctx_name_type
ctx_name
else
acc
in
Soc
.
SocMap
.
fold
do_soc
stbl
acc
(****************************************************************************)
let
(
gen_loop_file
:
Soc
.
t
->
out_channel
->
Soc
.
tbl
->
unit
)
=
fun
soc
oc
stbl
->
let
base
=
(
string_of_soc_key
soc
.
key
)
in
let
loopfile
=
base
^
"_loop.c"
in
let
oc
=
open_out
loopfile
in
let
putc
s
=
output_string
oc
s
in
let
ctx
=
get_ctx_name
soc
.
key
in
let
step
=
Soc2cUtil
.
step_name
soc
.
key
"step"
in
...
...
@@ -536,7 +547,8 @@ void %s_BOT_n(void* cdata){
/* Output procedures **********************/
void "
^
n
^
"_O_n(void* cdata, _integer _V) {
_put_int(
\"
n
\"
, _V);
}/* Main procedure *************************/
}"
^
(
gen_memoryless_ctx
stbl
)
^
"/* Main procedure *************************/
int main(){
int s = 0;
...
...
@@ -572,10 +584,7 @@ int main(){
return 1;
}
"
)
;
flush
oc
;
close_out
oc
;
Printf
.
printf
"%s has been generated.
\n
"
loopfile
"
)
(****************************************************************************)
(* The entry point for lus2lic --to-c *)
...
...
@@ -588,15 +597,18 @@ let (f : Lv6MainArgs.t -> Soc.key -> Soc.tbl -> LicPrg.t -> unit) =
let
base
=
string_of_soc_key
msoc
in
let
hfile
=
base
^
".h"
in
let
cfile
=
base
^
".c"
in
let
loopfile
=
base
^
"_loop.c"
in
let
occ
=
open_out
cfile
in
let
och
=
open_out
hfile
in
let
ocl
=
open_out
loopfile
in
let
putc
s
=
output_string
occ
s
;
flush
occ
in
let
puth
s
=
output_string
och
s
;
flush
och
in
let
main_soc
=
Soc
.
SocMap
.
find
msoc
stbl
in
Lv6util
.
entete
occ
"/*"
"*/"
;
Lv6util
.
entete
och
"/*"
"*/"
;
gen_loop_file
main_soc
;
gen_loop_file
main_soc
ocl
stbl
;
output_string
och
"
#include <stdlib.h>
...
...
@@ -633,9 +645,11 @@ typedef float _float;
puth
"#endif
\n
"
;
flush
occ
;
close_out
occ
;
flush
och
;
close_out
och
;
flush
ocl
;
close_out
ocl
;
Printf
.
printf
"%s has been generated.
\n
"
loopfile
;
Printf
.
printf
"%s has been generated.
\n
"
hfile
;
Printf
.
printf
"%s has been generated.
\n
"
cfile
;
let
base
=
(
string_of_soc_key
main_soc
.
key
)
in
let
loopfile
=
base
^
"_loop.c"
in
Printf
.
printf
"you can compile those files doing, e.g.,
\n
gcc %s
\n
"
loopfile
;
Printf
.
printf
"you can compile those files doing, e.g.,
\n
gcc
%s
%s
\n
"
cfile
loopfile
;
flush
stdout
This diff is collapsed.
Click to expand it.
test/lus2lic.sum
+
2
−
2
View file @
2a7db9b8
Test Run By jahier on
Fri
Jul
4
1
6:18:39
2014
Test Run By jahier on
Mon
Jul
7
1
1:37:24
2014
Native configuration is i686-pc-linux-gnu
=== lus2lic tests ===
...
...
@@ -1511,5 +1511,5 @@ XPASS: Test bad programs (semantics): lus2lic {-o /tmp/bug.lic should_fail/seman
# of unexpected failures 110
# of unexpected successes 21
# of expected failures 37
testcase ./lus2lic.tests/non-reg.exp completed in 1
39
seconds
testcase ./lus2lic.tests/non-reg.exp completed in 1
40
seconds
testcase ./lus2lic.tests/progression.exp completed in 0 seconds
This diff is collapsed.
Click to expand it.
test/lus2lic.time
+
1
−
1
View file @
2a7db9b8
testcase ./lus2lic.tests/non-reg.exp completed in 1
39
seconds
testcase ./lus2lic.tests/non-reg.exp completed in 1
40
seconds
testcase ./lus2lic.tests/progression.exp completed in 0 seconds
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment