Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sasa
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
sasa
Commits
6eefec00
Commit
6eefec00
authored
5 years ago
by
erwan
Browse files
Options
Downloads
Patches
Plain Diff
Fix: in gg-deco, only the first pattern was taken into account
parent
d8a5dd34
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/ggDeco/ggDeco.ml
+6
-6
6 additions, 6 deletions
tools/ggDeco/ggDeco.ml
tools/ggDeco/ggDeco_Arg.ml
+76
-85
76 additions, 85 deletions
tools/ggDeco/ggDeco_Arg.ml
with
82 additions
and
91 deletions
tools/ggDeco/ggDeco.ml
+
6
−
6
View file @
6eefec00
...
...
@@ -29,7 +29,7 @@ let rec apply_pattern : (files_spec_t list -> int -> string) =
let
deco
:
(
Topology
.
t
->
files_spec_t
list
->
Topology
.
t
)
=
fun
g
fl
->
List
.
iter
(
fun
(
i
,
j
,
file
)
->
Printf
.
eprintf
"deco pattern
=
%i-%i:%s
\n
%!"
i
j
file
)
fl
;
List
.
iter
(
fun
(
i
,
j
,
file
)
->
Printf
.
eprintf
"deco pattern
:
%i-%i:%s
\n
%!"
i
j
file
)
fl
;
let
newNodes
=
List
.
mapi
(
fun
i
n
->
...
...
@@ -49,12 +49,12 @@ let to_dot_string : (t -> string -> string) =
let
attrs
=
(
try
[(
"diameter"
,
Register
.
get_graph_attribute
"diameter"
)]
with
_
->
[]
)
@
[(
"min_deg"
,
Register
.
get_graph_attribute
"min_deg"
);
(
"mean_deg"
,
Register
.
get_graph_attribute
"mean_deg"
);
(
"max_deg"
,
Register
.
get_graph_attribute
"max_deg"
);
[(
"min_deg"
,
Register
.
get_graph_attribute
"min_deg"
);
(
"mean_deg"
,
Register
.
get_graph_attribute
"mean_deg"
);
(
"max_deg"
,
Register
.
get_graph_attribute
"max_deg"
);
(
"is_connected"
,
Register
.
get_graph_attribute
"is_connected"
);
(
"is_cyclic"
,
Register
.
get_graph_attribute
"is_cyclic"
);
(
"is_tree"
,
Register
.
get_graph_attribute
"is_tree"
);
(
"is_cyclic"
,
Register
.
get_graph_attribute
"is_cyclic"
);
(
"is_tree"
,
Register
.
get_graph_attribute
"is_tree"
);
(
"links_number"
,
Register
.
get_graph_attribute
"links_number"
)
]
in
...
...
This diff is collapsed.
Click to expand it.
tools/ggDeco/ggDeco_Arg.ml
+
76
−
85
View file @
6eefec00
...
...
@@ -132,95 +132,86 @@ let (add_other : t -> string -> unit) =
let
current
=
ref
0
;;
let
parse_file_spec
:
(
string
list
->
files_spec_t
list
)
=
fun
s
->
List
.
map
(
fun
file
->
try
(
Scanf
.
sscanf
file
"%[-0-9]:%s"
(
fun
range
file
->
if
range
=
""
then
raise
(
Invalid_file_spec
(
file
,
"The first and last node's indexes are \
missing"
))
else
Scanf
.
sscanf
range
"%d%s"
(
fun
a
s
->
if
(
a
<
0
)
then
raise
(
Invalid_file_spec
(
file
,
"The first node's index have to be positive or null"
))
else
if
(
s
=
""
)
then
(
a
,
a
,
file
)
else
if
(
s
=
"-"
)
then
(
a
,-
1
,
file
)
else
Scanf
.
sscanf
s
"-%d"
(
fun
b
->
if
(
b
<
a
)
then
raise
(
Invalid_file_spec
(
file
,
"The last node's index have to be higher than the first node's index"
))
else
(
a
,
b
,
file
)
)
)
)
)
with
|
Scanf
.
Scan_failure
_
->
raise
(
Invalid_file_spec
(
file
,
"The boundaries (first and last node's indexes) should be integers, but an non-numerical character has been found"
))
)
s
let
rec
pop
l
=
(* last ? *)
match
l
with
|
[]
->
assert
false
|
[
a
]
->
([]
,
a
)
|
b
::
tl
->
let
(
l
,
a
)
=
pop
tl
in
(
b
::
l
,
a
)
let
parse_file_spec
:
(
string
->
files_spec_t
)
=
fun
patt
->
try
Scanf
.
sscanf
patt
"%[-0-9]:%s"
(
fun
range
file
->
if
range
=
""
then
raise
(
Invalid_file_spec
(
patt
,
"The first and last node's indexes are missing"
))
else
Scanf
.
sscanf
range
"%d%s"
(
fun
a
s
->
if
(
a
<
0
)
then
raise
(
Invalid_file_spec
(
patt
,
"The first node's index have to be positive or null"
))
else
if
(
s
=
""
)
then
(
a
,
a
,
file
)
else
if
(
s
=
"-"
)
then
(
a
,-
1
,
file
)
else
Scanf
.
sscanf
s
"-%d"
(
fun
b
->
if
(
b
<
a
)
then
raise
(
Invalid_file_spec
(
patt
,
"The last node's index have to be higher than the first node's index"
))
else
(
a
,
b
,
file
)
)
)
)
with
|
Scanf
.
Scan_failure
_
->
raise
(
Invalid_file_spec
(
patt
,
"The boundaries (first and last node's indexes) should be integers, but an non-numerical character has been found"
))
let
parse
argv
=
(
let
save_current
=
!
current
in
let
args
=
make_args
()
in
mkoptab
argv
args
;
try
(
Arg
.
parse_argv
~
current
:
current
argv
args
._
args
(
add_other
args
)
(
usage_msg
argv
.
(
0
));
current
:=
save_current
;
(* Same as List.rev, but also check if there's no option
(starting by '-') in these arguments *)
let
others
=
List
.
fold_left
(
fun
l
o
->
if
String
.
get
o
0
=
'
-
'
then
unexpected
o
else
o
::
l
)
[]
args
._
others
in
(
match
others
with
|
[]
|
[
_
]
->
(
Printf
.
fprintf
stderr
"Error : you need 2 arguments to use %s
\n
"
(
argv
.
(
0
));
flush
stderr
;
print_usage
(
argv
.
(
0
)))
|
l
->
(
let
(
a
,
b
)
=
pop
l
in
let
a
=
try
(
parse_file_spec
a
)
with
Invalid_file_spec
(
fs
,
s
)
->
(
Printf
.
fprintf
stderr
"Error while parsing the file specification
\"
%s
\"
:
\n
"
fs
;
Printf
.
fprintf
stderr
"%s
\n
"
s
;
flush
stderr
;
print_usage
(
argv
.
(
0
))
)
in
args
.
files_spec
<-
a
;
exist_file
b
;
args
.
dot_file
<-
b
let
save_current
=
!
current
in
let
args
=
make_args
()
in
mkoptab
argv
args
;
try
(
Arg
.
parse_argv
~
current
:
current
argv
args
._
args
(
add_other
args
)
(
usage_msg
argv
.
(
0
));
current
:=
save_current
;
(* Same as List.rev, but also check if there's no option
(starting by '-') in these arguments *)
let
others
=
List
.
fold_left
(
fun
l
o
->
if
String
.
get
o
0
=
'
-
'
then
unexpected
o
else
o
::
l
)
[]
args
._
others
in
(
match
others
with
|
[
deco_patt
;
ifile
]
->
(
let
deco_patt_list
=
Str
.
split
(
Str
.
regexp
"[
\t
]+"
)
deco_patt
in
let
fl
=
try
List
.
map
parse_file_spec
(
List
.
rev
deco_patt_list
)
with
Invalid_file_spec
(
fs
,
s
)
->
(
Printf
.
fprintf
stderr
"Error while parsing the file specification
\"
%s
\"
:
\n
"
fs
;
Printf
.
fprintf
stderr
"%s
\n
"
s
;
flush
stderr
;
print_usage
(
argv
.
(
0
))
)
in
args
.
files_spec
<-
fl
;
exist_file
ifile
;
args
.
dot_file
<-
ifile
)
);
args
)
with
|
Arg
.
Bad
msg
->
(
|
_
->
(
Printf
.
fprintf
stderr
"Error: you need 2 arguments to use %s
\n
"
(
argv
.
(
0
));
flush
stderr
;
print_usage
(
argv
.
(
0
)))
);
args
)
with
|
Arg
.
Bad
msg
->
(
Printf
.
fprintf
stderr
"*** Error when calling '%s': %s
\n
%s
\n
"
(
argv
.
(
0
))
(
first_line
msg
)
(
usage_msg
argv
.
(
0
));
exit
2
)
|
Arg
.
Help
_
->
(
|
Arg
.
Help
_
->
(
help
args
argv
.
(
0
)
)
)
)
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