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
sasa
Commits
4d6f889f
Commit
4d6f889f
authored
May 09, 2019
by
erwan
Browse files
rdbg: save/restore the sasa state between each step to allow backward moves.
parent
35aa3bc2
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/algo/algo.ml
View file @
4d6f889f
(* Time-stamp: <modified the 0
3
/0
4
/2019 (at
23:02
) by Erwan Jahier> *)
(* Time-stamp: <modified the 0
7
/0
5
/2019 (at
17:50
) by Erwan Jahier> *)
(** Process programmer API *)
type
varT
=
It
|
Ft
|
Bt
|
Et
of
int
|
St
|
Nt
|
At
of
varT
*
int
...
...
@@ -18,20 +18,20 @@ type neighbor = {
type
enable_fun
=
neighbor
list
->
local_env
->
action
list
type
step_fun
=
neighbor
list
->
local_env
->
action
->
local_env
type
int_tables
=
{
vars
:
(
string
,
vars
)
Hashtbl
.
t
;
init_vars
:
(
string
,
neighbor
list
->
local_env
)
Hashtbl
.
t
;
enable
:
(
string
,
enable_fun
)
Hashtbl
.
t
;
step
:
(
string
,
step_fun
)
Hashtbl
.
t
;
actions
:
(
string
,
action
list
)
Hashtbl
.
t
;
type
int
ernal
_tables
=
{
vars
:
(
string
,
vars
)
Hashtbl
.
t
;
init_vars
:
(
string
,
neighbor
list
->
local_env
)
Hashtbl
.
t
;
enable
:
(
string
,
enable_fun
)
Hashtbl
.
t
;
step
:
(
string
,
step_fun
)
Hashtbl
.
t
;
actions
:
(
string
,
action
list
)
Hashtbl
.
t
;
}
let
tbls
=
{
vars
=
Hashtbl
.
create
1
;
vars
=
Hashtbl
.
create
1
;
init_vars
=
Hashtbl
.
create
1
;
enable
=
Hashtbl
.
create
1
;
step
=
Hashtbl
.
create
1
;
actions
=
Hashtbl
.
create
1
;
enable
=
Hashtbl
.
create
1
;
step
=
Hashtbl
.
create
1
;
actions
=
Hashtbl
.
create
1
;
}
let
verbose_level
=
ref
0
...
...
@@ -118,11 +118,14 @@ let rec (init_var: neighbor list -> varT -> value) =
|
At
(
t
,
i
)
->
A
(
Array
.
make
i
(
init_var
nl
t
))
let
(
reg_init_vars
:
algo_id
->
(
neighbor
list
->
local_env
)
->
unit
)
=
fun
algo_id
x
->
if
!
verbose_level
>
0
then
Printf
.
printf
"Registering %s init_vars
\n
"
algo_id
;
flush
stdout
;
Hashtbl
.
replace
tbls
.
init_vars
algo_id
x
let
(
get_init_vars
:
algo_id
->
(
string
*
varT
)
list
->
(
neighbor
list
->
local_env
))
=
let
(
reg_init_vars
:
algo_id
->
(
neighbor
list
->
local_env
)
->
unit
)
=
fun
algo_id
x
->
if
!
verbose_level
>
0
then
Printf
.
printf
"Registering %s init_vars
\n
"
algo_id
;
flush
stdout
;
Hashtbl
.
replace
tbls
.
init_vars
algo_id
x
let
(
get_init_vars
:
algo_id
->
(
string
*
varT
)
list
->
(
neighbor
list
->
local_env
))
=
fun
algo_id
vars
->
let
default_env
=
(
fun
nl
v
->
...
...
@@ -137,7 +140,8 @@ let (get_init_vars : algo_id -> (string * varT) list -> (neighbor list -> local_
try
user_env
nl
v
with
e
->
if
!
verbose_level
>
1
then
Printf
.
eprintf
"No init value for '%s' in user init function (%s).
\n
"
v
Printf
.
eprintf
"No init value for '%s' in user init function (%s).
\n
"
v
(
Printexc
.
to_string
e
);
default_env
nl
v
)
with
Not_found
->
...
...
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