text
stringlengths
0
601k
let refresh t state = { t with image = t . refresh state ; }
let with_window ~ title i = let w = I . width i in let h = I . height i in let title = let title = I . string A . ( fg yellow ) title in I . ( ( hsnap ~ align ` : Middle w ( left <|> title <|> right ) ) </> ( top_left <|> top w 1 <|> top_right ) ) in let bottom = I . ( ( bottom_left <|> top w 1 <|> bottom_right ) ) in ...
let render ~ window_h { image ; cursor ; title ; _ } = let image_h = I . height image in let crop_top = if cursor < window_h then 0 else cursor - window_h in let crop_bottom = if cursor + window_h > image_h then 0 else image_h - crop_top - window_h in let i = I . ( vcrop crop_top crop_bottom image |> vsnap window_h ) i...
module T = struct include Value . Make_subtype ( struct let name = " window " let here = [ % here ] let is_in_subtype = Value . is_window end ) let equal = eq end
type window = t [ @@ deriving sexp_of ]
module Edges = struct type t = { bottom : int ; left : int ; right : int ; top : int } [ @@ deriving sexp_of ] include Valueable . Make ( struct type nonrec t = t let type_ = Value . Type . ( map ( tuple int ( tuple int ( tuple int ( tuple int unit ) ) ) ) ~ name [ :% sexp " Window . Tree . Position_and_size . t " ] ) ...
module Tree = struct module Direction = struct module T = struct type t = | Left_to_right | Top_to_bottom [ @@ deriving enumerate , sexp_of ] end include T let is_top_to_bottom = function | Left_to_right -> false | Top_to_bottom -> true ; ; include Valueable . Make ( struct type nonrec t = t let type_ = Value . Type . ...
module type BoundedQueueWithCounter = sig type ' a t val empty : int -> ' a t val create : int -> ' a -> ' a t val is_empty : ' a t -> bool val is_full : ' a t -> bool val size : ' a t -> int val enqueue : ' a -> ' a t -> ' a t val dequeue : ' a t -> ' a option * ' a t val count : ' a t -> int val fold : ( ' b -> ' a -...
module Window : BoundedQueueWithCounter = struct type ' a t = { data : ( ' a list ) * ( ' a list ) ; maxsize : int ; size : int ; count : int } let empty n = if n = 0 then failwith " Cannot create queue of size 0 " ! else { data = ( [ ] , [ ] ) ; maxsize = n ; size = n ; count = 0 } let create n i = let rec gen l acc i...
let winnow w h = let global_pos i w = let c = Window . count w in let s = Window . size w in c - ( s - 1 - i ) in let mincheck ( ( minval , minpos ) , count ) x = if x <= minval then ( ( x , count ) , count + 1 ) else ( ( minval , minpos ) , count + 1 ) in let rec winnowhelper hashes window acc n ( v , p ) = if n = Lis...
let main ( ) = let top = opentk ( ) in let mbar = Frame . create top [ Relief Raised ; BorderWidth ( Pixels 2 ) ] and dummy = Frame . create top [ Width ( Centimeters 10 . ) ; Height ( Centimeters 5 . ) ] in pack [ mbar ; dummy ] [ Side Side_Top ; Fill Fill_X ] ; let file = Menubutton . create mbar [ Text " File " ; Un...
let _ = Printexc . catch main ( )
let of_int = function | 0 -> Some ( Success ) | 1 -> Some ( Invalid_function ) | 2 -> Some ( File_not_found ) | 3 -> Some ( Path_not_found ) | 4 -> Some ( Too_many_open_files ) | 5 -> Some ( Access_denied ) | 6 -> Some ( Invalid_handle ) | 7 -> Some ( Arena_trashed ) | 8 -> Some ( Not_enough_memory ) | 9 -> Some ( Inva...
type t = | Success | Invalid_function | File_not_found | Path_not_found | Too_many_open_files | Access_denied | Invalid_handle | Arena_trashed | Not_enough_memory | Invalid_block | Bad_environment | Bad_format | Invalid_access | Invalid_data | Outofmemory | Invalid_drive | Current_directory | Not_same_device | No_more_...
type telnet_command = | SUBNEG_END [ @ id 240 ] | NOP [ @ id 241 ] | DATA_MARK [ @ id 242 ] | BREAK [ @ id 243 ] | INTERRUPT_PROCESS [ @ id 244 ] | ABORT_OUTPUT [ @ id 245 ] | ARE_YOU_THERE [ @ id 246 ] | ERASE_CHARACTER [ @ id 247 ] | ERASE_LINE [ @ id 248 ] | GO_AHEAD [ @ id 249 ] | SUBNEG [ @ id 250 ] | WILL [ @ id ...
type telnet_option = | Binary_Transmission | Echo | Reconnection | Suppress_Go_Ahead | Approx_Message_Size_Negotiation | Status | Timing_Mark | Remote_Controlled_Trans_and_Echo | Output_Line_Width | Output_Page_Size | Output_Carriage_Return_Disposition | Output_Horizontal_Tab_Stops | Output_Horizontal_Tab_Disposition |...
type pc = int * int
let _read_pc conn = let % lwt frag_num = Lwt_io . BE . read_int conn . io . in_ in let % lwt pos = Lwt_io . BE . read_int conn . io . in_ in Lwt . return ( frag_num , pos ) pos
let _write_pc conn ( frag_num , pos ) pos = Lwt_io . BE . write_int conn . io . out frag_num ; % lwt Lwt_io . BE . write_int conn . io . out pos
let set_fork_mode conn mode = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' K ' ; % lwt Lwt_io . BE . write_int conn . io . out ( match mode with ` Fork_child -> 0 | ` Fork_parent -> 1 ) 1 ) 1
let set_event conn pc = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' e ' ; % lwt _write_pc conn pc ) pc
let set_breakpoint conn pc = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' B ' ; % lwt _write_pc conn pc ) pc
let reset_instr conn pc = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' i ' ; % lwt _write_pc conn pc ) pc
let set_trap_barrier conn pos = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' b ' ; % lwt Lwt_io . BE . write_int conn . io . out pos ) pos
let checkpoint conn = Lwt_conn . atomic conn ( fun conn -> if Sys . win32 then raise Operation_system_unsupported else Lwt_io . write_char conn . io . out ' c ' ; % lwt let % lwt pid = Lwt_io . BE . read_int conn . io . in_ in if pid = - 1 then assert false else Lwt . return pid ) pid
type execution_summary = [ ` Event | ` Breakpoint | ` Exited | ` Trap_barrier | ` Uncaught_exc | ` Debug_info of int Ident . Map . t * ( Instruct . debug_event list * string list ) list list | ` Code_loaded of int | ` Code_unloaded of int ]
let go conn steps = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' g ' ; % lwt Lwt_io . BE . write_int conn . io . out steps ; % lwt let % lwt summary = match % lwt Lwt_io . read_char conn . io . in_ with | ' e ' -> Lwt . return ` Event | ' b ' -> Lwt . return ` Breakpoint | ' x ' -> Lwt . r...
let wait conn = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' w ' ) ' w '
let stop conn = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' s ' ) ' s '
let initial_frame conn = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' 0 ' ; % lwt let % lwt stack_pos = Lwt_io . BE . read_int conn . io . in_ in let % lwt pc = _read_pc conn in Lwt . return ( stack_pos , pc ) pc ) pc
let get_frame conn = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' f ' ; % lwt let % lwt stack_pos = Lwt_io . BE . read_int conn . io . in_ in let % lwt pc = _read_pc conn in Lwt . return ( stack_pos , pc ) pc ) pc
let set_frame conn stack_pos = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' S ' ; % lwt Lwt_io . BE . write_int conn . io . out stack_pos ) stack_pos
let up_frame conn stacksize = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' U ' ; % lwt Lwt_io . BE . write_int conn . io . out stacksize ; % lwt let % lwt stack_pos = Lwt_io . BE . read_int conn . io . in_ in let % lwt res = if stack_pos = - 1 then Lwt . return None else let % lwt pc = _re...
let _read_remote_value conn = Lwt_io . read_string_exactly conn . io . in_ ( Sys . word_size / 8 ) 8
let _write_remote_value conn rv = Lwt_io . write conn . io . out rv
let get_local conn index = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' L ' ; % lwt Lwt_io . BE . write_int conn . io . out index ; % lwt let % lwt rv = _read_remote_value conn in Lwt . return rv ) rv
let get_environment conn index = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' E ' ; % lwt Lwt_io . BE . write_int conn . io . out index ; % lwt let % lwt rv = _read_remote_value conn in Lwt . return rv ) rv
let get_global conn index = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' G ' ; % lwt Lwt_io . BE . write_int conn . io . out index ; % lwt let % lwt rv = _read_remote_value conn in Lwt . return rv ) rv
let get_accu conn = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' A ' ; % lwt let % lwt rv = _read_remote_value conn in Lwt . return rv ) rv
let get_header conn rv = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' H ' ; % lwt _write_remote_value conn rv ; % lwt let % lwt hdr = Lwt_io . BE . read_int conn . io . in_ in Lwt . return hdr ) hdr
let get_field conn rv index = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' F ' ; % lwt _write_remote_value conn rv ; % lwt Lwt_io . BE . write_int conn . io . out index ; % lwt let % lwt res = match % lwt Lwt_io . read_char conn . io . in_ with | ' \ 000 ' -> let % lwt rv = _read_remote_va...
let marshal_obj conn rv = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' M ' ; % lwt _write_remote_value conn rv ; % lwt let % lwt v = Lwt_io . read_value conn . io . in_ in Lwt . return v ) v
let get_closure_code conn rv = Lwt_conn . atomic conn ( fun conn -> Lwt_io . write_char conn . io . out ' C ' ; % lwt _write_remote_value conn rv ; % lwt let % lwt pc = _read_pc conn in Lwt . return pc ) pc
type t = | Varint | Sixty_four | Length_delimited | Start_group | End_group | Thirty_two
let of_int = function | 0 -> Varint | 1 -> Sixty_four | 2 -> Length_delimited | 3 -> Start_group | 4 -> End_group | 5 -> Thirty_two | n -> Printf . kprintf invalid_arg " Wire_type . of_int ( % d ) " n
let to_int = function | Varint -> 0 | Sixty_four -> 1 | Length_delimited -> 2 | Start_group -> 3 | End_group -> 4 | Thirty_two -> 5
let to_string = function | Varint -> " Varint " | Sixty_four -> " Sixty_four " | Length_delimited -> " Length_delimited " | Start_group -> " Start_group " | End_group -> " End_group " | Thirty_two -> " Thirty_two "
let pp fmt v = Format . pp_print_string fmt ( to_string v )
let to_http service region req = let uri = Uri . add_query_params ( Uri . of_string ( Aws . Util . of_option_exn ( Endpoints . url_of service region ) ) ) ( List . append [ ( " Version " , [ " 2016 - 11 - 15 " ] ) ; ( " Action " , [ " WithdrawByoipCidr " ] ) ] ( Util . drop_empty ( Uri . query_of_encoded ( Query . rend...
let of_http body = try let xml = Ezxmlm . from_string body in let resp = Xml . member " WithdrawByoipCidrResponse " ( snd xml ) in try Util . or_error ( Util . option_bind resp WithdrawByoipCidrResult . parse ) ( let open Error in BadResponse { body ; message = " Could not find well formed WithdrawByoipCidrResult . " }...
let parse_error code err = let errors = [ ] @ Errors_internal . common in match Errors_internal . of_string err with | Some var -> if ( List . mem var errors ) && ( ( match Errors_internal . to_http_code var with | Some var -> var = code | None -> true ) ) then Some var else None | None -> None
let invalid name loc = Invalid_argument ( Printf . sprintf " % s called from % s " name loc )
module Option = struct let get ~ loc = function | Some v -> v | None -> raise ( invalid " Lwtreslib . WithExceptions . Option . get " loc ) let to_exn ~ none = function Some v -> v | None -> raise none let to_exn_f ~ none = function Some v -> v | None -> raise ( none ( ) ) end
module Result = struct let get_ok ~ loc = function | Ok v -> v | Error _ -> raise ( invalid " Lwtreslib . WithExceptions . Result . get_ok " loc ) let get_error ~ loc = function | Error e -> e | Ok _ -> raise ( invalid " Lwtreslib . WithExceptions . Result . get_error " loc ) let to_exn = function Ok v -> v | Error exc...
module List = struct let rev_combine ~ loc xs ys = let rec aux acc xs ys = match ( xs , ys ) with | ( [ ] , [ ] ) -> acc | ( x :: xs , y :: ys ) -> aux ( ( x , y ) :: acc ) xs ys | ( [ ] , _ :: _ ) | ( _ :: _ , [ ] ) -> raise ( invalid " Lwtreslib . WithExceptions . List . rev_combine " loc ) in aux [ ] xs ys let combi...
module type S_bigarray = sig open Bigarray type ' a t val bigstring : ( char , int8_unsigned_elt , c_layout ) Array1 . t t val float32_vec : ( float , float32_elt , fortran_layout ) Array1 . t t val float64_vec : ( float , float64_elt , fortran_layout ) Array1 . t t val float32_mat : ( float , float32_elt , fortran_lay...
module type S = sig type ' a t val unit : unit t val bool : bool t val char : char t val string : string t val int : int t val int32 : int32 t val int63 : Int63 . t t val int64 : int64 t val nativeint : nativeint t val float : float t val sexp : Sexp . t t val option : ' a t -> ' a option t val list : ' a t -> ' a list...
let ( ) = Css . install_css ( )
module Legend_model = struct type t = { visibility : bool list } [ @@ deriving equal , fields ] end
let id = Type_equal . Id . create ~ name " : dygraph " [ % sexp_of : opaque ]
let widget ? with_graph ? on_zoom data options = let resize_when_inserted_into_the_dom graph _time = Graph . resize graph in let override_zoom_callback ~ graph options = match on_zoom with | None -> options | Some on_zoom -> let zoomCallback = let caller ' s_zoom_callback = Options . zoomCallback options in fun ~ xmin ...
let create_graph ? with_graph ? on_zoom data options = let on_zoom = match on_zoom with | None -> Bonsai . Value . return None | Some on_zoom -> Bonsai . Value . map on_zoom ~ f : Option . some in return ( let % map . Bonsai data = data and options = options and on_zoom = on_zoom in widget ? with_graph ? on_zoom data o...
let create_options ~ x_label ~ y_labels ~ visibility ~ legendFormatter = let labels = x_label :: y_labels in let hidden_legend = Dom_html . createDiv Dom_html . document in Options . create ( ) ~ xlabel : x_label ~ labels ~ visibility ~ legend ` : always ~ labelsDiv_el : hidden_legend ~ legendFormatter ; ;
let create_default_legend ~ x_label ~ per_series_info = let % sub model , view , inject = Default_legend . create ~ x_label ~ per_series_info in let model = let % map model = model in { Legend_model . visibility = List . map model . series ~ f : Default_legend . Model . Series . is_visible } in let inject = let % map i...
let format_legend inject_legend_data options data = let caller ' s_legend_formatter = Option . bind options ~ f : Options . legendFormatter in Option . iter caller ' s_legend_formatter ~ f ( : fun f -> ignore ( f data : string ) ) ; Vdom . Effect . Expert . handle_non_dom_event_exn ( inject_legend_data data ) ; " this ...
let build_options options visibility legendFormatter x_label y_labels = let our_options = create_options ~ x_label ~ y_labels ~ visibility ~ legendFormatter in match options with | None -> our_options | Some options -> Options . merge options ~ prefer : our_options ; ;
let visibility ~ legend_model ~ num_series = let visibility = let % map . Bonsai visibility_from_legend = legend_model >>| Legend_model . visibility and num_series = num_series in let visibility_len = List . length visibility_from_legend in if visibility_len < num_series then ( let padding = List . init ( num_series - ...
let create ~ key ~ x_label ~ per_series_info ? custom_legend ? options ? with_graph ? on_zoom ~ data ( ) = let options = Option . value_map options ~ default ( : Bonsai . Value . return None ) ~ f ( : Bonsai . Value . map ~ f : Option . some ) in let % sub legend = match custom_legend with | Some legend -> Bonsai . rea...
module type s = sig class type c = object method m : int end } ] |
module type s = sig class type ct = object method m : int end } ] |
module type s = sig type top and t = private < . . > and mid and u = private < . . > and v with type u = private < . . >
module type s = sig type top and t = private < . . > and mid and u = private < . . > and v end } ] |
let f x = match x with
let f = fun x -> match x with
let f = let g x = match x with | ` A -> " A " | ` B -> " B " in g
let f = let g = function | ` A -> " A " | ` B -> " B " in g
let f = let g = fun x -> match x with | ` A -> " A " | ` B -> " B " in g
let z = begin match x with | X -> x end
let config_converter = ( fun str -> try ignore ( IndentConfig . update_from_string IndentConfig . default str ) ; ` Ok str with Invalid_argument s -> ` Error s ) , ignore ( IndentConfig . update_from_string IndentConfig . default str ) ; ` Ok str
let f = try match a with B -> x with C -> y
let g = try match X with | X -> X with | X -> Y
type ' a return = { return : ' b . ' a -> ' b } [ @@ unboxed ]
let with_return ( type a ) f = let module M = struct exception Return of a end in let is_alive = ref true in let return a = if not ! is_alive then failwith " use of [ return ] from a [ with_return ] that already returned " ; Exn . raise_without_backtrace ( M . Return a ) in try let a = f { return } in is_alive := false...
let with_return_option f = with_return ( fun return -> f { return = ( fun a -> return . return ( Some a ) ) } ; None ) ; ;
let prepend { return } ~ f = { return = ( fun x -> return ( f x ) ) }
let str s = Sexp . Atom s
let list l = Sexp . List l
let ns_to_string = function | [ base ] -> [ base ] | base :: rst -> let seps = [ " . " ; " __ " ] in List . map ( fun sep -> base ^ sep ^ String . concat " . " rst ) seps | _ -> assert false
let ns_expend ns m = let m = of_coq_name m in match ns with " " -> m | ns -> ns ^ " . " ^ m
let type_to_sexp ~ libname ~ rev_namespace ~ coqns conflicts typ = let coqt = ns_expend coqns ( Conflict . get_coq_type rev_namespace conflicts ~ ty : typ . type_name ) in List . map ( fun sep -> list [ str ( libname ^ sep ^ String . concat " . " ( List . rev ( typ . type_name :: rev_namespace ) ) ) ; str " . " ; str c...
let mutually_recursive_type_to_sexp ~ libname ~ rev_namespace ~ coqns conflicts mt = Compat . concat_map ( type_to_sexp ~ libname ~ rev_namespace ~ coqns conflicts ) mt
let rec intro_to_sexp ~ libname ~ rev_namespace ~ coqns conflicts = function | Right mt -> mutually_recursive_type_to_sexp ~ libname ~ rev_namespace ~ coqns conflicts mt | Left m -> let rev_namespace = m . mod_name :: rev_namespace in let coqmod = Conflict . get_coq_module conflicts ~ m : m . mod_name in let coqns = ns...
let of_mod ~ coqns conflicts m = mod_to_sexp ~ libname ( : List . hd m . mod_namespace ) ~ rev_namespace [ : m . mod_name ] ~ coqns conflicts m
let pp fmt witness = let open Format in fprintf fmt " [ @< v 2 ( > translations % a ) ] " @ ( Pp . pp_list ~ pp_prefix : pp_print_space ~ pp_sep : pp_print_space Sexp . pp ) witness
module Node : Printable . S with type t = MyCFG . node = struct include Var let to_yojson = Node . to_yojson let show = Node . show_cfg let pretty = Node . pretty_trace let printXml f x = BatPrintf . fprintf f " < value >\ n < data >\ n % s \ n </ data >\ n </ value >\ n " ( XmlUtil . escape ( show x ) ) let name ( ) =...
module Edge : Printable . S with type t = MyARG . inline_edge = struct type t = MyARG . inline_edge [ @@ deriving to_yojson ] let equal = Util . equals let compare = Stdlib . compare let hash = Hashtbl . hash let name ( ) = " edge " let pretty = MyARG . pretty_inline_edge include Printable . SimplePretty ( struct type ...
module PathSensitive3 ( Spec : Spec ) : Spec = struct module I = struct include Spec . D let to_int = tag let name ( ) = " D " let printXml f d = BatPrintf . fprintf f " < value >% a </ value " > printXml d end module CC = struct include Spec . C let name ( ) = " C " let printXml f c = BatPrintf . fprintf f " < value >...
module NH = Hashtbl . Make ( Node )
module NS = Set . Make ( Node )
let find_main_entry entrystates = let ( main_entry_nodes , other_entry_nodes ) = entrystates |> List . map fst |> List . partition ( function | FunctionEntry f , _ -> f . svar . vname = " main " | _ , _ -> false ) in match main_entry_nodes , other_entry_nodes with | [ ] , _ -> failwith " no main_entry_nodes " | _ :: _ ...