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
7cd4e469
Commit
7cd4e469
authored
3 years ago
by
David Bühler
Browse files
Options
Downloads
Patches
Plain Diff
[Eva] Removes spaces in empty lines when generating Eva.mli.
parent
e9236e69
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/value/Eva.mli
+76
-77
76 additions, 77 deletions
src/plugins/value/Eva.mli
src/plugins/value/gen-api.sh
+4
-4
4 additions, 4 deletions
src/plugins/value/gen-api.sh
with
80 additions
and
81 deletions
src/plugins/value/Eva.mli
+
76
−
77
View file @
7cd4e469
...
@@ -10,10 +10,10 @@ module Analysis: sig
...
@@ -10,10 +10,10 @@ module Analysis: sig
specified for the entry point using {!Db.Value.fun_set_args}, and
specified for the entry point using {!Db.Value.fun_set_args}, and
an incorrect number of them is given.
an incorrect number of them is given.
@plugin development guide *)
@plugin development guide *)
val
is_computed
:
unit
->
bool
val
is_computed
:
unit
->
bool
(** Return [true] iff the value analysis has been done. *)
(** Return [true] iff the value analysis has been done. *)
val
self
:
State
.
t
val
self
:
State
.
t
(** Internal state of Eva analysis from projects viewpoint. *)
(** Internal state of Eva analysis from projects viewpoint. *)
end
end
...
@@ -24,47 +24,47 @@ module Results: sig
...
@@ -24,47 +24,47 @@ module Results: sig
to change in the future. It aims at replacing [Db.Value] but does not
to change in the future. It aims at replacing [Db.Value] but does not
completely covers all its usages yet. As for now, this interface as some
completely covers all its usages yet. As for now, this interface as some
advantages over Db's :
advantages over Db's :
- evaluations uses every available domains and not only Cvalue ;
- evaluations uses every available domains and not only Cvalue ;
- the caller may distinguish failure cases when a request is unsucessful ;
- the caller may distinguish failure cases when a request is unsucessful ;
- working with callstacks is easy ;
- working with callstacks is easy ;
- some common shortcuts are provided (e.g. for extracting ival directly) ;
- some common shortcuts are provided (e.g. for extracting ival directly) ;
- overall, individual functions are simpler.
- overall, individual functions are simpler.
The idea behind this API is that requests must be decomposed in several
The idea behind this API is that requests must be decomposed in several
steps. For instance, to evaluate an expression :
steps. For instance, to evaluate an expression :
1. first, you have to state where you want to evaluate it,
1. first, you have to state where you want to evaluate it,
2. optionally, you may specify in which callstack,
2. optionally, you may specify in which callstack,
3. you choose the expression to evaluate,
3. you choose the expression to evaluate,
4. you require a destination type to evaluate into.
4. you require a destination type to evaluate into.
Usage sketch :
Usage sketch :
Eva.Results.(
Eva.Results.(
before stmt |> in_callstack cs |>
before stmt |> in_callstack cs |>
eval_var vi |> as_int |> default 0)
eval_var vi |> as_int |> default 0)
or equivalently, if you prefer
or equivalently, if you prefer
Eva.Results.(
Eva.Results.(
default O (as_int (eval_var vi (in_callstack cs (before stmt))))
default O (as_int (eval_var vi (in_callstack cs (before stmt))))
*)
*)
type
callstack
=
(
Cil_types
.
kernel_function
*
Cil_types
.
kinstr
)
list
type
callstack
=
(
Cil_types
.
kernel_function
*
Cil_types
.
kinstr
)
list
type
request
type
request
type
value
type
value
type
address
type
address
type
'
a
evaluation
type
'
a
evaluation
type
error
=
Bottom
|
Top
|
DisabledDomain
type
error
=
Bottom
|
Top
|
DisabledDomain
type
'
a
result
=
(
'
a
,
error
)
Result
.
t
type
'
a
result
=
(
'
a
,
error
)
Result
.
t
(** Results handling *)
(** Results handling *)
(** Translates an error to a human readable string. *)
(** Translates an error to a human readable string. *)
val
string_of_error
:
error
->
string
val
string_of_error
:
error
->
string
(** Pretty printer for errors. *)
(** Pretty printer for errors. *)
...
@@ -72,14 +72,14 @@ module Results: sig
...
@@ -72,14 +72,14 @@ module Results: sig
(** Pretty printer for API's results. *)
(** Pretty printer for API's results. *)
val
pretty_result
:
(
Format
.
formatter
->
'
a
->
unit
)
->
val
pretty_result
:
(
Format
.
formatter
->
'
a
->
unit
)
->
Format
.
formatter
->
'
a
result
->
unit
Format
.
formatter
->
'
a
result
->
unit
(** [default d r] extracts the value of r if r is Ok or use the default value d
(** [default d r] extracts the value of r if r is Ok or use the default value d
otherwise.
otherwise.
Equivalent to [Result.value ~default:d r] *)
Equivalent to [Result.value ~default:d r] *)
val
default
:
'
a
->
'
a
result
->
'
a
val
default
:
'
a
->
'
a
result
->
'
a
(** Control point selection *)
(** Control point selection *)
(** At the begining of the analysis, but after the initialization of globals. *)
(** At the begining of the analysis, but after the initialization of globals. *)
val
at_start
:
request
val
at_start
:
request
(** At the end of the analysis, after the main function has returned. *)
(** At the end of the analysis, after the main function has returned. *)
...
@@ -96,10 +96,10 @@ module Results: sig
...
@@ -96,10 +96,10 @@ module Results: sig
val
before_kinstr
:
Cil_types
.
kinstr
->
request
val
before_kinstr
:
Cil_types
.
kinstr
->
request
(** Just after a statement or at the end of analysis. *)
(** Just after a statement or at the end of analysis. *)
val
after_kinstr
:
Cil_types
.
kinstr
->
request
val
after_kinstr
:
Cil_types
.
kinstr
->
request
(** Callstack selection *)
(** Callstack selection *)
(** Only consider the given callstack. Replaces previous calls to [in_callstack]
(** Only consider the given callstack. Replaces previous calls to [in_callstack]
or [in_callstacks]. *)
or [in_callstacks]. *)
val
in_callstack
:
callstack
->
request
->
request
val
in_callstack
:
callstack
->
request
->
request
...
@@ -110,10 +110,10 @@ module Results: sig
...
@@ -110,10 +110,10 @@ module Results: sig
can be added. If callstacks are also selected with [in_callstack] or
can be added. If callstacks are also selected with [in_callstack] or
[in_callstacks], only the selected callstacks will be filtered. *)
[in_callstacks], only the selected callstacks will be filtered. *)
val
filter_callstack
:
(
callstack
->
bool
)
->
request
->
request
val
filter_callstack
:
(
callstack
->
bool
)
->
request
->
request
(** Working with callstacks *)
(** Working with callstacks *)
(** Retrieves the list of reachable callstacks from the given request. *)
(** Retrieves the list of reachable callstacks from the given request. *)
val
callstacks
:
request
->
callstack
list
val
callstacks
:
request
->
callstack
list
(** Retrieves, a list of subrequest for each reachable callstack from
(** Retrieves, a list of subrequest for each reachable callstack from
...
@@ -123,19 +123,19 @@ module Results: sig
...
@@ -123,19 +123,19 @@ module Results: sig
val
iter_callstacks
:
(
callstack
->
request
->
unit
)
->
request
->
unit
val
iter_callstacks
:
(
callstack
->
request
->
unit
)
->
request
->
unit
(** Fold on the reachable callstacks from the request. *)
(** Fold on the reachable callstacks from the request. *)
val
fold_callstacks
:
(
callstack
->
request
->
'
a
->
'
a
)
->
'
a
->
request
->
'
a
val
fold_callstacks
:
(
callstack
->
request
->
'
a
->
'
a
)
->
'
a
->
request
->
'
a
(** State requests *)
(** State requests *)
(** Returns the list of expressions which have been infered to be equal to
(** Returns the list of expressions which have been infered to be equal to
the given expression by the Equality domain. *)
the given expression by the Equality domain. *)
val
equality_class
:
Cil_types
.
exp
->
request
->
Cil_types
.
exp
list
result
val
equality_class
:
Cil_types
.
exp
->
request
->
Cil_types
.
exp
list
result
(** Returns the Cvalue model. *)
(** Returns the Cvalue model. *)
val
as_cvalue_model
:
request
->
Cvalue
.
Model
.
t
result
val
as_cvalue_model
:
request
->
Cvalue
.
Model
.
t
result
(** Dependencies *)
(** Dependencies *)
(** Computes (an overapproximation of) the zone of each bit that must be read to
(** Computes (an overapproximation of) the zone of each bit that must be read to
evaluate the given expression, including all adresses computations. *)
evaluate the given expression, including all adresses computations. *)
val
expr_deps
:
Cil_types
.
exp
->
request
->
Locations
.
Zone
.
t
val
expr_deps
:
Cil_types
.
exp
->
request
->
Locations
.
Zone
.
t
...
@@ -145,20 +145,20 @@ module Results: sig
...
@@ -145,20 +145,20 @@ module Results: sig
(** Computes (an overapproximation of) the zone of each bit that must be read to
(** Computes (an overapproximation of) the zone of each bit that must be read to
evaluate the given lvalue, excluding the lvalue zone itself. *)
evaluate the given lvalue, excluding the lvalue zone itself. *)
val
address_deps
:
Cil_types
.
lval
->
request
->
Locations
.
Zone
.
t
val
address_deps
:
Cil_types
.
lval
->
request
->
Locations
.
Zone
.
t
(** Evaluation *)
(** Evaluation *)
(** Returns the variable's values infered by the analysis. *)
(** Returns the variable's values infered by the analysis. *)
val
eval_var
:
Cil_types
.
varinfo
->
request
->
value
evaluation
val
eval_var
:
Cil_types
.
varinfo
->
request
->
value
evaluation
(** Returns the lvalue's values infered by the analysis. *)
(** Returns the lvalue's values infered by the analysis. *)
val
eval_lval
:
Cil_types
.
lval
->
request
->
value
evaluation
val
eval_lval
:
Cil_types
.
lval
->
request
->
value
evaluation
(** Returns the expression's values infered by the analysis. *)
(** Returns the expression's values infered by the analysis. *)
val
eval_exp
:
Cil_types
.
exp
->
request
->
value
evaluation
val
eval_exp
:
Cil_types
.
exp
->
request
->
value
evaluation
(** Returns the lvalue's addresses infered by the analysis. *)
(** Returns the lvalue's addresses infered by the analysis. *)
val
eval_address
:
Cil_types
.
lval
->
request
->
address
evaluation
val
eval_address
:
Cil_types
.
lval
->
request
->
address
evaluation
(** Returns the kernel functions into which the given expression may evaluate.
(** Returns the kernel functions into which the given expression may evaluate.
If the callee expression doesn't always evaluate to a function, those
If the callee expression doesn't always evaluate to a function, those
spurious values are ignored. If it always evaluate to a non-function value
spurious values are ignored. If it always evaluate to a non-function value
...
@@ -168,14 +168,14 @@ module Results: sig
...
@@ -168,14 +168,14 @@ module Results: sig
Also see [callee] for a function which applies directly on Call
Also see [callee] for a function which applies directly on Call
statements. *)
statements. *)
val
eval_callee
:
Cil_types
.
exp
->
request
->
Kernel_function
.
t
list
result
val
eval_callee
:
Cil_types
.
exp
->
request
->
Kernel_function
.
t
list
result
(** Evaluated values conversion *)
(** Evaluated values conversion *)
(** In all the functions below, if Eva's infered value does not fit in the
(** In all the functions below, if Eva's infered value does not fit in the
required type, [Error Top] is returned, as Top is the only possible
required type, [Error Top] is returned, as Top is the only possible
over-approximation of the request. *)
over-approximation of the request. *)
(** Convert into a singleton ocaml int *)
(** Convert into a singleton ocaml int *)
val
as_int
:
value
evaluation
->
int
result
val
as_int
:
value
evaluation
->
int
result
(** Convert into a singleton unbounded integer *)
(** Convert into a singleton unbounded integer *)
...
@@ -188,26 +188,26 @@ module Results: sig
...
@@ -188,26 +188,26 @@ module Results: sig
val
as_fval
:
value
evaluation
->
Fval
.
t
result
val
as_fval
:
value
evaluation
->
Fval
.
t
result
(** Convert into a C value abstraction *)
(** Convert into a C value abstraction *)
val
as_cvalue
:
value
evaluation
->
Cvalue
.
V
.
t
result
val
as_cvalue
:
value
evaluation
->
Cvalue
.
V
.
t
result
(** Convert into a C location abstraction *)
(** Convert into a C location abstraction *)
val
as_location
:
address
evaluation
->
Locations
.
location
result
val
as_location
:
address
evaluation
->
Locations
.
location
result
(** Convert into a Zone *)
(** Convert into a Zone *)
val
as_zone
:
?
access
:
Locations
.
access
->
address
evaluation
->
val
as_zone
:
?
access
:
Locations
.
access
->
address
evaluation
->
Locations
.
Zone
.
t
result
Locations
.
Zone
.
t
result
(** Evaluation properties *)
(** Evaluation properties *)
(** Returns whether the evaluated value is initialized or not. If the value have
(** Returns whether the evaluated value is initialized or not. If the value have
been evaluated from a Cil expression, it is always considered initialized.
been evaluated from a Cil expression, it is always considered initialized.
*)
*)
val
is_initialized
:
value
evaluation
->
bool
val
is_initialized
:
value
evaluation
->
bool
(** Returns the set of alarms emitted during the evaluation. *)
(** Returns the set of alarms emitted during the evaluation. *)
val
alarms
:
'
a
evaluation
->
Alarms
.
t
list
val
alarms
:
'
a
evaluation
->
Alarms
.
t
list
(** Reachability *)
(** Reachability *)
(** Returns true if there are no reachable states for the given request. *)
(** Returns true if there are no reachable states for the given request. *)
val
is_empty
:
request
->
bool
val
is_empty
:
request
->
bool
(** Returns true if an evaluation ended to bottom, i.e. if the given expression
(** Returns true if an evaluation ended to bottom, i.e. if the given expression
...
@@ -220,17 +220,17 @@ module Results: sig
...
@@ -220,17 +220,17 @@ module Results: sig
(** Returns true if a statement have been reached by the analysis, or if
(** Returns true if a statement have been reached by the analysis, or if
the main function have been analyzed for [Kglobal]. *)
the main function have been analyzed for [Kglobal]. *)
val
is_reachable_kinstr
:
Cil_types
.
kinstr
->
bool
val
is_reachable_kinstr
:
Cil_types
.
kinstr
->
bool
(*** Callers / Callees / Callsites *)
(*** Callers / Callees / Callsites *)
(** Returns the list of infered callers of the given function. *)
(** Returns the list of infered callers of the given function. *)
val
callers
:
Cil_types
.
kernel_function
->
Cil_types
.
kernel_function
list
val
callers
:
Cil_types
.
kernel_function
->
Cil_types
.
kernel_function
list
(** Returns the list of infered callers, and for each of them, the list
(** Returns the list of infered callers, and for each of them, the list
of callsites (the call statements) inside. *)
of callsites (the call statements) inside. *)
val
callsites
:
Cil_types
.
kernel_function
->
val
callsites
:
Cil_types
.
kernel_function
->
(
Cil_types
.
kernel_function
*
Cil_types
.
stmt
list
)
list
(
Cil_types
.
kernel_function
*
Cil_types
.
stmt
list
)
list
(** Returns the kernel functions called in the given statement.
(** Returns the kernel functions called in the given statement.
If the callee expression doesn't always evaluate to a function, those
If the callee expression doesn't always evaluate to a function, those
spurious values are ignored. If it always evaluate to a non-function value
spurious values are ignored. If it always evaluate to a non-function value
...
@@ -238,12 +238,12 @@ module Results: sig
...
@@ -238,12 +238,12 @@ module Results: sig
Raises [Stdlib.Invalid_argument] if the statement is not a [Call]
Raises [Stdlib.Invalid_argument] if the statement is not a [Call]
instruction or a [Local_init] with [ConsInit] initializer. *)
instruction or a [Local_init] with [ConsInit] initializer. *)
val
callee
:
Cil_types
.
stmt
->
Kernel_function
.
t
list
val
callee
:
Cil_types
.
stmt
->
Kernel_function
.
t
list
end
end
module
Value_results
:
sig
module
Value_results
:
sig
type
results
type
results
val
get_results
:
unit
->
results
val
get_results
:
unit
->
results
val
set_results
:
results
->
unit
val
set_results
:
results
->
unit
val
merge
:
results
->
results
->
results
val
merge
:
results
->
results
->
results
...
@@ -257,12 +257,12 @@ end
...
@@ -257,12 +257,12 @@ end
module
Value_parameters
:
sig
module
Value_parameters
:
sig
(** Returns the list (name, descr) of currently enabled abstract domains. *)
(** Returns the list (name, descr) of currently enabled abstract domains. *)
val
enabled_domains
:
unit
->
(
string
*
string
)
list
val
enabled_domains
:
unit
->
(
string
*
string
)
list
(** [use_builtin kf name] instructs the analysis to use the builtin [name]
(** [use_builtin kf name] instructs the analysis to use the builtin [name]
to interpret calls to function [kf].
to interpret calls to function [kf].
Raises [Not_found] if there is no builtin of name [name]. *)
Raises [Not_found] if there is no builtin of name [name]. *)
val
use_builtin
:
Cil_types
.
kernel_function
->
string
->
unit
val
use_builtin
:
Cil_types
.
kernel_function
->
string
->
unit
(** [use_global_value_partitioning vi] instructs the analysis to use
(** [use_global_value_partitioning vi] instructs the analysis to use
value partitioning on the global variable [vi]. *)
value partitioning on the global variable [vi]. *)
val
use_global_value_partitioning
:
Cil_types
.
varinfo
->
unit
val
use_global_value_partitioning
:
Cil_types
.
varinfo
->
unit
...
@@ -270,7 +270,7 @@ end
...
@@ -270,7 +270,7 @@ end
module
Eval_terms
:
sig
module
Eval_terms
:
sig
type
labels_states
=
Cvalue
.
Model
.
t
Cil_datatype
.
Logic_label
.
Map
.
t
type
labels_states
=
Cvalue
.
Model
.
t
Cil_datatype
.
Logic_label
.
Map
.
t
(** Evaluation environment. Currently available are function Pre and Post, or
(** Evaluation environment. Currently available are function Pre and Post, or
the environment to evaluate an annotation *)
the environment to evaluate an annotation *)
type
eval_env
type
eval_env
...
@@ -288,7 +288,7 @@ end
...
@@ -288,7 +288,7 @@ end
module
Unit_tests
:
sig
module
Unit_tests
:
sig
(** Currently tested by this module:
(** Currently tested by this module:
- semantics of sign values. *)
- semantics of sign values. *)
(** Runs some programmatic tests on Eva. *)
(** Runs some programmatic tests on Eva. *)
val
run
:
unit
->
unit
val
run
:
unit
->
unit
end
end
...
@@ -296,47 +296,47 @@ end
...
@@ -296,47 +296,47 @@ end
module
Eva_annotations
:
sig
module
Eva_annotations
:
sig
(** Register special annotations to locally guide the partitioning of states
(** Register special annotations to locally guide the partitioning of states
performed by an Eva analysis:
performed by an Eva analysis:
- slevel annotations: "slevel default", "slevel merge" and "slevel i"
- slevel annotations: "slevel default", "slevel merge" and "slevel i"
- loop unroll annotations: "loop unroll term"
- loop unroll annotations: "loop unroll term"
- value partitioning annotations: "split term" and "merge term"
- value partitioning annotations: "split term" and "merge term"
- subdivision annotations: "subdivide i"
- subdivision annotations: "subdivide i"
Widen hints annotations are still registered in !{widen_hints_ext.ml}. *)
Widen hints annotations are still registered in !{widen_hints_ext.ml}. *)
(** Annotations tweaking the behavior of the -eva-slevel paramter. *)
(** Annotations tweaking the behavior of the -eva-slevel paramter. *)
type
slevel_annotation
=
type
slevel_annotation
=
|
SlevelMerge
(** Join all states separated by slevel. *)
|
SlevelMerge
(** Join all states separated by slevel. *)
|
SlevelDefault
(** Use the limit defined by -eva-slevel. *)
|
SlevelDefault
(** Use the limit defined by -eva-slevel. *)
|
SlevelLocal
of
int
(** Use the given limit instead of -eva-slevel. *)
|
SlevelLocal
of
int
(** Use the given limit instead of -eva-slevel. *)
|
SlevelFull
(** Remove the limit of number of separated states. *)
|
SlevelFull
(** Remove the limit of number of separated states. *)
(** Loop unroll annotations. *)
(** Loop unroll annotations. *)
type
unroll_annotation
=
type
unroll_annotation
=
|
UnrollAmount
of
Cil_types
.
term
(** Unroll the n first iterations. *)
|
UnrollAmount
of
Cil_types
.
term
(** Unroll the n first iterations. *)
|
UnrollFull
(** Unroll amount defined by -eva-default-loop-unroll. *)
|
UnrollFull
(** Unroll amount defined by -eva-default-loop-unroll. *)
type
split_kind
=
Static
|
Dynamic
type
split_kind
=
Static
|
Dynamic
type
split_term
=
type
split_term
=
|
Expression
of
Cil_types
.
exp
|
Expression
of
Cil_types
.
exp
|
Predicate
of
Cil_types
.
predicate
|
Predicate
of
Cil_types
.
predicate
(** Split/merge annotations for value partitioning. *)
(** Split/merge annotations for value partitioning. *)
type
flow_annotation
=
type
flow_annotation
=
|
FlowSplit
of
split_term
*
split_kind
|
FlowSplit
of
split_term
*
split_kind
(** Split states according to a term. *)
(** Split states according to a term. *)
|
FlowMerge
of
split_term
|
FlowMerge
of
split_term
(** Merge states separated by a previous split. *)
(** Merge states separated by a previous split. *)
type
allocation_kind
=
By_stack
|
Fresh
|
Fresh_weak
|
Imprecise
type
allocation_kind
=
By_stack
|
Fresh
|
Fresh_weak
|
Imprecise
val
get_slevel_annot
:
Cil_types
.
stmt
->
slevel_annotation
option
val
get_slevel_annot
:
Cil_types
.
stmt
->
slevel_annotation
option
val
get_unroll_annot
:
Cil_types
.
stmt
->
unroll_annotation
list
val
get_unroll_annot
:
Cil_types
.
stmt
->
unroll_annotation
list
val
get_flow_annot
:
Cil_types
.
stmt
->
flow_annotation
list
val
get_flow_annot
:
Cil_types
.
stmt
->
flow_annotation
list
val
get_subdivision_annot
:
Cil_types
.
stmt
->
int
list
val
get_subdivision_annot
:
Cil_types
.
stmt
->
int
list
val
get_allocation
:
Cil_types
.
stmt
->
allocation_kind
val
get_allocation
:
Cil_types
.
stmt
->
allocation_kind
val
add_slevel_annot
:
emitter
:
Emitter
.
t
->
val
add_slevel_annot
:
emitter
:
Emitter
.
t
->
Cil_types
.
stmt
->
slevel_annotation
->
unit
Cil_types
.
stmt
->
slevel_annotation
->
unit
val
add_unroll_annot
:
emitter
:
Emitter
.
t
->
val
add_unroll_annot
:
emitter
:
Emitter
.
t
->
...
@@ -361,18 +361,18 @@ end
...
@@ -361,18 +361,18 @@ end
module
Builtins
:
sig
module
Builtins
:
sig
(** Eva analysis builtins for the cvalue domain, more efficient than their
(** Eva analysis builtins for the cvalue domain, more efficient than their
equivalent in C. *)
equivalent in C. *)
open
Cil_types
open
Cil_types
exception
Invalid_nb_of_args
of
int
exception
Invalid_nb_of_args
of
int
exception
Outside_builtin_possibilities
exception
Outside_builtin_possibilities
(* Signature of a builtin: type of the result, and type of the arguments. *)
(* Signature of a builtin: type of the result, and type of the arguments. *)
type
builtin_type
=
unit
->
typ
*
typ
list
type
builtin_type
=
unit
->
typ
*
typ
list
(** Can the results of a builtin be cached? See {eval.mli} for more details.*)
(** Can the results of a builtin be cached? See {eval.mli} for more details.*)
type
cacheable
=
Eval
.
cacheable
=
Cacheable
|
NoCache
|
NoCacheCallers
type
cacheable
=
Eval
.
cacheable
=
Cacheable
|
NoCache
|
NoCacheCallers
type
full_result
=
{
type
full_result
=
{
c_values
:
(
Cvalue
.
V
.
t
option
*
Cvalue
.
Model
.
t
)
list
;
c_values
:
(
Cvalue
.
V
.
t
option
*
Cvalue
.
Model
.
t
)
list
;
(** A list of results, consisting of:
(** A list of results, consisting of:
...
@@ -385,7 +385,7 @@ module Builtins: sig
...
@@ -385,7 +385,7 @@ module Builtins: sig
(** If not None, the froms of the function, and its sure outputs;
(** If not None, the froms of the function, and its sure outputs;
i.e. the dependencies of the result and of each zone written to. *)
i.e. the dependencies of the result and of each zone written to. *)
}
}
(** The result of a builtin can be given in different forms. *)
(** The result of a builtin can be given in different forms. *)
type
call_result
=
type
call_result
=
|
States
of
Cvalue
.
Model
.
t
list
|
States
of
Cvalue
.
Model
.
t
list
...
@@ -399,12 +399,12 @@ module Builtins: sig
...
@@ -399,12 +399,12 @@ module Builtins: sig
computed by the builtin. *)
computed by the builtin. *)
|
Full
of
full_result
|
Full
of
full_result
(** See [full_result] type. *)
(** See [full_result] type. *)
(** Type of a cvalue builtin, whose arguments are:
(** Type of a cvalue builtin, whose arguments are:
- the memory state at the beginning of the function call;
- the memory state at the beginning of the function call;
- the list of arguments of the function call. *)
- the list of arguments of the function call. *)
type
builtin
=
Cvalue
.
Model
.
t
->
(
exp
*
Cvalue
.
V
.
t
)
list
->
call_result
type
builtin
=
Cvalue
.
Model
.
t
->
(
exp
*
Cvalue
.
V
.
t
)
list
->
call_result
(** [register_builtin name ?replace ?typ cacheable f] registers the function [f]
(** [register_builtin name ?replace ?typ cacheable f] registers the function [f]
as a builtin to be used instead of the C function of name [name].
as a builtin to be used instead of the C function of name [name].
If [replace] is provided, the builtin is also used instead of the C function
If [replace] is provided, the builtin is also used instead of the C function
...
@@ -414,8 +414,7 @@ module Builtins: sig
...
@@ -414,8 +414,7 @@ module Builtins: sig
The results of the builtin are cached according to [cacheable]. *)
The results of the builtin are cached according to [cacheable]. *)
val
register_builtin
:
val
register_builtin
:
string
->
?
replace
:
string
->
?
typ
:
builtin_type
->
cacheable
->
builtin
->
unit
string
->
?
replace
:
string
->
?
typ
:
builtin_type
->
cacheable
->
builtin
->
unit
(** Has a builtin been registered with the given name? *)
(** Has a builtin been registered with the given name? *)
val
is_builtin
:
string
->
bool
val
is_builtin
:
string
->
bool
end
end
This diff is collapsed.
Click to expand it.
src/plugins/value/gen-api.sh
+
4
−
4
View file @
7cd4e469
#!/bin/bash -eu
#!/bin/bash -eu
printf
'(* This file is generated. Do not edit. *)\n
\n
'
printf
'(* This file is generated. Do not edit. *)\n'
for
i
in
"
$@
"
for
i
in
"
$@
"
do
do
file
=
$(
basename
$i
)
file
=
$(
basename
$i
)
module
=
${
file
%.*
}
module
=
${
file
%.*
}
printf
'module %s: sig\n'
${
module
^
}
printf
'
\n
module %s: sig\n'
${
module
^
}
awk
'/\[@@@ api_start\]/{flag=1;next} /\[@@@ api_end\]/{flag=0} flag{ print " "
,
$0 }'
$i
awk
'/\[@@@ api_start\]/{flag=1;next} /\[@@@ api_end\]/{flag=0} flag{ print
(NF ?
"
"
:"")
$0 }'
$i
printf
'end\n
\n
'
printf
'end\n'
done
done
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