package cudf

  1. Overview
  2. Docs
CUDF library (part of the Mancoosi tools)

Install

Dune Dependency

Authors

Maintainers

Sources

cudf-v0.10.tar.gz
md5=ed8fea314d0c6dc0d8811ccf860c53dd
sha512=ed74ce3e9d91449fd295caa7c6b166593578aaa6b8d79834141ba7fdf49d30796aba03a86d766c0c23e875a8318dbb797e7eae6e14fb63a0b94130c590af107e

doc/cudf/Cudf_types/index.html

Module Cudf_typesSource

CUDF type library

Implement core CUDF types (see CUDF spec. §2.2.2).

For parsing and pretty printing of CUDF types see Cudf_types_pp.

CUDF types
Sourcetype version = int
Sourcetype relop = [
  1. | `Eq
  2. | `Neq
  3. | `Geq
  4. | `Gt
  5. | `Leq
  6. | `Lt
]
Sourcetype constr = (relop * version) option
CUDF spec. types
Sourcetype pkgname = string
Sourcetype vpkg = pkgname * constr
Sourcetype vpkglist = vpkg list
Sourcetype enum_keep = [
  1. | `Keep_version
  2. | `Keep_package
  3. | `Keep_feature
  4. | `Keep_none
]
Sourcetype vpkgformula = vpkg list list

CNF formula. Inner lists are OR-ed, outer AND-ed. E.g.:

  • "Depends: foo, baz | baz" --> [ foo ] ; [ bar ; baz ]
  • "Depends: true!" -->
  • "Depends: false!" --> []
Sourcetype veqpkg = pkgname * ([ `Eq ] * version) option
Sourcetype veqpkglist = veqpkg list
Sourcetype typ = [
  1. | `Int
  2. | `Posint
  3. | `Nat
  4. | `Bool
  5. | `String
  6. | `Enum of string list
  7. | `Pkgname
  8. | `Ident
  9. | `Vpkg
  10. | `Vpkgformula
  11. | `Vpkglist
  12. | `Veqpkg
  13. | `Veqpkglist
  14. | `Typedecl
]

CUDF types

Sourceval keep_type : typ
Sourceval keep_enums : string list
Sourcetype typedecl1 = [
  1. | `Int of int option
  2. | `Posint of int option
  3. | `Nat of int option
  4. | `Bool of bool option
  5. | `String of string option
  6. | `Pkgname of string option
  7. | `Ident of string option
  8. | `Enum of string list * string option
    (*

    enums, default enum

    *)
  9. | `Vpkg of vpkg option
  10. | `Vpkgformula of vpkgformula option
  11. | `Vpkglist of vpkglist option
  12. | `Veqpkg of veqpkg option
  13. | `Veqpkglist of veqpkglist option
  14. | `Typedecl of typedecl option
]

(Single) type declaration: each variant denotes a type, its argument the default value, None if missing

Sourceand typedecl = (string * typedecl1) list
Sourcetype typed_value = [
  1. | `Int of int
  2. | `Posint of int
  3. | `Nat of int
  4. | `Bool of bool
  5. | `String of string
  6. | `Pkgname of string
  7. | `Ident of string
  8. | `Enum of string list * string
  9. | `Vpkg of vpkg
  10. | `Vpkgformula of vpkgformula
  11. | `Vpkglist of vpkglist
  12. | `Veqpkg of veqpkg
  13. | `Veqpkglist of veqpkglist
  14. | `Typedecl of typedecl
]

Typed value in the value space of all CUDF types

Manipulation of typed values
Sourceval type_of_typedecl : typedecl1 -> typ

extract the type of a (single) type declaration

Sourceval typedecl_of_value : typed_value -> typedecl1

Create a (single) type declaration having as default value the given typed value (i.e. apply the "Some" monad to typed values)

Sourceval value_of_typedecl : typedecl1 -> typed_value option

Extract the default value from a type declaration (or return None)

Sourceval typedecl_of_type : typ -> typedecl1

Create a (single) type declaration with no default value

Sourceval type_of_value : typed_value -> typ
  • returns

    the type of a given value

cast ty v attempt a runtime cast of a given (typed) value to a different type.

CUDF syntactic types

Types used in parsing, before values are injected into the CUDF type system.

Sourcetype 'ty stanza = (string * 'ty) list

RFC-822-like stanza, i.e. an associative list mapping property names to property values.

Values are typed according to the type variable 'ty. Usually, libCUDF uses either string stanza (for untyped stanzas) or Cudf_types.typed_value stanza (for typed stanzas).

Various errors
Sourceexception Parse_error_822 of string * Lexing.position * Lexing.position

Error while parsing RFC822-like syntax of CUDF documents.

arguments: error message and file range, respectively.

Sourceexception Syntax_error of string * Lexing.position * Lexing.position

Syntax error while parsing some literal value

arguments: error message and file range, respectively

Type error: mismatch between typed value and expected type

arguments: expected type, found value

Accessors, predicates, etc.
Sourceval is_eq_formula : vpkgformula -> bool

Check whether a formula uses only equality tests over package versions.

OCaml

Innovation. Community. Security.