Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
pub
frama-c
Commits
41342b9b
Commit
41342b9b
authored
1 year ago
by
Loïc Correnson
Committed by
Allan Blanchard
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
[server] on-demand signal registry
parent
903c9cda
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/server/states.ml
+22
-20
22 additions, 20 deletions
src/plugins/server/states.ml
src/plugins/server/states.mli
+4
-0
4 additions, 0 deletions
src/plugins/server/states.mli
with
26 additions
and
20 deletions
src/plugins/server/states.ml
+
22
−
20
View file @
41342b9b
...
...
@@ -22,23 +22,25 @@
open
Data
(* -------------------------------------------------------------------------- *)
(* --- Hooks --- *)
(* -------------------------------------------------------------------------- *)
type
'
a
callback
=
(
'
a
->
unit
)
->
unit
let
install
signal
hook
=
function
|
None
->
()
|
Some
add_hook
->
let
once
=
ref
true
in
let
install
ok
=
if
ok
&&
!
once
then
begin
once
:=
false
;
add_hook
hook
;
Request
.
emit
signal
;
end
in
Request
.
on_signal
signal
install
let
install_emit
signal
add_hook
=
install
signal
(
fun
_
->
Request
.
emit
signal
)
add_hook
let
install_hook
signal
hook
add_hook
=
let
once
=
ref
true
in
let
install
ok
=
if
ok
&&
!
once
then
begin
once
:=
false
;
add_hook
hook
;
Request
.
emit
signal
;
end
in
Request
.
on_signal
signal
install
let
register_hook
signal
add_hook
=
install_hook
signal
(
fun
()
->
Request
.
emit
signal
)
add_hook
(* -------------------------------------------------------------------------- *)
(* --- Values --- *)
...
...
@@ -60,7 +62,7 @@ let register_value (type a) ~package ~name ~descr
~
package
~
name
:
(
Package
.
Derived
.
getter
id
)
.
name
~
descr
:
(
plain
"Getter for state"
@
href
)
~
kind
:
`GET
~
input
:
(
module
Junit
)
~
output
get
in
install_emit
signal
add_hook
;
Option
.
iter
(
register_hook
signal
)
add_hook
;
signal
(* -------------------------------------------------------------------------- *)
...
...
@@ -86,7 +88,7 @@ let register_state (type a) ~package ~name ~descr
~
package
~
name
:
(
Package
.
Derived
.
setter
id
)
.
name
~
descr
:
(
plain
"Setter for state"
@
href
)
~
kind
:
`SET
~
input
:
(
module
D
)
~
output
:
(
module
Junit
)
set
in
install_emit
signal
add_hook
;
Option
.
iter
(
register_hook
signal
)
add_hook
;
signal
(* -------------------------------------------------------------------------- *)
...
...
@@ -382,9 +384,9 @@ let register_array ~package ~name ~descr ~key
~
kind
:
`GET
~
input
:
(
module
Junit
)
~
output
:
(
module
Junit
)
(
fun
()
->
reload
array
)
;
synchronize
array
;
install
signal
(
update
array
)
add_update_hook
;
install
signal
(
remove
array
)
add_remove_hook
;
install
signal
(
fun
()
->
reload
array
)
add_reload_hook
;
Option
.
iter
(
install
_hook
signal
(
update
array
)
)
add_update_hook
;
Option
.
iter
(
install
_hook
signal
(
remove
array
)
)
add_remove_hook
;
Option
.
iter
(
install
_hook
signal
(
fun
()
->
reload
array
)
)
add_reload_hook
;
array
(* -------------------------------------------------------------------------- *)
This diff is collapsed.
Click to expand it.
src/plugins/server/states.mli
+
4
−
0
View file @
41342b9b
...
...
@@ -26,6 +26,10 @@ open Package
type
'
a
callback
=
(
'
a
->
unit
)
->
unit
(** Connect a hook registry to a signal. As soon as the signal is being
traced, a hook to emit the signal is registered. *)
val
register_hook
:
Request
.
signal
->
'
a
callback
->
unit
(** Register a (projectified) value and generates the associated signal and
request:
- Signal [<name>.sig] is emitted on value updates;
...
...
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