diff --git a/Quickjs/RegExp/index.html b/Quickjs/RegExp/index.html new file mode 100644 index 00000000..900662a5 --- /dev/null +++ b/Quickjs/RegExp/index.html @@ -0,0 +1,2 @@ + +RegExp (docs.local.quickjs.Quickjs.RegExp)

Module Quickjs.RegExp

type t
type result
val compile : string -> string -> t
val lastIndex : t -> int
val setLastIndex : t -> int -> unit
val flags : t -> string
val global : t -> bool
val ignorecase : t -> bool
val multiline : t -> bool
val dotall : t -> bool
val sticky : t -> bool
val source : t -> string
val test : t -> string -> bool
val exec : t -> string -> result
val captures : result -> string array
val input : result -> string
diff --git a/Quickjs/index.html b/Quickjs/index.html new file mode 100644 index 00000000..1d594cf6 --- /dev/null +++ b/Quickjs/index.html @@ -0,0 +1,2 @@ + +Quickjs (docs.local.quickjs.Quickjs)

Module Quickjs

module RegExp : sig ... end
diff --git a/bindings/Bindings/C/Functions/index.html b/bindings/Bindings/C/Functions/index.html new file mode 100644 index 00000000..d841f3e8 --- /dev/null +++ b/bindings/Bindings/C/Functions/index.html @@ -0,0 +1,30 @@ + +Functions (docs.local.quickjs.bindings.Bindings.C.Functions)

Module C.Functions

val lre_compile : + (int Ctypes_static.ptr -> + char Ctypes_static.ptr -> + int -> + string Ctypes_static.ocaml -> + Unsigned.size_t -> + int -> + unit Ctypes_static.ptr -> + Unsigned.uint8 Ctypes_static.ptr + Bindings.Libregexp__c_generated_functions__Function_description__Functions.return) + Bindings.Libregexp__c_generated_functions__Function_description__Functions.result
val lre_exec : + (Unsigned.uint8 Ctypes_static.ptr Ctypes_static.ptr -> + Unsigned.uint8 Ctypes_static.ptr -> + Unsigned.uint8 Ctypes_static.ptr -> + int -> + int -> + int -> + unit Ctypes_static.ptr -> + int + Bindings.Libregexp__c_generated_functions__Function_description__Functions.return) + Bindings.Libregexp__c_generated_functions__Function_description__Functions.result
val lre_get_capture_count : + (Unsigned.uint8 Ctypes_static.ptr -> + int + Bindings.Libregexp__c_generated_functions__Function_description__Functions.return) + Bindings.Libregexp__c_generated_functions__Function_description__Functions.result
val lre_get_flags : + (Unsigned.uint8 Ctypes_static.ptr -> + int + Bindings.Libregexp__c_generated_functions__Function_description__Functions.return) + Bindings.Libregexp__c_generated_functions__Function_description__Functions.result
diff --git a/bindings/Bindings/C/index.html b/bindings/Bindings/C/index.html new file mode 100644 index 00000000..14eae089 --- /dev/null +++ b/bindings/Bindings/C/index.html @@ -0,0 +1,2 @@ + +C (docs.local.quickjs.bindings.Bindings.C)

Module Bindings.C

module Type = Types_generated
module Functions : sig ... end
diff --git a/bindings/Bindings/Function_description/Functions/argument-1-F/index.html b/bindings/Bindings/Function_description/Functions/argument-1-F/index.html new file mode 100644 index 00000000..b3902da2 --- /dev/null +++ b/bindings/Bindings/Function_description/Functions/argument-1-F/index.html @@ -0,0 +1,2 @@ + +F (docs.local.quickjs.bindings.Bindings.Function_description.Functions.F)

Parameter Functions.F

type 'a fn
type 'a return
val (@->) : 'a Ctypes.typ -> 'b fn -> ('a -> 'b) fn
val returning : 'a Ctypes.typ -> 'a return fn
type 'a result
val foreign : string -> ('a -> 'b) fn -> ('a -> 'b) result
val foreign_value : string -> 'a Ctypes.typ -> 'a Ctypes.ptr result
diff --git a/bindings/Bindings/Function_description/Functions/index.html b/bindings/Bindings/Function_description/Functions/index.html new file mode 100644 index 00000000..fc21f9b8 --- /dev/null +++ b/bindings/Bindings/Function_description/Functions/index.html @@ -0,0 +1,21 @@ + +Functions (docs.local.quickjs.bindings.Bindings.Function_description.Functions)

