package ocp-ocamlres
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=658c2990e027e1e43a16290fd431f08c96b8630d91ac2b98003a9bc027179679
md5=725eb557e659c6febf8dc3044b323bd8
doc/ocplib-ocamlres/OCamlResRegistry/index.html
Module OCamlResRegistry
Source
Registration of (sub)formats for use from the command line
This file implements the interface between OCaml defintions of Format and SubFormat module instances and the command line interface of ocp-ocamlres.
Basically, it consists in pre-instanciating the formats:
- with string valued resource trees as input where the strings are the raw contents as extracted from the files
- with a proxy subformat, performing a dynamic dispatch of the subformat depending on file extensions
To associate the extensions with the subformats, it maintains an assiciative table to link the command line name of the subformat to the OCaml implementation (as a packed module).
Same is done with the main format names, and both tables can be extended to the tool can be extended from outside this module (by recompiling it with / dynlinking a module performing a (sub)format registration at toplevel)
Formats registry
The type of format plug-ins. Differs from OCamlResFormats.Format
since it is dedicated to be used by the command line tool. For this, the parameters are provided not as a data type but as a list of command line args that can mutate global references, which can then be read from the output function. This is because parameters come from the user, not the programmer. Also, the tool is dedicated to use with the filesystem, so the type of data is fixed to strings representing the raw encoding of data.
Register a new named format module or override one.
Find a format module from its name. May throw Not_found
.
Retrive the currently available formats
SubFormats registry
Register a new named subformat module or override one.
Find a subformat module from its name. May throw Not_found
.
Retrive the currently available subformats
Predefined Subformats
Predefined Formats
Predefined options that you can use in your own formats
Output subformat dispatching the output depending on file extensions and the command line options. To be polymorphic, the t
type is a string containing the raw resource representation, and the from_raw
method of the selected subformat is used at every operation. The SubFormat
used is resolved using table PredefOptions.subformats
.
Disclaimer that you can use in your own formats