package ocp-ocamlres

  1. Overview
  2. Docs

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)

module SM : sig ... end
module type Format = sig ... end

The type of format plug-ins

val register_format : SM.key -> (module Format) -> unit

Register a new named format module or override one.

val find_format : SM.key -> (module Format)

Find a format module from its name.

val formats : unit -> (module Format) SM.t

Retrive the currently available formats

module type SubFormat = sig ... end

The type of subformat plug-ins

val register_subformat : SM.key -> (module SubFormat) -> unit

Register a new named subformat module or override one.

val find_subformat : SM.key -> (module SubFormat)

Find a subformat module from its name.

val subformats : unit -> (module SubFormat) SM.t

Retrive the currently available subformats

module Raw : sig ... end
module Int : sig ... end
module Lines : sig ... end
module PredefOptions : sig ... end

Command line options common to OCaml output predefined modules.

module ExtensionDispatcherSubFormat : sig ... end

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.

val disclaimer : string
module OCaml : sig ... end

Instance of the OCaml format

module Res : sig ... end

Instance of the Res format

module Files : sig ... end

Instance of the Files format

OCaml

Innovation. Community. Security.