Module Function_description.Functions

Parameters

module F : Ctypes.FOREIGN

Signature

val lre_compile : + (int Ctypes_static.ptr -> + char Ctypes_static.ptr -> + int -> + string Ctypes_static.ocaml -> + Unsigned.size_t -> + int -> + unit Ctypes_static.ptr -> + Unsigned.uint8 Ctypes_static.ptr F.return) + F.result
val lre_get_capture_count : + (Unsigned.uint8 Ctypes_static.ptr -> int F.return) F.result
val lre_get_flags : (Unsigned.uint8 Ctypes_static.ptr -> int F.return) F.result
diff --git a/bindings/Bindings/Function_description/index.html b/bindings/Bindings/Function_description/index.html new file mode 100644 index 00000000..c8286bdf --- /dev/null +++ b/bindings/Bindings/Function_description/index.html @@ -0,0 +1,2 @@ + +Function_description (docs.local.quickjs.bindings.Bindings.Function_description)

Module Bindings.Function_description

module Types = Types_generated
module Functions (F : Ctypes.FOREIGN) : sig ... end
diff --git a/bindings/Bindings/Type_description/Types/argument-1-T/Intptr/Infix/index.html b/bindings/Bindings/Type_description/Types/argument-1-T/Intptr/Infix/index.html new file mode 100644 index 00000000..5aabeb78 --- /dev/null +++ b/bindings/Bindings/Type_description/Types/argument-1-T/Intptr/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (docs.local.quickjs.bindings.Bindings.Type_description.Types.T.Intptr.Infix)

Module Intptr.Infix

include Unsigned.Infix with type t := t
val (+) : t -> t -> t

Addition. See add.

val (-) : t -> t -> t

Subtraction. See sub.

val (*) : t -> t -> t

Multiplication. See mul.

val (/) : t -> t -> t

Division. See div.

val (mod) : t -> t -> t

Integer remainder. See rem.

val (land) : t -> t -> t

Bitwise logical and. See logand.

val (lor) : t -> t -> t

Bitwise logical or. See logor.

val (lxor) : t -> t -> t

Bitwise logical exclusive or. See logxor.

val (lsl) : t -> int -> t

x lsl y shifts x to the left by y bits. See shift_left.

val (lsr) : t -> int -> t

x lsr y shifts x to the right by y bits. See shift_right.

val (asr) : t -> int -> t

x asr y shifts x to the right by y bits. See shift_right.

diff --git a/bindings/Bindings/Type_description/Types/argument-1-T/Intptr/index.html b/bindings/Bindings/Type_description/Types/argument-1-T/Intptr/index.html new file mode 100644 index 00000000..dd85f59f --- /dev/null +++ b/bindings/Bindings/Type_description/Types/argument-1-T/Intptr/index.html @@ -0,0 +1,2 @@ + +Intptr (docs.local.quickjs.bindings.Bindings.Type_description.Types.T.Intptr)

Module T.Intptr

type t
module Infix : Signed.Infix with type t := t
include Unsigned.S with type t := t with module Infix := Infix
val add : t -> t -> t

Addition.

val sub : t -> t -> t

Subtraction.

val mul : t -> t -> t

Multiplication.

val div : t -> t -> t

Division. Raise Division_by_zero if the second argument is zero.

val rem : t -> t -> t

Integer remainder. Raise Division_by_zero if the second argument is zero.

val max_int : t

The greatest representable integer.

val logand : t -> t -> t

Bitwise logical and.

val logor : t -> t -> t

Bitwise logical or.

val logxor : t -> t -> t

Bitwise logical exclusive or.

val shift_left : t -> int -> t

shift_left x y shifts x to the left by y bits.

val shift_right : t -> int -> t

shift_right x y shifts x to the right by y bits.

val of_int : int -> t

Convert the given int value to an unsigned integer.

val to_int : t -> int

Convert the given unsigned integer value to an int.

val of_string : string -> t

Convert the given string to an unsigned integer. Raise Failure if the given string is not a valid representation of an unsigned integer.

