text
stringlengths
0
601k
type ' a working_list = { indice : int ; clean : unit -> unit ; pop : unit ' -> a option ; push : ' a -> unit ; list : unit -> ' a list ; exists : ( ' a -> bool ) -> bool ; member : ' a -> bool ; not_empty : unit -> bool ; copy : unit ' -> a working_list }
let rec make n = let h = Hashtbl . create n in let l = Queue . create ( ) in let push a = try ( Hashtbl . find h a ) with _ -> ( Queue . add a l ; let pop ( ) = try ( let k = Queue . take l in Hashtbl . remove h k ; Some k ) with _ -> None in let not_empty ( ) = match pop ( ) with | Some a -> let ( ) = push a in true |...
let _wmap parameters _error f l = let rep = make ( Remanent_parameters . get_empty_hashtbl_size parameters ) in List . map ( fun x -> rep . push ( f x ) ) ( l . list ( ) )
let indice wl = wl . indice
let clean wl = wl . clean ( )
let list wl = wl . list ( )
let pop wl = wl . pop ( )
let push a wl = wl . push a
let exists p wl = wl . exists p
let not_empty wl = wl . not_empty ( )
let copy wl = wl . copy ( )
let member a wl = wl . member a
module Make = functor ( S : EqConstrSys ) -> functor ( HM : Hashtbl . S with type key = S . v ) -> struct include Generic . SolverStats ( S ) ( HM ) module VS = Set . Make ( S . Var ) open S . Dom let eq x get set = match S . system x with | None -> bot ( ) | Some f -> eval_rhs_event x ; f get set let solve _ st vs = l...
let _ = Selector . add_solver ( " WL " , ( module EqIncrSolverFromEqSolver ( Make ) ) ) ;
module Cell = struct module Type = struct type t = | Boolean | Error | Inline_string | Number | Shared_string | Formula_string [ @@ deriving sexp_of ] let of_string = function | " b " -> Boolean | " e " -> Error | " inlineStr " -> Inline_string | " n " -> Number | " s " -> Shared_string | " str " -> Formula_string | st...
module Row = struct type t = { cells : Cell . t list ; collapsed : bool ; custom_format : bool ; custom_height : bool ; hidden : bool ; height : float option ; outline_level : uint8 ; show_phonetic : bool ; row_index : uint32 option ; style_index : uint32 ; thick_bottom_border : bool ; thick_top_border : bool } [ @@ de...
module Column = struct type t = { best_fit : bool ; collapsed : bool ; custom_width : bool ; hidden : bool ; max : uint32 ; min : uint32 ; outline_level : uint8 ; show_phonetic : bool ; default_style : uint32 ; width : float option } [ @@ deriving fields , sexp_of ] let of_xml = function | Xml . Element ( " col " , att...
type t = { columns : Column . t list ; rows : Row . t list } [ @@ deriving fields , sexp_of ]
let default = { columns = [ ] ; rows = [ ] }
let of_xml = expect_element " worksheet " ( fun _ -> let open Xml in List . fold ~ init : default ~ f ( : fun acc -> function | Element ( " cols " , _ , children ) -> { acc with columns = List . filter_map children ~ f : Column . of_xml } | Element ( " sheetData " , _ , children ) -> { acc with rows = List . filter_map...
type role = [ ` Chair | ` Co_chair ]
let role_to_string = function ` Chair -> " chair " | ` Co_chair -> " co - chair "
let role_of_string = function | " chair " -> Ok ` Chair | " co - chair " -> Ok ` Co_chair | _ -> Error ( ` Msg " Unknown role type ) "
let role_of_yaml = function | ` String s -> Result . bind ( role_of_string s ) s ( fun t -> Ok t ) t | _ -> Error ( ` Msg " Expected a string for a role type ) "
let role_to_yaml t = ` String ( role_to_string t ) t
type important_date = { date : string ; info : string } [ @@ deriving yaml ] yaml
type committee_member = { name : string ; role : role option ; affiliation : string option ; picture : string option ; }
type presentation = { title : string ; authors : string list ; link : string option ; video : string option ; slides : string option ; poster : bool option ; additional_links : string list option ; }
type metadata = { title : string ; location : string ; date : string ; important_dates : important_date list ; presentations : presentation list ; program_committee : committee_member list ; organising_committee : committee_member list ; }
let path = Fpath . v " data / workshops "
let parse content = let metadata , _ = Utils . extract_metadata_body content in metadata_of_yaml metadata
type t = { title : string ; slug : string ; location : string ; date : string ; important_dates : important_date list ; presentations : presentation list ; program_committee : committee_member list ; organising_committee : committee_member list ; toc_html : string ; body_md : string ; body_html : string ; }
let all ( ) = Utils . map_files ( fun content -> let metadata , body = Utils . extract_metadata_body content in let metadata = Utils . decode_or_raise metadata_of_yaml metadata in let omd = Omd . of_string body in { title = metadata . title ; slug = Utils . slugify metadata . title ; location = metadata . location ; da...
let pp_role ppf = function | ` Chair -> Fmt . string ppf " ` Chair " | ` Co_chair -> Fmt . string ppf " ` Co_chair "
let pp_important_date ppf ( v : important_date ) important_date = Fmt . pf ppf { | { date = % a ; info = % a ; } } | Pp . string v . date Pp . string v . info
let pp_committee_member ppf ( v : committee_member ) committee_member = Fmt . pf ppf { | { name = % a ; role = % a ; affiliation = % a ; picture = % a ; } } | Pp . string v . name Pp ( . option pp_role ) pp_role v . role Pp ( . option string ) string v . affiliation Pp ( . option string ) string v . picture
let pp_presentation ppf ( v : presentation ) presentation = Fmt . pf ppf { | { title = % a ; authors = % a ; link = % a ; video = % a ; slides = % a ; poster = % a ; additional_links = % a ; } } | Pp . string v . title Pp . string_list v . authors Pp ( . option string ) string v . link Pp ( . option string ) string v ....
let pp ppf v = Fmt . pf ppf { | { title = % a ; slug = % a ; location = % a ; date = % a ; important_dates = % a ; presentations = % a ; program_committee = % a ; organising_committee = % a ; body_md = % a ; toc_html = % a ; body_html = % a } } | Pp . string v . title Pp . string v . slug Pp ( . string ) string v . loc...
let pp_list = Pp . list pp
let template ( ) = Format . asprintf { |
type role = [ ` Chair | ` Co_chair ]
type important_date = { date : string ; info : string }
type committee_member = { name : string ; role : role option ; affiliation : string option ; picture : string option ; }
type presentation = { title : string ; authors : string list ; link : string option ; video : string option ; slides : string option ; poster : bool option ; additional_links : string list option ; }
type t = { title : string ; slug : string ; location : string ; date : string ; important_dates : important_date list ; presentations : presentation list ; program_committee : committee_member list ; organising_committee : committee_member list ; toc_html : string ; body_md : string ; body_html : string ; }
let all = % a } | pp_list ( all ( ) )
let env_field , env_field_lazy = let make f g = field " env " ~ default ( : f Dune_env . Stanza . empty ) ( g ( Dune_lang . Syntax . since syntax ( 1 , 1 ) >>> Dune_env . Stanza . decode ) ) in ( make Fun . id Fun . id , make Lazy . from_val lazy_ )
module Context = struct module Target = struct type t = | Native | Named of Context_name . t let equal x y = match ( x , y ) with | Native , Native -> true | Native , _ | _ , Native -> false | Named x , Named y -> Context_name . equal x y let t = let + context_name = Context_name . decode in match Context_name . to_str...
type t = { merlin_context : Context_name . t option ; contexts : Context . t list ; env : Dune_env . Stanza . t ; config : Dune_config . t }
let to_dyn { merlin_context ; contexts ; env ; config } = let open Dyn in record [ ( " merlin_context " , option Context_name . to_dyn merlin_context ) ; ( " contexts " , list Context . to_dyn contexts ) ; ( " env " , Dune_env . Stanza . to_dyn env ) ; ( " config " , Dune_config . to_dyn config ) ]
let equal { merlin_context ; contexts ; env ; config } w = Option . equal Context_name . equal merlin_context w . merlin_context && List . equal Context . equal contexts w . contexts && Dune_env . Stanza . equal env w . env && Dune_config . equal config w . config
let hash { merlin_context ; contexts ; env ; config } = Hashtbl . hash ( Option . hash Context_name . hash merlin_context , List . hash Context . hash contexts , Dune_env . Stanza . hash env , Dune_config . hash config ) type t = unit end )
let ( ) = Lang . register syntax ( )
module Clflags = struct type t = { x : Context_name . t option ; profile : Profile . t option ; instrument_with : Lib_name . t list option ; workspace_file : Path . t option ; config_from_command_line : Dune_config . Partial . t ; config_from_config_file : Dune_config . Partial . t } let to_dyn { x ; profile ; instrume...
let bad_configuration_check map = let find_exn loc name host = match Context_name . Map . find map host with | Some host_ctx -> host_ctx | None -> User_error . raise ~ loc [ Pp . textf " Undefined host context ' % s ' for ' % s ' . " ( Context_name . to_string host ) ( Context_name . to_string name ) ] in let check elt...
let top_sort contexts = let key = Context . name in let map = Context_name . Map . of_list_map_exn contexts ~ f ( : fun x -> ( key x , x ) ) in let deps def = match Context . host_context def with | None -> [ ] | Some ctx -> [ Context_name . Map . find_exn map ctx ] in bad_configuration_check map ; match Context_name ....
let create_final_config ~ config_from_config_file ~ config_from_command_line ~ config_from_workspace_file = let ( ++ ) = Dune_config . superpose in Dune_config . default ++ config_from_config_file ++ config_from_workspace_file ++ config_from_command_line
module Step1 = struct type nonrec t = { t : t Lazy . t ; config : Dune_config . t } end
let step1 clflags = let { Clflags . x ; profile = cl_profile ; instrument_with = cl_instrument_with ; workspace_file = _ ; config_from_command_line ; config_from_config_file } = clflags in let x = Option . map x ~ f ( : fun s -> Context . Target . Named s ) in let superpose_with_command_line cl field = let + x = field ...
let step1 clflags = fields ( step1 clflags )
let default clflags = let { Clflags . x ; profile ; instrument_with ; workspace_file = _ ; config_from_command_line ; config_from_config_file } = clflags in let x = Option . map x ~ f ( : fun s -> Context . Target . Named s ) in let config = create_final_config ~ config_from_config_file ~ config_from_command_line ~ con...
let default_step1 clflags = let t = default clflags in { Step1 . t = lazy t ; config = t . config }
let load_step1 clflags p = Io . with_lexbuf_from_file p ~ f ( : fun lb -> if Dune_lexer . eof_reached lb then default_step1 clflags else parse_contents lb ~ f ( : fun lang -> String_with_vars . set_decoding_env ( Pform . Env . initial lang . version ) ( step1 clflags ) ) )
let workspace_step1 = let open Memo . O in let f ( ) = let clflags = Clflags . t ( ) in let + workspace_file = match clflags . workspace_file with | None -> let p = Path . of_string filename in let + exists = Fs_memo . file_exists p in Option . some_if exists p | Some p -> ( Fs_memo . file_exists p >>| function | true ...
let workspace_config ( ) = let open Memo . O in let + step1 = workspace_step1 ( ) in step1 . config
let workspace = let open Memo . O in let f ( ) = let + step1 = workspace_step1 ( ) in Lazy . force step1 . t in let memo = Memo . create " workspace " ~ input ( : module Unit ) ~ cutoff : equal f in Memo . exec memo
let update_execution_parameters t ep = ep |> Execution_parameters . set_action_stdout_on_success t . config . action_stdout_on_success |> Execution_parameters . set_action_stderr_on_success t . config . action_stderr_on_success
let build_contexts t = List . concat_map t . contexts ~ f : Context . build_contexts
module Uri_map = Map . Make ( struct include Uri let compare x y = Ordering . of_int ( compare x y ) end )
type t = { workspace_folders : WorkspaceFolder . t Uri_map . t option ; root_uri : Uri . t option ; root_path : string option }
let create ( ip : InitializeParams . t ) = let workspace_folders = match ip . workspaceFolders with | None | Some None -> None | Some ( Some workspace_folders ) -> Uri_map . of_list_map_exn workspace_folders ~ f ( : fun ( ws : WorkspaceFolder . t ) -> ( ws . uri , ws ) ) |> Option . some in let root_uri = ip . rootUri ...
let on_change t { DidChangeWorkspaceFoldersParams . event = { added ; removed } } = assert ( t . workspace_folders <> None ) ; let workspace_folders = let init = Option . value t . workspace_folders ~ default : Uri_map . empty in let init = List . fold_left removed ~ init ~ f ( : fun acc ( a : WorkspaceFolder . t ) -> ...
let workspace_folders { root_uri ; root_path ; workspace_folders } = match workspace_folders with | Some s -> Uri_map . values s | None -> ( match ( workspace_folders , root_uri , root_path ) with | Some workspace_folders , _ , _ -> Uri_map . values workspace_folders | _ , Some root_uri , _ -> [ WorkspaceFolder . creat...
module Kind = struct type t = | Explicit | Dune_workspace | Dune_project | Cwd let priority = function | Explicit -> 0 | Dune_workspace -> 1 | Dune_project -> 2 | Cwd -> 3 let lowest_priority = max_int let of_dir_contents files = if String . Set . mem files Workspace . filename then Some Dune_workspace else if String ....
type t = { dir : string ; to_cwd : string list ; reach_from_root_prefix : string ; kind : Kind . t }
module Candidate = struct type t = { dir : string ; to_cwd : string list ; kind : Kind . t } end
let find ( ) = let cwd = Sys . getcwd ( ) in let rec loop counter ( ~ candidate : Candidate . t option ) ~ to_cwd dir : Candidate . t option = match Sys . readdir dir with | exception Sys_error msg -> User_warning . emit [ Pp . textf " Unable to read directory % s . Will not look for root in parent \ directories . " di...
let create ~ default_is_cwd ~ specified_by_user = match match specified_by_user with | Some dn -> Some { Candidate . kind = Explicit ; dir = dn ; to_cwd = [ ] } | None -> ( let cwd = { Candidate . kind = Cwd ; dir = " . " ; to_cwd = [ ] } in if Dune_util . Config . inside_dune then Some cwd else match find ( ) with | S...
let browse_of_cmt ( cmt_infos : Cmt_format . cmt_infos ) : Browse_raw . node option = match cmt_infos . cmt_annots with | Implementation str -> Some ( Structure str ) | Interface sig_ -> Some ( Signature sig_ ) | Packed _ | Partial_implementation _ | Partial_interface _ -> None
let is_directory dir = try Sys . is_directory dir with Sys_error _ -> false
type error = Build_dir_not_found of string
let find_build_dir ( { name ; uri } : WorkspaceFolder . t ) = let build_dir = Filename . concat ( Uri . to_path uri ) " _build / default " in if is_directory build_dir then Ok build_dir else Error ( Build_dir_not_found name )
type cm_file = | Cmt of string | Cmti of string
let string_of_cm cm = match cm with | Cmt f | Cmti f -> f
module Outline : sig val get : Merlin_analysis . Browse_tree . t list -> Query_protocol . item list module Location = Loc open Merlin_utils open Merlin_analysis open Std open Option . Infix open Typedtree open Browse_raw open Browse_tree let id_of_patt = function | { pat_desc = Tpat_var ( id , _ ) ; _ } -> Some id | _ ...
let symbols_from_cm_file ~ filter root_uri cm_file = let cmt = let filename = string_of_cm cm_file in Cmt_format . read_cmt filename in match cmt . cmt_sourcefile with | None -> [ ] | Some sourcefile -> ( match Filename . extension sourcefile with | " . ml " | " . mli " -> ( match browse_of_cmt cmt with | None -> [ ] |...
let find_cm_files dir = let choose_file f1 f2 = match ( f1 , f2 ) with | ( Cmt _ as f ) , _ | _ , ( Cmt _ as f ) -> f | ( Cmti _ as f ) , Cmti _ -> f in let rec loop acc dir = let contents = Sys . readdir dir in Array . fold_left contents ~ init : acc ~ f ( : fun acc fname -> let path = Filename . concat dir fname in i...
let run ( { query ; _ } : WorkspaceSymbolParams . t ) ( workspace_folders : WorkspaceFolder . t list ) = let filter = match query with | " " -> fun x -> x | query -> let re = Re . str query |> Re . compile in List . filter ~ f ( : fun ( symbol : SymbolInformation . t ) -> Re . execp re symbol . name ) in List . map wor...
module Make ( Inputs : Intf . Inputs_intf ) Inputs_intf = struct module Work_spec = Snark_work_lib . Work . Single . Spec module Job_status = struct type t = Assigned of Time . t let is_old ( Assigned at_time ) at_time ~ now ~ reassignment_wait = let max_age = Time . Span . of_ms ( Float . of_int reassignment_wait ) re...
let anglex = ref 0 . 0
let angley = ref 30 . 0
let anglez = ref 0 . 0
let ball_radius = wall_size . / 3 . 0
let resting_space = spring_thickness . * spring_ncoils . + ( 2 . 0 . * ball_radius )
let left_offset = . - distance . / 4 . 0
let w1 = 0 . 0 . - ( wall_width . / 2 . 0 ) . - resting_space
let w2 = distance . + ( wall_width . / 2 . 0 ) . + resting_space
let lightOnePosition = ( 280 . 0 , 100 . 0 , 50 . 0 , 0 . 0 )
let lightAmbient = ( 0 . 5 , 0 . 5 , 0 . 5 , 1 . 0 )
let lightDiffuse = ( 0 . 2 , 0 . 2 , 0 . 2 , 1 . 0 )