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
a86f3a60
Commit
a86f3a60
authored
10 years ago
by
Erwan Jahier
Browse files
Options
Downloads
Patches
Plain Diff
Fix a bug in soc2c: the typedef of the main soc was printed twice if it is memoryless.
parent
3bca6801
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/soc2c.ml
+13
-11
13 additions, 11 deletions
src/soc2c.ml
with
13 additions
and
11 deletions
src/soc2c.ml
+
13
−
11
View file @
a86f3a60
(* Time-stamp: <modified the 04/06/2014 (at 1
7:3
7) by Erwan Jahier> *)
(* Time-stamp: <modified the 04/06/2014 (at 1
8:0
7) by Erwan Jahier> *)
(* let put (os: out_channel) (fmt:('a, unit, string, unit) format4) : 'a = *)
...
...
@@ -271,27 +271,29 @@ let (typedef_of_soc : Soc.t -> string) =
let
str
=
Printf
.
sprintf
"%s} %s;
\n\n
"
str
ctx_name_type
in
str
let
(
typedef
:
LicPrg
.
t
->
Soc
.
tbl
->
Soc
.
t
->
string
)
=
fun
licprg
soc_tbl
main_soc
->
let
(
typedef
:
LicPrg
.
t
->
Soc
.
tbl
->
Soc
.
t
->
string
)
=
fun
licprg
soc_tbl
main_soc
->
(* We need to print the ctx typedef a good order
(w.r.t. typedef dependancies). To do that, we traverse
the tree of soc instances which root is the main soc. *)
let
rec
(
soc_with_mem
:
string
->
Soc
.
t
->
string
)
=
fun
acc
soc
->
fun
acc
soc
->
let
acc
=
(
typedef_of_soc
soc
)
^
acc
in
List
.
fold_left
(
fun
acc
(
iname
,
sk
)
->
(
fun
acc
(
iname
,
sk
)
->
let
soc
=
SocUtils
.
find_no_exc
sk
soc_tbl
in
soc_with_mem
acc
soc
)
soc_with_mem
acc
soc
)
acc
soc
.
instances
in
let
soc_ctx_typedef_with
=
soc_with_mem
""
main_soc
in
let
soc_ctx_typedef_with
=
if
is_memory_less
main_soc
then
""
else
soc_with_mem
""
main_soc
in
(* Then we still have to print memoryless soc that can not appear
as a soc instance *)
let
soc_ctx_typedef_without
=
let
soc_ctx_typedef_without
=
let
socs
=
Soc
.
SocMap
.
bindings
soc_tbl
in
let
socs
=
snd
(
List
.
split
socs
)
in
let
socs
=
snd
(
List
.
split
socs
)
in
let
memless_soc_to_string
acc
soc
=
if
is_memory_less
soc
then
acc
^
(
typedef_of_soc
soc
)
else
acc
in
...
...
@@ -492,7 +494,7 @@ int main(){
(
String
.
concat
" "
outputs_fmt
)
^
"
\\
n
\"
,"
^
(
String
.
concat
","
(
List
.
map
(
fun
(
id
,_
)
->
"ctx->"
^
id
)
(
inputs
@
outputs
)))
^
");
first_step=_false;
first_step=_false;
}
return 1;
...
...
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