val to_string : t -> string

Return the string representation of its argument.

val to_hexstring : t -> string

Return the hexadecimal string representation of its argument.

val zero : t

The integer 0.

val one : t

The integer 1.

val lognot : t -> t

Bitwise logical negation.

val succ : t -> t

Successor.

val pred : t -> t

Predecessor.

val compare : t -> t -> int

The comparison function for unsigned integers, with the same specification as Stdlib.compare.

val equal : t -> t -> bool

Tests for equality, with the same specification as Stdlib.(=).

val max : t -> t -> t

max x y is the greater of x and y

val min : t -> t -> t

min x y is the lesser of x and y

val of_string_opt : string -> t option

Convert the given string to an unsigned integer. Returns None if the given string is not a valid representation of an unsigned integer.

val pp : Format.formatter -> t -> unit

Output the result of to_string on a formatter.

val pp_hex : Format.formatter -> t -> unit

Output the result of to_hexstring on a formatter.

val neg : t -> t

Unary negation.

val abs : t -> t

Return the absolute value of its argument.

val minus_one : t

The value -1

val min_int : t

The smallest representable integer.

val shift_right_logical : t -> int -> t

shift_right_logical x y shifts x to the right by y bits. See Int32.shift_right_logical.

val of_nativeint : nativeint -> t

Convert the given nativeint value to a signed integer.

val to_nativeint : t -> nativeint

Convert the given signed integer to a nativeint value.

val of_int64 : int64 -> t

Convert the given int64 value to a signed integer.

val to_int64 : t -> int64

Convert the given signed integer to an int64 value.

diff --git a/bindings/Bindings/Type_description/Types/argument-1-T/Ptrdiff/Infix/index.html b/bindings/Bindings/Type_description/Types/argument-1-T/Ptrdiff/Infix/index.html new file mode 100644 index 00000000..8bb63aa3 --- /dev/null +++ b/bindings/Bindings/Type_description/Types/argument-1-T/Ptrdiff/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (docs.local.quickjs.bindings.Bindings.Type_description.Types.T.Ptrdiff.Infix)

Module Ptrdiff.Infix

include Unsigned.Infix with type t := t
val (+) : t -> t -> t

Addition. See add.

val (-) : t -> t -> t

Subtraction. See sub.

val (*) : t -> t -> t

Multiplication. See mul.

val (/) : t -> t -> t

Division. See div.

val (mod) : t -> t -> t

Integer remainder. See rem.

val (land) : t -> t -> t

Bitwise logical and. See logand.

val (lor) : t -> t -> t

Bitwise logical or. See logor.

val (lxor) : t -> t -> t

Bitwise logical exclusive or. See logxor.

val (lsl) : t -> int -> t

x lsl y shifts x to the left by y bits. See shift_left.

val (lsr) : t -> int -> t

x lsr y shifts x to the right by y bits. See shift_right.

val (asr) : t -> int -> t

x asr y shifts x to the right by y bits. See shift_right.

diff --git a/bindings/Bindings/Type_description/Types/argument-1-T/Ptrdiff/index.html b/bindings/Bindings/Type_description/Types/argument-1-T/Ptrdiff/index.html new file mode 100644 index 00000000..55a3baf1 --- /dev/null +++ b/bindings/Bindings/Type_description/Types/argument-1-T/Ptrdiff/index.html @@ -0,0 +1,2 @@ + +Ptrdiff (docs.local.quickjs.bindings.Bindings.Type_description.Types.T.Ptrdiff)

Module T.Ptrdiff

type t
module Infix : Signed.Infix with type t := t
include Unsigned.S with type t := t with module Infix := Infix
val add : t -> t -> t

Addition.

val sub : t -> t -> t

Subtraction.

val mul : t -> t -> t

Multiplication.

val div : t -> t -> t

Division. Raise Division_by_zero if the second argument is zero.

val rem : t -> t -> t

Integer remainder. Raise Division_by_zero if the second argument is zero.

val max_int : t

The greatest representable integer.

val logand : t -> t -> t

Bitwise logical and.

val logor : t -> t -> t

Bitwise logical or.

val logxor : t -> t -> t

Bitwise logical exclusive or.

val shift_left : t -> int -> t

