package ogre

  1. Overview
  2. Docs

An Ogre document.

A concrete representation of a database.

type t = doc
val compare : t -> t -> int
val empty : doc

empty creates an empty document

val merge : doc -> doc -> doc Core_kernel.Or_error.t

merge d1 d2 merges two documents in one. Returns an error, if documents contain inconsistent declarations.

val load : Core_kernel.In_channel.t -> doc Core_kernel.Or_error.t

load chan loads a document from a channel, returns an error if a document is not well-formed, raises an exception if a system error has occurred.

val save : doc -> Core_kernel.Out_channel.t -> unit

save doc out stores the document in a channel. Raises an exception in case of a system error.

val from_file : string -> doc Core_kernel.Or_error.t

from_file name reads a document from a file with the given name, returns an error, if a document is not well-formed, raises an exception if a system error has occurred.

val from_string : string -> doc Core_kernel.Or_error.t

from_string data parses document from data. Returns an error if a document is not well-formed.

val to_string : doc -> string

to_string doc returns a textual representation of a document

val to_file : doc -> string -> unit

to_file doc name stores a document to a file with the given name.

val pp : Stdlib.Format.formatter -> doc -> unit

pp ppf doc prints a doc in the specified formatter ppf

val clear : doc -> doc

clear doc removes all facts from the document.

Useful for extracting scheme from a document.

val declarations : doc -> int

declarations doc returns a number of declarations in the document

val definitions : doc -> int

definitions doc returns a number of facts, defined in the document.

OCaml

Innovation. Community. Security.