text
stringlengths
12
786k
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 . ti...
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 ; b...
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 . ...
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 ) ; ( " co...
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 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_n...
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_confi...
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_comm...
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_f...
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 . ...
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 ) ) |> ...
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 ( ...
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 ro...
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...
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...
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 . ...
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 , _ )...
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 b...
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 fna...
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 ) ...
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_...
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 )
let read_state fin = try let s = input_line fin in let i = String . index s ' , ' in let p1 = float_of_string ( String . sub s 0 i ) in let p2 = float_of_string ( String . sub s ( i + 1 ) ( String . length s - i - 1 ) ) in Some ( p1 , p2 ) with _ -> None
let draw_wall xpos = glPushMatrix ( ) ; glTranslate xpos 0 . 0 0 . 0 ; glScale wall_width wall_size wall_size ; glutSolidCube 1 . 0 ; glPopMatrix ( )
let draw_floor ( ) = glPushMatrix ( ) ; glTranslate ( distance . / 2 . 0 ) ( . - wall_size . / 2 . 0 ) 0 . 0 ; glScale ( w2 . - w1 . + wall_width ) wall_width wall_size ; glutSolidCube 1 . 0 ; glPopMatrix ( )
let draw_spring x1 x2 = let step_size = ( x2 . - x1 ) . / spring_ncoils in let length_degrees = spring_ncoils . * 360 . 0 in glPushMatrix ( ) ; glTranslate x1 0 . 0 0 . 0 ; glRotate 90 . 0 0 . 0 1 . 0 0 . 0 ; glScale 1 . 0 1 . 0 1 . 0 ; gleHelicoid spr...
let draw_ball x = glPushMatrix ( ) ; glTranslate x 0 . 0 0 . 0 ; glScale 1 . 0 1 . 0 1 . 0 ; glutSolidSphere ball_radius 24 24 ; glPopMatrix ( )
let display p1 p2 ( ) = glClear [ GL_COLOR_BUFFER_BIT ; GL_DEPTH_BUFFER_BIT ] ; glLoadIdentity ( ) ; glTranslate 0 . 0 0 . 0 ( . - 2 . 5 ) ; glRotate ( ! angley ) 1 . 0 0 . 0 0 . 0 ; glRotate ( ! anglex ) 0 . 0 1 . 0 0 . 0 ; glRotate ( ! a...
let make_model_functions p1i p2i fin = let p1 = ref p1i in let p2 = ref p2i in let rec update ~ value ( ) : = match read_state fin with | None -> schedule_update ( ) | Some ( p1 ' , p2 ' ) -> begin p1 := p1 ' ; p2 := p2 ' ; schedule_update ( ) ; glutPostRedisplay ( ) end ...
let reshape ~ width : w ~ height : h = glViewport 0 0 w h ; glMatrixMode GL_PROJECTION ; glLoadIdentity ( ) ; let aspect = ( ( float w ) . / ( float ( max 1 h ) ) ) in gluPerspective ~ fovy : 60 . 0 ~ aspect ~ zNear : 0 . 5 ~ zFar : 100 . 0 ; glMatrixMode GL_MO...
let keyboard ~ key ~ x ~ y = match key with | ' q ' | ' \ 027 ' -> exit 0 | _ -> ( )
let special ~ key ~ x ~ y = match key with | GLUT_KEY_LEFT -> ( anglex := ! anglex . - 5 . 00 ; glutPostRedisplay ( ) ) | GLUT_KEY_RIGHT -> ( anglex := ! anglex . + 5 . 00 ; glutPostRedisplay ( ) ) | GLUT_KEY_UP -> ( angley := ! angley . - 5 . 00 ; glutPostRe...
let drag_last = ref ( None : ( int * int ) option )
let mouse ~ button ~ state ~ x ~ y = match button , state with | GLUT_LEFT_BUTTON , GLUT_DOWN -> drag_last := Some ( x , y ) | GLUT_LEFT_BUTTON , GLUT_UP -> drag_last := None | _ -> ( )
let motion ~ x ~ y = match ! drag_last with | None -> ( ) | Some ( xo , yo ) -> anglex := ! anglex . + ( float ( xo - x ) . * drag_scale ) ; angley := ! angley . + ( float ( yo - y ) . * drag_scale ) ; drag_last := Some ( x , y ) ; glutPostRedisplay ( )...
let gl_init ( ) = glShadeModel GL_SMOOTH ; glClearColor 0 . 0 0 . 0 0 . 3 0 . 0 ; glClearDepth 1 . 0 ; glEnable GL_DEPTH_TEST ; gleSetJoinStyle [ TUBE_NORM_EDGE ; TUBE_JN_ANGLE ; TUBE_JN_CAP ] ; glLight ( GL_LIGHT 0 ) ( Light . GL_POSITION lightOnePosition ) ; glL...
let run_glut_loop p1i p2i fin = Random . self_init ( ) ; ignore ( glutInit Sys . argv ) ; glutInitDisplayMode [ GLUT_RGB ; GLUT_DOUBLE ; GLUT_DEPTH ] ; ignore ( glutCreateWindow " Sticky Springs Visualisation " ) ; glutReshapeWindow ~ width : 800 ~ height : 600 ; glutSetCurs...
let standalone ( ) = Unix . set_nonblock Unix . stdin ; run_glut_loop 0 . 0 distance stdin
let create p1i p2i = let input , output = Unix . pipe ( ) in let outch = Unix . out_channel_of_descr output in match Unix . fork ( ) with | 0 -> ( Unix . close input ; outch ) | _ -> begin Unix . close output ; Unix . set_nonblock input ; run_glut_loop p1i p2i ( Unix . in_ch...
let update fout p1 p2 = Printf . fprintf fout " % e , % e \ n " p1 p2 ; flush fout
let makeCheckImage ( ) = let checkImage = Bigarray . Array3 . create Bigarray . int8_unsigned Bigarray . c_layout checkImageHeight checkImageWidth 4 in for i = 0 to pred checkImageHeight do for j = 0 to pred checkImageWidth do let ( = ) a b = if a = b then 1 else 0 in let c = ( ( ( i ...
let init ( ) = glClearColor 0 . 0 0 . 0 0 . 0 0 . 0 ; glShadeModel GL_FLAT ; glEnable GL_DEPTH_TEST ; let checkImage = makeCheckImage ( ) in glPixelStorei GL_UNPACK_ALIGNMENT 1 ; let texName = glGenTexture ( ) in glBindTexture BindTex . GL_TEXTURE_2D texName ; glTexParameter ...
let display texName ( ) = glClear [ GL_COLOR_BUFFER_BIT ; GL_DEPTH_BUFFER_BIT ] ; glEnable GL_TEXTURE_2D ; glTexEnv TexEnv . GL_TEXTURE_ENV TexEnv . GL_TEXTURE_ENV_MODE TexEnv . GL_DECAL ; glBindTexture BindTex . GL_TEXTURE_2D texName ; glBegin GL_QUADS ; glTexCoord2 0 . 0 0 . 0 ; ...
let reshape ~ width : w ~ height : h = glViewport 0 0 w h ; glMatrixMode GL_PROJECTION ; glLoadIdentity ( ) ; gluPerspective 60 . 0 ( float w . / float h ) 1 . 0 30 . 0 ; glMatrixMode GL_MODELVIEW ; glLoadIdentity ( ) ; glTranslate 0 . 0 0 . 0 ( - 3 . 6 ) ;...
let keyboard ~ key ~ x ~ y = match key with | ' s ' -> glTexParameter TexParam . GL_TEXTURE_2D ( TexParam . GL_TEXTURE_WRAP_S GL_CLAMP ) ; glutPostRedisplay ( ) ; | ' S ' -> glTexParameter TexParam . GL_TEXTURE_2D ( TexParam . GL_TEXTURE_WRAP_S GL_REPEAT ) ; glutPostRedisplay (...
let ( ) = let _ = glutInit Sys . argv in glutInitDisplayMode [ GLUT_SINGLE ; GLUT_RGB ; GLUT_DEPTH ] ; glutInitWindowSize 250 250 ; glutInitWindowPosition 100 100 ; let _ = glutCreateWindow Sys . argv . ( 0 ) in let texName = init ( ) in glutDisplayFunc ~ display ( : displ...
type t = { width : int ; initial_indent : string ; subsequent_indent : string ; expand_tabs : bool ; replace_whitespace : bool ; fix_sentence_endings : bool ; break_long_words : bool ; break_on_hyphens : bool ; drop_whitespace : bool }
let wordsep_simple_re = Str . regexp " [ \ r \ n \ t ] " +
let munge_whitespace { expand_tabs ; replace_whitespace ; _ } text = let text = if expand_tabs then Str . global_replace ( Str . regexp " \ t " ) ( String . make 8 ' ' ) text else text in if replace_whitespace then Str . global_replace whitespace_re " " text else text let res =...
let wrap_chunks w = let is_whitespace = function | " " -> true | s -> Str . string_match wordsep_simple_re s 0 in let pre_drop_whitespace lines = function | ( chunk :: chunks ) when w . drop_whitespace && lines <> [ ] && is_whitespace chunk -> chunks | chunks -> chunks in let post_drop_w...
let make ( ? initial_indent " " ) = ( ? subsequent_indent " " ) = ( ? expand_tabs = true ) ( ? replace_whitespace = true ) ( ? fix_sentence_endings = false ) ( ? break_long_words = true ) ( ? break_on_hyphens = true ) ( ? drop_whitespace = true ) width = if width...
let wrap w text = let chunks = split w ( munge_whitespace w text ) in let chunks = if w . fix_sentence_endings then fix_sentence_endings w chunks else chunks in wrap_chunks w chunks
let fill w text = String . concat " \ n " ( wrap w text )
module C = Torch_bindings . C ( Torch_generated )
let to_tensor_list ptr = let rec loop ptr acc = let tensor = !@ ptr in if is_null tensor then acc else ( Gc . finalise C . Tensor . free tensor ; loop ( ptr +@ 1 ) ( tensor :: acc ) ) in let result = loop ptr [ ] in C . free ( to_voidp ptr ) ; List . rev result
let __and__ self other = let out__ = CArray . make t 1 in stubs___and__ ( CArray . start out__ ) self other ; let t0 = CArray . get out__ 0 in Gc . finalise C . Tensor . free t0 ; t0
let __and__tensor_ self other = let out__ = CArray . make t 1 in stubs___and__tensor_ ( CArray . start out__ ) self other ; let t0 = CArray . get out__ 0 in Gc . finalise C . Tensor . free t0 ; t0
let __iand__ self other = let out__ = CArray . make t 1 in stubs___iand__ ( CArray . start out__ ) self other ; let t0 = CArray . get out__ 0 in Gc . finalise C . Tensor . free t0 ; t0
let __iand__tensor_ self other = let out__ = CArray . make t 1 in stubs___iand__tensor_ ( CArray . start out__ ) self other ; let t0 = CArray . get out__ 0 in Gc . finalise C . Tensor . free t0 ; t0