shift_left x y shifts x to the left by y bits.

val shift_right : t -> int -> t

shift_right x y shifts x to the right by y bits.

val of_int : int -> t

Convert the given int value to an unsigned integer.

val to_int : t -> int

Convert the given unsigned integer value to an int.

val of_string : string -> t

Convert the given string to an unsigned integer. Raise Failure if the given string is not a valid representation of an unsigned integer.

val to_string : t -> string

Return the string representation of its argument.

val to_hexstring : t -> string

Return the hexadecimal string representation of its argument.

val zero : t

The integer 0.

val one : t

The integer 1.

val lognot : t -> t

Bitwise logical negation.

val succ : t -> t

Successor.

val pred : t -> t

Predecessor.

val compare : t -> t -> int

The comparison function for unsigned integers, with the same specification as Stdlib.compare.

val equal : t -> t -> bool

Tests for equality, with the same specification as Stdlib.(=).

val max : t -> t -> t

max x y is the greater of x and y

val min : t -> t -> t

min x y is the lesser of x and y

val of_string_opt : string -> t option

Convert the given string to an unsigned integer. Returns None if the given string is not a valid representation of an unsigned integer.

val pp : Format.formatter -> t -> unit

Output the result of to_string on a formatter.

val pp_hex : Format.formatter -> t -> unit

Output the result of to_hexstring on a formatter.

val neg : t -> t

Unary negation.

val abs : t -> t

Return the absolute value of its argument.

val minus_one : t

The value -1

val min_int : t

The smallest representable integer.

val shift_right_logical : t -> int -> t

shift_right_logical x y shifts x to the right by y bits. See Int32.shift_right_logical.

val of_nativeint : nativeint -> t

Convert the given nativeint value to a signed integer.

val to_nativeint : t -> nativeint

Convert the given signed integer to a nativeint value.

val of_int64 : int64 -> t

Convert the given int64 value to a signed integer.

val to_int64 : t -> int64

Convert the given signed integer to an int64 value.

diff --git a/bindings/Bindings/Type_description/Types/argument-1-T/Uintptr/Infix/index.html b/bindings/Bindings/Type_description/Types/argument-1-T/Uintptr/Infix/index.html new file mode 100644 index 00000000..1b6a2bb4 --- /dev/null +++ b/bindings/Bindings/Type_description/Types/argument-1-T/Uintptr/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (docs.local.quickjs.bindings.Bindings.Type_description.Types.T.Uintptr.Infix)

Module Uintptr.Infix

val (+) : t -> t -> t

Addition. See add.

val (-) : t -> t -> t

Subtraction. See sub.

val (*) : t -> t -> t

Multiplication. See mul.

val (/) : t -> t -> t

Division. See div.

val (mod) : t -> t -> t

Integer remainder. See rem.

val (land) : t -> t -> t

Bitwise logical and. See logand.

val (lor) : t -> t -> t

Bitwise logical or. See logor.

val (lxor) : t -> t -> t

Bitwise logical exclusive or. See logxor.

val (lsl) : t -> int -> t

x lsl y shifts x to the left by y bits. See shift_left.

val (lsr) : t -> int -> t

x lsr y shifts x to the right by y bits. See shift_right.

diff --git a/bindings/Bindings/Type_description/Types/argument-1-T/Uintptr/index.html b/bindings/Bindings/Type_description/Types/argument-1-T/Uintptr/index.html new file mode 100644 index 00000000..d090326c --- /dev/null +++ b/bindings/Bindings/Type_description/Types/argument-1-T/Uintptr/index.html @@ -0,0 +1,2 @@ + +Uintptr (docs.local.quickjs.bindings.Bindings.Type_description.Types.T.Uintptr)

Module T.Uintptr

type t
val add : t -> t -> t

Addition.

val sub : t -> t -> t

Subtraction.

val mul : t -> t -> t

Multiplication.

val div : t -> t -> t

Division. Raise Division_by_zero if the second argument is zero.

val rem : t -> t -> t

Integer remainder. Raise Division_by_zero if the second argument is zero.

val max_int : t

The greatest representable integer.

val logand : t -> t -> t

Bitwise logical and.

val logor : t -> t -> t

Bitwise logical or.

val logxor : t -> t -> t

