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
90084ad4
Commit
90084ad4
authored
1 month ago
by
Valentin Perrelle
Committed by
Virgile Prevosto
1 month ago
Browse files
Options
Downloads
Patches
Plain Diff
[kernel] datatype: add Make_with_set_and_map and Make_with_hashtbl
parent
7e3623cb
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/libraries/datatype/datatype.ml
+34
-1
34 additions, 1 deletion
src/libraries/datatype/datatype.ml
src/libraries/datatype/datatype.mli
+44
-0
44 additions, 0 deletions
src/libraries/datatype/datatype.mli
with
78 additions
and
1 deletion
src/libraries/datatype/datatype.ml
+
34
−
1
View file @
90084ad4
...
...
@@ -265,6 +265,17 @@ module type Hashtbl = sig
module
Make
(
Data
:
S
)
:
S
with
type
t
=
Data
.
t
t
end
module
type
S_with_set_and_map
=
sig
include
S
module
Set
:
Set
with
type
elt
=
t
module
Map
:
Map
with
type
key
=
t
end
module
type
S_with_hashtbl
=
sig
include
S
module
Hashtbl
:
Hashtbl
with
type
key
=
t
end
module
type
S_with_collections
=
sig
include
S
module
Set
:
Set
with
type
elt
=
t
...
...
@@ -1459,7 +1470,7 @@ end
(** {2 Simple type values} *)
(* ****************************************************************************)
module
With_
collections
(
X
:
S
)(
Info
:
Functor_info
)
=
struct
module
With_
set_and_map
(
X
:
S
)(
Info
:
Functor_info
)
=
struct
module
D
=
X
include
D
...
...
@@ -1476,6 +1487,18 @@ module With_collections(X: S)(Info: Functor_info) = struct
(
D
)
(
struct
let
module_name
=
Info
.
module_name
^
".Map"
end
)
end
module
Make_with_set_and_map
(
X
:
Make_input
)
=
With_set_and_map
(
Make
(
X
))
(
struct
let
module_name
=
String
.
capitalize_ascii
X
.
name
end
)
module
With_hashtbl
(
X
:
S
)(
Info
:
Functor_info
)
=
struct
module
D
=
X
include
D
module
Hashtbl
=
Hashtbl
(
struct
...
...
@@ -1503,6 +1526,16 @@ module With_collections(X: S)(Info: Functor_info) = struct
end
module
Make_with_hashtbl
(
X
:
Make_input
)
=
With_hashtbl
(
Make
(
X
))
(
struct
let
module_name
=
String
.
capitalize_ascii
X
.
name
end
)
module
With_collections
(
X
:
S
)(
Info
:
Functor_info
)
=
struct
include
(
With_set_and_map
(
X
)(
Info
)
:
S_with_set_and_map
with
type
t
=
X
.
t
)
include
(
With_hashtbl
(
X
)(
Info
)
:
S_with_hashtbl
with
type
t
:=
X
.
t
)
end
module
Make_with_collections
(
X
:
Make_input
)
=
With_collections
(
Make
(
X
))
...
...
This diff is collapsed.
Click to expand it.
src/libraries/datatype/datatype.mli
+
44
−
0
View file @
90084ad4
...
...
@@ -267,6 +267,28 @@ module type Hashtbl = sig
end
(** A datatype for a type [t] extended with predefined hashtbl over [t].
@see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf>
*)
module
type
S_with_hashtbl
=
sig
include
S
module
Hashtbl
:
Hashtbl
with
type
key
=
t
(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> *)
end
(** A datatype for a type [t] extended with predefined set and map over [t].
@see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf>
*)
module
type
S_with_set_and_map
=
sig
include
S
module
Set
:
Set
with
type
elt
=
t
(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> *)
module
Map
:
Map
with
type
key
=
t
end
(** A datatype for a type [t] extended with predefined set, map and hashtbl
over [t].
...
...
@@ -282,6 +304,28 @@ module type S_with_collections = sig
(** @see <https://frama-c.com/download/frama-c-plugin-development-guide.pdf> *)
end
(** Generic comparable datatype builder: functions [equal] and [compare] must
not be {!undefined}. *)
module
Make_with_set_and_map
(
X
:
Make_input
)
:
S_with_set_and_map
with
type
t
=
X
.
t
(** Add sets and maps to an existing datatype, provided the [equal] and
[compare] are not {!undefined}.
@since Oxygen-20120901 *)
module
With_set_and_map
(
X
:
S
)(
_
:
Functor_info
)
:
S_with_set_and_map
with
type
t
=
X
.
t
(** Generic comparable datatype builder: functions [equal] and [hash] must not
be {!undefined}. *)
module
Make_with_hashtbl
(
X
:
Make_input
)
:
S_with_hashtbl
with
type
t
=
X
.
t
(** Add hashtables modules to an existing datatype, provided the [equal] and
[hash] functions are not {!undefined}.
@since Oxygen-20120901 *)
module
With_hashtbl
(
X
:
S
)(
_
:
Functor_info
)
:
S_with_hashtbl
with
type
t
=
X
.
t
(** Generic comparable datatype builder: functions [equal], [compare] and
[hash] must not be {!undefined}. *)
module
Make_with_collections
(
X
:
Make_input
)
:
...
...
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