package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=e9aa779e66c08fc763019f16d4706f465d16c05d6400b58fbd0313317ef33ddea51952e2b058db28e65f7ddb7012f328c8bf02d8f1da17bb543348541a2587f0
doc/b0.file/B0_driver/index.html
Module B0_driver
Source
b0 file drivers.
b0 file drivers access the definitions of b0 files. See this manual for an overview and a minimal example.
Commonalities
Drivers
The type for driver main functions. A function that returns a Cmdliner evaluation result. This evaluation result is used by run
to handle program termination. Note that the driver may exit prematurely with Exit.b0_file_error
if there's a fatal error in the b0 file.
The type for drivers.
make ~name ~version
is a new driver named name
which has version version
and uses library libs
to link the b0 file. Note that these libraries are not added during the compilation phase.
Note. The b0 libraries are automatically added to libs
there's no need to mention them. Just mention your driver library and its dependencies in order.
libs d
are the libraries that need to be added for linking.
set d
sets the driver to d
and its main function to main
. Use run
to run the driver.
run ~has_b0_file
runs the driver set by set
. has_b0_file
must be true
if the b0 file is linked in, this is typically done by the b0 file expanded source invocation. Raises Invalid_argument
if no driver is set.
Require the b0 file
val with_b0_file :
driver:t ->
(Conf.t -> B0_std.Os.Exit.t) Cmdliner.Term.t ->
B0_std.Os.Exit.t Cmdliner.Term.t
with_b0_file ~driver cmd
wraps cmd
to make sure it runs with the b0 file compiled and linked in as specified by driver
.
val with_b0_file_if_any :
driver:t ->
(Conf.t -> B0_std.Os.Exit.t) Cmdliner.Term.t ->
B0_std.Os.Exit.t Cmdliner.Term.t
with_b0_file_if_any ~driver cmd
is like with_b0_file
however it doesn't error if the b0 file does not exist or if it fails to compile (a warning is generated in this case). The driver code can use B0_driver.has_b0_file
to see if one is linked and B0_driver.has_failed_b0_file
to check if there was an error in linking it.
has_failed_b0_file ()
is true
for with_b0_file_if_any
when there is a b0 file but it failed to compile.