Bitwise logical exclusive or.

val shift_left : t -> int -> t

shift_left x y shifts x to the left by y bits.

val shift_right : t -> int -> t

shift_right x y shifts x to the right by y bits.

val of_int : int -> t

Convert the given int value to an unsigned integer.

val to_int : t -> int

Convert the given unsigned integer value to an int.

val of_int64 : int64 -> t

Convert the given int64 value to an unsigned integer.

val to_int64 : t -> int64

Convert the given unsigned integer value to an int64.

val of_string : string -> t

Convert the given string to an unsigned integer. Raise Failure if the given string is not a valid representation of an unsigned integer.

val to_string : t -> string

Return the string representation of its argument.

val to_hexstring : t -> string

Return the hexadecimal string representation of its argument.

val zero : t

The integer 0.

val one : t

The integer 1.

val lognot : t -> t

Bitwise logical negation.

val succ : t -> t

Successor.

val pred : t -> t

Predecessor.

val compare : t -> t -> int

The comparison function for unsigned integers, with the same specification as Stdlib.compare.

val equal : t -> t -> bool

Tests for equality, with the same specification as Stdlib.(=).

val max : t -> t -> t

max x y is the greater of x and y

val min : t -> t -> t

min x y is the lesser of x and y

val of_string_opt : string -> t option

Convert the given string to an unsigned integer. Returns None if the given string is not a valid representation of an unsigned integer.

val pp : Format.formatter -> t -> unit

Output the result of to_string on a formatter.

val pp_hex : Format.formatter -> t -> unit

Output the result of to_hexstring on a formatter.

module Infix : Unsigned.Infix with type t := t
diff --git a/bindings/Bindings/Type_description/Types/argument-1-T/index.html b/bindings/Bindings/Type_description/Types/argument-1-T/index.html new file mode 100644 index 00000000..942814d4 --- /dev/null +++ b/bindings/Bindings/Type_description/Types/argument-1-T/index.html @@ -0,0 +1,49 @@ + +T (docs.local.quickjs.bindings.Bindings.Type_description.Types.T)

Parameter Types.T

include Ctypes_types.TYPE

Values representing C types

type 'a typ

The type of values representing C types. There are two types associated with each typ value: the C type used to store and pass values, and the corresponding OCaml type. The type parameter indicates the OCaml type, so a value of type t typ is used to read and write OCaml values of type t. There are various uses of typ values, including

  • constructing function types for binding native functions using Foreign.foreign
  • constructing pointers for reading and writing locations in C-managed storage using ptr
  • describing the fields of structured types built with structure and union.

The void type

val void : unit typ

Value representing the C void type. Void values appear in OCaml as the unit type, so using void in an argument or result type specification produces a function which accepts or returns unit.

Dereferencing a pointer to void is an error, as in C, and will raise IncompleteType.

Scalar types

The scalar types consist of the Arithmetic types and the Pointer types.

Arithmetic types

The arithmetic types consist of the signed and unsigned integer types (including character types) and the floating types. There are values representing both exact-width integer types (of 8, 16, 32 and 64 bits) and types whose size depend on the platform (signed and unsigned short, int, long, long long).

val char : char typ

Value representing the C type char.

Signed integer types
val schar : int typ

Value representing the C type signed char.

val short : int typ

Value representing the C type (signed) short.

val int : int typ

Value representing the C type (signed) int.

val long : Signed.long typ

Value representing the C type (signed) long.

val llong : Signed.llong typ

Value representing the C type (signed) long long.

val nativeint : nativeint typ

Value representing the C type (signed) int.

val int8_t : int typ

Value representing an 8-bit signed integer C type.

val int16_t : int typ

Value representing a 16-bit signed integer C type.

val int32_t : int32 typ

Value representing a 32-bit signed integer C type.

val int64_t : int64 typ

Value representing a 64-bit signed integer C type.

module Intptr : Signed.S
val intptr_t : Intptr.t typ

Value representing the C type intptr_t.

module Ptrdiff : Signed.S
val ptrdiff_t : Ptrdiff.t typ

Value representing the C type ptrdiff_t.

val camlint : int typ

Value representing an integer type with the same storage requirements as an OCaml int.

Unsigned integer types
val uchar : Unsigned.uchar typ

