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
341c4a6e
Commit
341c4a6e
authored
6 years ago
by
erwan
Browse files
Options
Downloads
Patches
Plain Diff
Clean up the algo.mli w.r.t. to possible varT and values
parent
01c51efd
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
bin/process.ml
+3
-1
3 additions, 1 deletion
bin/process.ml
bin/stringOf.ml
+1
-0
1 addition, 0 deletions
bin/stringOf.ml
lib/algo/algo.ml
+7
-3
7 additions, 3 deletions
lib/algo/algo.ml
lib/algo/algo.mli
+14
-13
14 additions, 13 deletions
lib/algo/algo.mli
with
25 additions
and
17 deletions
bin/process.ml
+
3
−
1
View file @
341c4a6e
(* Time-stamp: <modified the 1
0
/03/2019 (at
22
:4
7
) by Erwan Jahier> *)
(* Time-stamp: <modified the 1
1
/03/2019 (at
10
:4
1
) by Erwan Jahier> *)
type
t
=
{
pid
:
string
;
...
...
@@ -33,6 +33,8 @@ let (make: bool -> Topology.node -> t) =
|
Some
(
Algo
.
Bt
)
->
B
(
bool_of_string
x
)
|
Some
(
Algo
.
Ft
)
->
F
(
float_of_string
x
)
|
Some
(
Algo
.
Et
_i
)
->
I
(
int_of_string
x
)
|
Some
(
Algo
.
St
)
->
S
"dummy"
|
None
->
failwith
(
Printf
.
sprintf
"%s is not a variable of program %s"
v
cmxs
)
)
...
...
This diff is collapsed.
Click to expand it.
bin/stringOf.ml
+
1
−
0
View file @
341c4a6e
...
...
@@ -6,6 +6,7 @@ let (algo_varT: Algo.varT -> string) = function
|
Bt
->
"bool"
|
Et
i
->
Printf
.
sprintf
"enum(%d)"
i
|
Nt
->
"Neighbor"
|
St
->
"string"
let
(
algo_vars
:
Algo
.
vars
->
string
)
=
fun
vars
->
String
.
concat
","
(
List
.
map
(
fun
(
n
,
t
)
->
Printf
.
sprintf
"%s:%s"
n
(
algo_varT
t
))
vars
)
...
...
This diff is collapsed.
Click to expand it.
lib/algo/algo.ml
+
7
−
3
View file @
341c4a6e
(* Time-stamp: <modified the 1
0
/03/2019 (at
2
0:4
6
) by Erwan Jahier> *)
(* Time-stamp: <modified the 1
1
/03/2019 (at
1
0:4
0
) by Erwan Jahier> *)
(** Process programmer API *)
type
varT
=
It
|
Nt
|
Ft
|
Bt
|
Et
of
int
type
varT
=
It
|
Ft
|
Bt
|
Et
of
int
|
St
|
Nt
type
action
=
string
(* just a label *)
type
value
=
I
of
int
|
F
of
float
|
B
of
bool
|
S
of
string
|
N
of
int
type
value
=
I
of
int
|
F
of
float
|
B
of
bool
|
E
of
int
|
S
of
string
|
N
of
int
type
local_env
=
string
->
value
type
vars
=
(
string
*
varT
)
list
...
...
@@ -40,11 +40,13 @@ let vart_to_rif_string = function
|
It
->
"int"
|
Ft
->
"real"
|
Bt
->
"bool"
|
St
->
"string"
|
Et
_i
->
"int"
|
Nt
->
"int"
let
value_to_string
=
function
|
I
i
|
E
i
|
N
i
->
string_of_int
i
|
F
f
->
string_of_float
f
|
B
true
->
"t"
...
...
@@ -88,6 +90,8 @@ let (get_init_vars : algo_id -> (string * varT) list -> (neighbor list -> local_
|
Some
(
_
,
Bt
)
->
B
(
Random
.
bool
()
)
|
Some
(
_
,
Ft
)
->
F
(
Random
.
float
max_float
)
|
Some
(
_
,
Et
i
)
->
I
(
Random
.
int
i
)
|
Some
(
_
,
St
)
->
S
"dummy"
)
in
try
...
...
This diff is collapsed.
Click to expand it.
lib/algo/algo.mli
+
14
−
13
View file @
341c4a6e
(* Time-stamp: <modified the 1
0
/03/2019 (at
2
0:
47
) by Erwan Jahier> *)
(* Time-stamp: <modified the 1
1
/03/2019 (at
1
0:
38
) by Erwan Jahier> *)
(** Process programmer API *)
type
value
=
I
of
int
|
F
of
float
|
B
of
bool
|
S
of
string
type
varT
=
It
|
Ft
|
Bt
|
Et
of
int
|
St
|
Nt
type
vars
=
(
string
*
varT
)
list
type
value
=
I
of
int
|
F
of
float
|
B
of
bool
|
E
of
int
|
S
of
string
|
N
of
int
(* neighbor canal number *)
type
local_env
=
string
->
value
type
action
=
string
(* label *)
type
varT
=
It
|
Nt
|
Ft
|
Bt
|
Et
of
int
type
vars
=
(
string
*
varT
)
list
type
neighbor
=
{
lenv
:
local_env
;
...
...
@@ -15,37 +15,38 @@ type neighbor = {
}
type
enable_fun
=
neighbor
list
->
local_env
->
action
list
type
step_fun
=
neighbor
list
->
local_env
->
action
->
local_env
type
step_fun
=
neighbor
list
->
local_env
->
action
->
local_env
(** Those 3 registering functions must be called! *)
type
algo_id
=
string
(* XXX comment s'en passer ??? *)
type
algo_id
=
string
val
reg_vars
:
algo_id
->
vars
->
unit
val
reg_enable
:
algo_id
->
enable_fun
->
unit
val
reg_step
:
algo_id
->
step_fun
->
unit
(** nb: The initialisation done in the dot file have priority over this one *)
(** raised by sasa if one of the function above is not called *)
exception
Unregistred
of
string
*
string
(** This one is not mandatory. The initialisation done in the dot
file have priority over this one. *)
val
reg_init_vars
:
algo_id
->
(
neighbor
list
->
local_env
)
->
unit
(** Mandatory in custom mode only. *)
val
reg_actions
:
algo_id
->
action
list
->
unit
(** util(s) *)
val
value_to_string
:
value
->
string
(**/**)
(** functions below are not part of the API *)
val
vart_to_rif_string
:
varT
->
string
val
verbose_level
:
int
ref
(** raised by get_* functions *)
exception
Unregistred
of
string
*
string
(** the following functions are used by sasa *)
val
get_vars
:
algo_id
->
vars
val
get_enable
:
algo_id
->
enable_fun
val
get_step
:
algo_id
->
step_fun
val
get_init_vars
:
algo_id
->
(
string
*
varT
)
list
->
(
neighbor
list
->
local_env
)
val
get_actions
:
algo_id
->
action
list
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