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
lutils
Commits
2a39e0de
Commit
2a39e0de
authored
Jul 11, 2019
by
erwan
Browse files
Fix: fix a bug occuring when reading RIF with no input or no output
parent
a0e1f4c3
Pipeline
#26979
passed with stages
in 3 minutes and 51 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/rifIO.ml
View file @
2a39e0de
(* Time-stamp: <modified the
23
/0
4
/2019 (at 1
1:10
) by Erwan Jahier> *)
(* Time-stamp: <modified the
10
/0
7
/2019 (at 1
7:41
) by Erwan Jahier> *)
(*-----------------------------------------------------------------------
** This file may only be copied under the terms of the CeCILL
** Public License
...
...
@@ -105,9 +105,9 @@ let rec (read_until_pragma_end :?debug:(bool) -> in_channel -> out_channel optio
let
rec
(
read_interface
:
?
debug
:
(
bool
)
->
?
label
:
(
string
)
->
in_channel
->
out_channel
option
->
vntl
*
vntl
)
=
fun
?
(
debug
=
false
)
?
(
label
=
""
)
ic
oc
->
let
rec
loop
ins
outs
=
if
in
s
<>
[]
&&
outs
<>
[]
then
ins
,
outs
else
let
line
=
read_line
debug
label
ic
oc
in
let
rec
loop
ins
outs
in_done
out_done
=
if
in
_done
&&
out_done
then
ins
,
outs
else
let
line
=
read_line
debug
label
ic
oc
in
try
if
(
Str
.
string_match
(
Str
.
regexp
"#end"
)
line
0
)
||
line
=
"q"
||
line
=
"bye"
then
(
...
...
@@ -120,35 +120,35 @@ let rec (read_interface : ?debug:(bool) -> ?label:(string) -> in_channel ->
let
str
=
strsub
line
7
(
String
.
length
line
-
7
)
in
let
l
=
Str
.
split
(
Str
.
regexp
" "
)
str
in
let
l
=
List
.
filter
(
fun
str
->
str
<>
""
)
l
in
loop
(
List
.
map
to_pair
l
)
outs
loop
(
List
.
map
to_pair
l
)
outs
true
out_done
else
if
Str
.
string_match
(
Str
.
regexp
"@#inputs"
)
line
0
then
let
str
=
strsub
line
8
(
String
.
length
line
-
8
)
in
let
str
=
read_until_pragma_end
~
debug
:
debug
ic
oc
str
in
let
l
=
Str
.
split
(
Str
.
regexp
" "
)
str
in
let
l
=
List
.
filter
(
fun
str
->
str
<>
""
)
l
in
loop
(
List
.
map
to_pair
l
)
outs
loop
(
List
.
map
to_pair
l
)
outs
true
out_done
else
if
Str
.
string_match
(
Str
.
regexp
"#outputs"
)
line
0
then
let
str
=
strsub
line
8
(
String
.
length
line
-
8
)
in
let
l
=
Str
.
split
(
Str
.
regexp
" "
)
str
in
let
l
=
List
.
filter
(
fun
str
->
str
<>
""
)
l
in
loop
ins
(
List
.
map
to_pair
l
)
loop
ins
(
List
.
map
to_pair
l
)
in_done
true
else
if
Str
.
string_match
(
Str
.
regexp
"@#outputs"
)
line
0
then
let
str
=
strsub
line
9
(
String
.
length
line
-
9
)
in
let
str
=
read_until_pragma_end
~
debug
:
debug
ic
oc
str
in
let
l
=
Str
.
split
(
Str
.
regexp
" "
)
str
in
let
l
=
List
.
filter
(
fun
str
->
str
<>
""
)
l
in
loop
ins
(
List
.
map
to_pair
l
)
loop
ins
(
List
.
map
to_pair
l
)
in_done
true
else
loop
ins
outs
loop
ins
outs
in_done
out_done
with
e
->
print_string
(
"#"
^
line
^
"
\n
"
);
flush
stdout
;
raise
e
in
loop
[]
[]
loop
[]
[]
false
false
(* exported *)
...
...
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