Value representing the C type unsigned char.

val bool : bool typ

Value representing the C type bool.

val uint8_t : Unsigned.uint8 typ

Value representing an 8-bit unsigned integer C type.

val uint16_t : Unsigned.uint16 typ

Value representing a 16-bit unsigned integer C type.

val uint32_t : Unsigned.uint32 typ

Value representing a 32-bit unsigned integer C type.

val uint64_t : Unsigned.uint64 typ

Value representing a 64-bit unsigned integer C type.

val size_t : Unsigned.size_t typ

Value representing the C type size_t, an alias for one of the unsigned integer types. The actual size and alignment requirements for size_t vary between platforms.

val ushort : Unsigned.ushort typ

Value representing the C type unsigned short.

val sint : Signed.sint typ

Value representing the C type int.

val uint : Unsigned.uint typ

Value representing the C type unsigned int.

val ulong : Unsigned.ulong typ

Value representing the C type unsigned long.

val ullong : Unsigned.ullong typ

Value representing the C type unsigned long long.

val uintptr_t : Uintptr.t typ

Value representing the C type uintptr_t.

Floating types
val float : float typ

Value representing the C single-precision float type.

val double : float typ

Value representing the C type double.

val ldouble : LDouble.t typ

Value representing the C type long double.

Complex types
val complex32 : Complex.t typ

Value representing the C99 single-precision float complex type.

val complex64 : Complex.t typ

Value representing the C99 double-precision double complex type.

val complexld : ComplexL.t typ

Value representing the C99 long-double-precision long double complex type.

Pointer types
C-compatible pointers
val ptr : 'a typ -> 'a Ctypes_static.ptr typ

Construct a pointer type from an existing type (called the reference type).

val ptr_opt : 'a typ -> 'a Ctypes_static.ptr option typ

Construct a pointer type from an existing type (called the reference type). This behaves like ptr, except that null pointers appear in OCaml as None.

val string : string typ

A high-level representation of the string type.

On the C side this behaves like char *; on the OCaml side values read and written using string are simply native OCaml strings.

To avoid problems with the garbage collector, values passed using string are copied into immovable C-managed storage before being passed to C.

The string type representation is suitable for use in function argument types such as the following:

string @-> returning int

where the lifetime of the C-managed storage does not need to extend beyond the duration of the function call. However, it is not suitable for use in struct or union fields

field s "x" string

because it does not provide a way to manage the lifetime of the C-managed storage.

val string_opt : string option typ

A high-level representation of the string type. This behaves like string, except that null pointers appear in OCaml as None.

OCaml pointers
val ocaml_string : string Ctypes_static.ocaml typ

Value representing the directly mapped storage of an OCaml string.

val ocaml_bytes : bytes Ctypes_static.ocaml typ

Value representing the directly mapped storage of an OCaml byte array.

Array types

C array types
val array : int -> 'a typ -> 'a Ctypes_static.carray typ

Construct a sized array type from a length and an existing type (called the element type).

Bigarray types
val bigarray : + < element : 'a + ; layout : Bigarray_compat.c_layout + ; ba_repr : 'b + ; dims : 'dims + ; bigarray : 'bigarray + ; carray : _ > + Ctypes_static.bigarray_class -> + 'dims -> + ('a, 'b) Bigarray_compat.kind -> + 'bigarray typ

Construct a sized C-layout bigarray type representation from a bigarray class, the dimensions, and the Bigarray_compat.kind.

val fortran_bigarray : + < element : 'a + ; layout : Bigarray_compat.fortran_layout + ; ba_repr : 'b + ; dims : 'dims + ; bigarray : 'bigarray + ; carray : _ > + Ctypes_static.bigarray_class -> + 'dims -> + ('a, 'b) Bigarray_compat.kind -> + 'bigarray typ

Construct a sized Fortran-layout bigarray type representation from a bigarray class, the dimensions, and the Bigarray_compat.kind.

val typ_of_bigarray_kind : ('a, 'b) Bigarray_compat.kind -> 'a typ

typ_of_bigarray_kind k is the type corresponding to the Bigarray kind k.

Struct and union types

type ('a, 't) field
val structure : string -> 's Ctypes_static.structure typ

