package obus
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=b8a0707f03d525a98c1c5a380b07074e52f2d26918c7b2ad90b5cc0f99a67f2d
md5=0896d5078bfd486a65cf9fa73a984b3f
doc/obus.internals/OBus_introspect_ext/index.html
Module OBus_introspect_ext
OBus extended introspection
By default, introspection documents do not convey semantical information, such as enumerations or flags. However it is possible to attach information to interfaces and members.
This module implements an extended introspection format, which can be encoded into standard introspection documents by using annotations.
Annotations
The following annotations are used to encode additional informations into D-Bus introspection documents
Extended types
type basic = private | Byte| Boolean| Int16| Int32| Int64| Uint16| Uint32| Uint64| Double| String| Signature| Object_path| Unix_fd| Enum of OBus_value.T.basic * (OBus_value.V.basic * string) list(*An enumeration. The first argument is the real D-Bus type and the second is a list of
(constant, keyword).For example:
Enum(OBus_value.T.Uint32, [(OBus_value.V.Uint32 1l, "ok"); (OBus_value.V.Uint32 2l, "fail")])Note that the real D-Bus type must be
*)OBus_value.T.basic.Byteor an integer type.| Flag of OBus_value.T.basic * (OBus_value.V.basic * string) list(*A flag. The first argument is the real type and the second is a list of
(bits, keyword).For example:
Flag(OBus_value.T.Uint32, [(OBus_value.V.Uint32 0x01l, "flag1"); (OBus_value.V.Uint32 0x02l, "flag2"); (OBus_value.V.Uint32 0x04l, "flag3")])Note that the real D-Bus type must be
*)OBus_value.T.basic.Byteor an integer type.
type sequence = single listConstructors
val byte : basicval boolean : basicval int16 : basicval int32 : basicval int64 : basicval uint16 : basicval uint32 : basicval uint64 : basicval double : basicval string : basicval signature : basicval object_path : basicval unix_fd : basicval enum : OBus_value.T.basic -> (OBus_value.V.basic * string) list -> basicval flag : OBus_value.T.basic -> (OBus_value.V.basic * string) list -> basicval variant : singleTerms
type term = private | Term of string * term list(*A term. Arguments are
- the symbol name, which is either the name of a D-Bus type or a user defined type
- the arguments taken by the function associated to the symbol
| Tuple of term list(*A list of terms, packed into a tuple. Tuples are always mapped to D-Bus structures. Moreover it is ensured that there is never a type of the form
*)Tuple[t].
A term represent a type, where symbols have not been resolved.
Construct a tuple. If the list is of length 1, the type itself is returned.
Symbols
type symbol = private | Sym_enum of OBus_value.T.basic * (OBus_value.V.basic * string) list| Sym_flag of OBus_value.T.basic * (OBus_value.V.basic * string) list
Type of user-definable symbols
val sym_enum :
OBus_value.T.basic ->
(OBus_value.V.basic * string) list ->
symbolCreate an enumeration
val sym_flag :
OBus_value.T.basic ->
(OBus_value.V.basic * string) list ->
symbolCreate a flag type
Conversions
Stripping
The following functions remove extension from types.
val strip_basic : basic -> OBus_value.T.basicval strip_single : single -> OBus_value.T.singleval strip_sequence : sequence -> OBus_value.T.sequenceProjections
The following functions project standard D-Bus types into extended D-Bus types
val project_basic : OBus_value.T.basic -> basicval project_single : OBus_value.T.single -> singleval project_sequence : OBus_value.T.sequence -> sequenceTypes to terms conversions
The following functions returns the term associated to a standard D-Bus type
val term_of_basic : OBus_value.T.basic -> termval term_of_single : OBus_value.T.single -> termval term_of_sequence : OBus_value.T.sequence -> termSymbols resolution
type env = (string * symbol) listAn environment, mapping names to symbol
resolve env term resolves symbols of term using env, and returns the extended type it denotes. It raises Resolve_error if a symbol of term is not found in env.
Extended introspection ast
type annotation = name * stringtype member = | Method of name * argument list * argument list * annotation list| Signal of name * argument list * annotation list| Property of name * term * access * annotation list
type interface = name * member list * (string * symbol) list * annotation listEncoding/decoding
val encode : interface -> OBus_introspect.interfaceEncode the given interface into a standard one by using annotations
val decode : OBus_introspect.interface -> interfaceDecode the given standard interface into an extended one by decoding annotations