text
stringlengths
12
786k
let setegid egid = ignore ( handle_error " setguid " 0 ( C . setegid ( Posix_types . Gid . of_int egid ) ) )
module type S = sig val write_lwt : ? blocking : bool -> Unix . file_descr -> unit Ctypes . ptr -> int -> int Lwt . t val pwrite_lwt : ? blocking : bool -> Unix . file_descr -> unit Ctypes . ptr -> int -> int64 -> int Lwt . t val read_lwt : ? blocking : bool -> Unix . file_descr -> unit Ctypes . ptr -> int -> int Lwt . t val pread_lwt : ? blocking : bool -> Unix . file_descr -> unit Ctypes . ptr -> int -> int64 -> int Lwt . t end
let char_bigarray_of_unit_ptr p len = let open Ctypes in bigarray_of_ptr array1 len Bigarray . char ( coerce ( ptr void ) ( ptr char ) p )
let write ? blocking ? set_flags fd ptr len = let lwt_fd = Lwt_unix . of_unix_file_descr ? blocking ? set_flags fd in Lwt_bytes . write lwt_fd ( char_bigarray_of_unit_ptr ptr len ) 0 len
let pwrite ? blocking ? set_flags fd ( Ctypes_static . CPointer ptr as p ) len offset = let lwt_fd = Lwt_unix . of_unix_file_descr ? blocking ? set_flags fd in Lwt_unix . blocking lwt_fd >>= function | true -> Lwt_unix . wait_write lwt_fd >>= fun ( ) -> ( C . pwrite fd p ( Size . of_int len ) ( Off . of_int64 offset ) ) . Gen . lwt >>= fun ( rv , errno ) -> if rv < Ssize . zero then Errno_unix . raise_errno ~ call " : pwrite " errno else Lwt . return ( Ssize . to_int rv ) | false -> Lwt_unix . ( wrap_syscall Write ) lwt_fd @@ fun ( ) -> Unistd_unix . pwrite fd p len offset
let read ? blocking ? set_flags fd ptr len = let lwt_fd = Lwt_unix . of_unix_file_descr ? blocking ? set_flags fd in Lwt_bytes . read lwt_fd ( char_bigarray_of_unit_ptr ptr len ) 0 len
let pread ? blocking ? set_flags fd ( Ctypes_static . CPointer ptr as p ) len offset = let lwt_fd = Lwt_unix . of_unix_file_descr ? blocking ? set_flags fd in Lwt_unix . blocking lwt_fd >>= function | true -> Lwt_unix . wait_read lwt_fd >>= fun ( ) -> ( C . pread fd p ( Size . of_int len ) ( Off . of_int64 offset ) ) . Gen . lwt >>= fun ( rv , errno ) -> if rv < Ssize . zero then Errno_unix . raise_errno ~ call " : pread " errno else Lwt . return ( Ssize . to_int rv ) | false -> Lwt_unix . ( wrap_syscall Read ) lwt_fd @@ fun ( ) -> Unistd_unix . pread fd p len offset
object end M . cl [ ' a , ' b ] M . cl object ( ' ty ) inherit cl val mutable virtual var : bool method private bar1 x ~ y : bool method private virtual bar2 : ' a ' b . ( ' a , ' b ) Hashtbl . t constraint ' a = ' b end [ ' a , ' b ] M . cl fun a b -> object end val x = true end object ( _ : ' a ) inherit Something . someclass as v val mutable var : bool = true val mutable virtual var2 : string method private bar1 x ~ y : bool = false method private virtual bar2 : ' a ' b . ( ' a , ' b ) Hashtbl . t constraint ' a = ' b initializer z end
let e = var <- true
let e = { < var = false ; var2 = true ; } > object val x = true end and virtual [ ' a , ' b ] cl2 x y : object val x : bool end = fun x y -> object val x : bool = true end : object end method x : int end < >
let ( ) = ( ) < . . >
let ( ) = ( ) < meth : int option ; meth2 : ' a . ' a option ; meth3 : ' a ' b . ( ' a , ' b ) Hashtbl . t >
let ( ) = ( ) < meth : int option ; meth2 : ' a . ' a option ; meth3 : ' a ' b . ( ' a , ' b ) Hashtbl . t ; . . >
let ( ) = ( ) # M . meth ' a # M . meth ( ' a , ' b ' * c ) # M . meth
type a = < >
type a = < . . >
type a = < meth : int option ; meth2 : ' a . ' a option ; meth3 : ' a ' b . ( ' a , ' b ) Hashtbl . t >
type a = < meth : int option ; meth2 : ' a . ' a option ; meth3 : ' a ' b . ( ' a , ' b ) Hashtbl . t ; . . >
type t = < a : int ; b : < a : int ; b : < c : int > > >
type t = < a : int ; b : < a : int ; b : < c : int -> int > ; > c : int >
type ' a t = | Bla : < x : int > t | Blo : < y : int > t
let e = begin true end
let e = ( true : bool )
let e = true , false , true
let e = Some true
let e = ` _ true
let e = true :: false :: true
let e = [ true ; false ; true ; ]
let e = [ | true ; false ; true ] |
let e = { f1 = true ; f2 = false ; f3 = true ; }
let e = { e with f1 = true ; f2 = false ; }
let e = f true false true
let e = !? true
let e = true || false && true
let e = 1 mod 1 land 1 lor 1 lxor 1 lsl 1 lsr 1 asr 1
let e = re . f1 <- true
let e = a . ( 0 ) <- true
let e = a . [ 0 ] <- true
let e = if true then false else true
let e = while true do ( ) done
let e = for x = a to b do ( ) done
let e = true ; false ; true
let e = match true with | true -> false | false -> true
let e = match true with | true -> false | false -> true
let e = function | true -> false | false -> true
let e = fun x ~ lbl1 ~ ( lbl2 : int ) ~ lbl3 : _a ? olbl1 ? ( olbl2 : ' a list = [ ] ) ? olbl3 : _c ? olbl4 : ( _d : bool = false ) ( ) when true -> true
let e = fun x -> fun ~ lbl1 -> fun ~ ( lbl2 : int ) -> fun ~ lbl3 : _a -> fun ? olbl1 -> fun ? ( olbl2 : ' a list = [ ] ) -> fun ? olbl3 : _c when true -> fun ? olbl4 : ( _d : bool = false ) -> fun ( ) when true -> true
let e x ~ lbl1 ~ ( lbl2 : int ) ~ lbl3 : _a ? olbl1 ? ( olbl2 : ' a list = [ ] ) ? olbl3 : _c ? olbl4 : ( _d : bool = false ) ( ) = true
let e = try true with | Exit -> true | _ -> false
let e = let rec a = true and _b = false in true
let e = new foo
let foo = object end
let e = foo # bar1
let e = ( true :> bool )
let e = ( true : bool :> bool )
let e = assert true
let e = lazy true
let i = 12l + 0l
let i = 12L + 0l
let i = 12n + 0n
let f = function | ' a ' . . ' z ' -> e1 | ' A ' . . ' Z ' | ' 0 ' . . ' 9 ' -> e2
let f = let module M = F ( struct end ) in M . f x
module rec M : S = struct ; ; end struct ; ; end
type t = private X of string | Y
type t = private { f1 : t1 ; f2 : t2 }
type t = private t '
let _ = let open F ( X ) in ( )
let _ = let x = 1 and y = 2 in { x ; y }
let f = function | { x ; y ; _ } -> ( )
let f = fun ( type t ) ( x : t ) -> ( )
let f ( type t ) ( x : t ) = ( )
type m = ( module M . Sig with type t = ' b ) * unit
let x = let m = ( module M : M . Sig with type t = ' b ) in let module M = ( val m : M . sig with type t = ' b ) in M
module type S = sig include module type of M end
module type S = sig include M0 with type t := t val x : unit end inherit ! cl val ! v = v method ! m = m end
type _ t = A : int t | B : ' a t * ' b t -> ( ' a ' * b ) t
module M = struct end
module M = struct ; ; end
module M = functor ( M1 : T1 ) -> functor ( M2 : T2 ) -> struct end
module M = functor ( M1 : T1 ) -> functor ( M2 : T2 ) -> struct end
module M = functor ( M1 : T1 ) -> functor ( M2 : T2 ) -> struct end
module M = functor ( M1 : T1 ) -> functor ( M2 : T2 ) -> struct end
module M = F ( X ) ( Y )
module M = ( struct sig end )
module M : Sig = struct end
module M ( X1 : T1 ) ( X2 : T2 ) =
module type T = M . T
module type T = sig end
module type T = sig ; ; end
module type T = functor ( M : T ) -> functor ( M1 : T1 ) -> sig end
sig end and module M = M ' . MF ( X ) and type t ' = t ' '
module type T = ( sig end )
module type T = sig val v : t external x : ' a = " stub " type t = int and t2 = t exception Error of int class virtual [ ' a ] cl : object end and cl2 : object end class type clt = object end and [ ' a ] clt2 = object end module M : Sig module M ( X ) ( Y ) : Sig module type Sig module type Sig1 = sig end open M include M end
type t type ' a t type ' + _a t type ' - a t type ( ' a , ' + b , ( ' - c , ' - d ) ) t
type t = A | B of ' a | C of ' a * ' b | D of ( ' a ) Array . t * ' b list | E of _
type t = { f1 : t1 ; f2 : ' a ; mutable f3 : t2 ; f4 : ' a ' b . t2 ; }
type ' a t constraint ' a = t constraint ' b = ' a type ( ' a , ' + b , ( ' - c , ' - d ) ) t = { f1 : t1 ; f2 : ' a ; mutable f3 : t2 ; f4 : t1 * t2 ; } constraint ' a = t constraint ' b = ' a exception E exception E of ' a t * string exception E ' = E
' ident _ ( t ) int -> int -> t -> t -> t lab1 : int -> lab2 : ( t ) -> t ? lab1 : ( ? _ : int -> t ) -> t ( t1 * t2 ) * ( t ) int ( ' a -> ' b ) Array . t int as ' bla [ ` _ | ` _ ' | ` _00 | ` Aa of int ] | ` _ | ` _ ' | ` _00 | ` Aa of int ] ` _ | ` _ ' | ` _00 | ` Aa of int ] [ | ` _ | ` _ ' | ` _00 | ` Aa of int ] | ` Bb of int & string & t | int > ` a ` _bbb ` c ` d ] < > < . . > < meth : int option ; meth2 : ' a . ' a option ; meth3 : ' a ' b . ( ' a , ' b ) Hashtbl . t > < meth : int option ; meth2 : ' a . ' a option ; meth3 : ' a ' b . ( ' a , ' b ) Hashtbl . t ; . . > # M . meth ' a # M . meth ( ' a , ' b ' * c ) # M . meth
let catch ( ? catch_only = fun _ -> true ) f = match f ( ) with | ( ) -> ( ) | exception ( ( Stack_overflow | Out_of_memory ) as e ) -> raise e | exception e -> if catch_only e then ( ) else raise e
let catch_f ( ? catch_only = fun _ -> true ) f h = match f ( ) with | ( ) -> ( ) | exception ( ( Stack_overflow | Out_of_memory ) as e ) -> raise e | exception e -> if catch_only e then h e else raise e