Construct a new structure type. The type value returned is incomplete and can be updated using field until it is passed to seal, at which point the set of fields is fixed.

The type ('_s structure typ) of the expression returned by the call structure tag includes a weak type variable, which can be explicitly instantiated to ensure that the OCaml values representing different C structure types have incompatible types. Typical usage is as follows:

type tagname

let tagname : tagname structure typ = structure "tagname"

val union : string -> 's Ctypes_static.union typ

Construct a new union type. This behaves analogously to structure; fields are added with field.

val field : + 't typ -> + string -> + 'a typ -> + ('a, ('s, [< `Struct | `Union ]) Ctypes_static.structured as 't) field

field ty label ty' adds a field of type ty' with label label to the structure or union type ty and returns a field value that can be used to read and write the field in structure or union instances (e.g. using getf and setf).

Attempting to add a field to a union type that has been sealed with seal is an error, and will raise ModifyingSealedType.

val seal : (_, [< `Struct | `Union ]) Ctypes_static.structured typ -> unit

seal t completes the struct or union type t so that no further fields can be added. Struct and union types must be sealed before they can be used in a way that involves their size or alignment; see the documentation for IncompleteType for further details.

View types

val view : + ?format_typ:((Format.formatter -> unit) -> Format.formatter -> unit) -> + ?format:(Format.formatter -> 'b -> unit) -> + read:('a -> 'b) -> + write:('b -> 'a) -> + 'a typ -> + 'b typ

view ~read:r ~write:w t creates a C type representation t' which behaves like t except that values read using t' are subsequently transformed using the function r and values written using t' are first transformed using the function w.

For example, given suitable definitions of string_of_char_ptr and char_ptr_of_string, the type representation

view ~read:string_of_char_ptr ~write:char_ptr_of_string (ptr char)

can be used to pass OCaml strings directly to and from bound C functions, or to read and write string members in structs and arrays. (In fact, the string type representation is defined in exactly this way.)

The optional argument format_typ is used by the Ctypes.format_typ and string_of_typ functions to print the type at the top level and elsewhere. If format_typ is not supplied the printer for t is used instead.

The optional argument format is used by the Ctypes.format and string_of functions to print the values. If format_val is not supplied the printer for t is used instead.

val typedef : 'a typ -> string -> 'a typ

typedef t name creates a C type representation t' which is equivalent to t except its name is printed as name.

This is useful when generating C stubs involving "anonymous" types, for example: typedef struct { int f } typedef_name;

Abstract types

val abstract : + name:string -> + size:int -> + alignment:int -> + 'a Ctypes_static.abstract typ

Create an abstract type specification from the size and alignment requirements for the type.

Injection of concrete types

val lift_typ : 'a Ctypes_static.typ -> 'a typ

lift_typ t turns a concrete type representation into an abstract type representation.

For example, retrieving struct layout from C involves working with an abstract representation of types which do not support operations such as sizeof. The lift_typ function makes it possible to use concrete type representations wherever such abstract type representations are needed.

Function types

Abstract interface to C function type descriptions

type 'a fn = 'a Ctypes_static.fn

The type of values representing C function types. A value of type t fn can be used to bind to C functions and to describe type of OCaml functions passed to C.

val (@->) : 'a typ -> 'b fn -> ('a -> 'b) fn

Construct a function type from a type and an existing function type. This corresponds to prepending a parameter to a C function parameter list. For example,

int @-> ptr void @-> returning float

describes a function type that accepts two arguments -- an integer and a pointer to void -- and returns a float.

val returning : 'a typ -> 'a fn

Give the return type of a C function. Note that returning is intended to be used together with (@->); see the documentation for (@->) for an example.

type 'a static_funptr = 'a Ctypes_static.static_funptr

Function pointer types

The type of values representing C function pointer types.

val static_funptr : 'a fn -> 'a Ctypes_static.static_funptr typ

Construct a function pointer type from an existing function type (called the reference type).

type 'a const
val constant : string -> 'a typ -> 'a const

constant name typ retrieves the value of the compile-time constant name of type typ. It can be used to retrieve enum constants, #defined values and other integer constant expressions.

The type typ must be either an integer type such as bool, char, int, uint8, etc., or a view (or perhaps multiple views) where the underlying type is an integer type.

When the value of the constant cannot be represented in the type there will typically be a diagnostic from either the C compiler or the OCaml compiler. For example, gcc will say

warning: overflow in implicit constant conversion

val enum : + string -> + ?typedef:bool -> + ?unexpected:(int64 -> 'a) -> + ('a * int64 const) list -> + 'a typ

enum name ?unexpected alist builds a type representation for the enum named name. The size and alignment are retrieved so that the resulting type can be used everywhere an integer type can be used: as an array element or struct member, as an argument or return value, etc.

The value alist is an association list of OCaml values and values retrieved by the constant function. For example, to expose the enum

enum letters { A, B, C = 10, D };

you might first retrieve the values of the enumeration constants:

let a = constant "A" int64_t
+and b = constant "B" int64_t
+and c = constant "C" int64_t
+and d = constant "D" int64_t

and then build the enumeration type

let letters = enum "letters" [
+   `A, a;
+   `B, b;
+   `C, c;
+   `D, d;
+] ~unexpected:(fun i -> `E i)

The unexpected function specifies the value to return in the case that some unexpected value is encountered -- for example, if a function with the return type 'enum letters' actually returns the value -1.

The optional flag typedef specifies whether the first argument, name, indicates an tag or an alias. If typedef is false (the default) then name is treated as an enumeration tag:

enum letters { ... }

If typedef is true then name is instead treated as an alias:

typedef enum { ... } letters

diff --git a/bindings/Bindings/Type_description/Types/index.html b/bindings/Bindings/Type_description/Types/index.html new file mode 100644 index 00000000..845f4969 --- /dev/null +++ b/bindings/Bindings/Type_description/Types/index.html @@ -0,0 +1,2 @@ + +Types (docs.local.quickjs.bindings.Bindings.Type_description.Types)

Module Type_description.Types

Parameters

module T : Ctypes.TYPE

Signature

diff --git a/bindings/Bindings/Type_description/index.html b/bindings/Bindings/Type_description/index.html new file mode 100644 index 00000000..d59cd5ea --- /dev/null +++ b/bindings/Bindings/Type_description/index.html @@ -0,0 +1,2 @@ + +Type_description (docs.local.quickjs.bindings.Bindings.Type_description)

Module Bindings.Type_description

module Types (T : Ctypes.TYPE) : sig ... end
diff --git a/bindings/Bindings/Types_generated/index.html b/bindings/Bindings/Types_generated/index.html new file mode 100644 index 00000000..aaae516b --- /dev/null +++ b/bindings/Bindings/Types_generated/index.html @@ -0,0 +1,2 @@ + +Types_generated (docs.local.quickjs.bindings.Bindings.Types_generated)

Module Bindings.Types_generated

include sig ... end
diff --git a/bindings/Bindings/index.html b/bindings/Bindings/index.html new file mode 100644 index 00000000..d031c2ae --- /dev/null +++ b/bindings/Bindings/index.html @@ -0,0 +1,2 @@ + +Bindings (docs.local.quickjs.bindings.Bindings)

Module Bindings

module C : sig ... end
module Function_description : sig ... end
module Type_description : sig ... end
module Types_generated : sig ... end
diff --git a/bindings/index.html b/bindings/index.html new file mode 100644 index 00000000..c7951278 --- /dev/null +++ b/bindings/index.html @@ -0,0 +1,2 @@ + +bindings (docs.local.quickjs.bindings)

Package quickjs.bindings

Library quickjs.bindings

The entry point of this library is the module: Bindings.

diff --git a/index.html b/index.html new file mode 100644 index 00000000..8fbc3cf6 --- /dev/null +++ b/index.html @@ -0,0 +1,2 @@ + +quickjs (docs.local.quickjs)

quickjs

quickjs is a set of OCaml bindings for QuickJS. QuickJS is a small and embeddable JavaScript engine. It supports the ES2020 specification including modules, asynchronous generators, proxies and BigInt.

The project exposes two libraries:

Motivation

The purpose of this project is to provide the same behaviour as the JavaScript engines from browsers SpiderMonkey, JavaScriptCore, ChakraCore, v8) into OCaml. So code that runs in the browser (via Melange) can be run in native with the same results.

Status

This is a work in progress, and currently only includes bindings to RegExp (binded to libregexp.c).