text
stringlengths
12
786k
let weakly_compress ? heuristic parameter = compress ? heuristic ( S . PH . B . PB . CI . Po . K . H . set_compression_weak parameter )
let convert_trace_into_grid trace handler = let event_list = get_compressed_trace trace in S . PH . B . PB . CI . Po . K . build_grid event_list ( not ( is_compressed_trace trace ) ) handler
let convert_trace_into_musical_notation parameters ? shall_we_compute : _ ? shall_we_compute_profiling_information : _ ? print_if_zero : _ kappa_handler profiling_info error trace = S . PH . B . import parameters kappa_handler profiling_info error ( get_pretrace_of_trace trace )
let enrich_grid_with_transitive_closure config logger ? shall_we_compute : _ ? shall_we_compute_profiling_information : _ ? print_if_zero : _ handler log_info error grid = let error , log_info , output = Causal . enrich_grid ( S . PH . B . PB . CI . Po . K . H . get_kasa_parameters lo...
let enrich_grid_with_transitive_past_of_observables_with_a_progress_bar = enrich_grid_with_transitive_closure Graph_closure . config_big_graph_with_progress_bar
let enrich_grid_with_transitive_past_of_observables_without_a_progress_bar = enrich_grid_with_transitive_closure Graph_closure . config_big_graph_without_progress_bar
let _enrich_grid_with_transitive_past_of_each_node_without_a_progress_bar = enrich_grid_with_transitive_closure Graph_closure . config_big_graph_without_progress_bar
let enrich_grid_with_transitive_past_of_each_node_without_a_progress_bar = enrich_grid_with_transitive_closure Graph_closure . config_small_graph
let export_story_table parameter ? shall_we_compute : _ ? shall_we_compute_profiling_information : _ ? print_if_zero : _ handler log_info error x = let a , log_info , b = sort_story_list parameter handler log_info error ( get_stories x ) in a , log_info , b
let has_obs x = List . exists Trace . step_is_obs ( get_pretrace_of_trace x )
let fold_left_with_progress_bar ( ? event = StoryProfiling . Dummy ) parameter ( ? shall_we_compute = we_shall ) ( ? shall_we_compute_profiling_information = we_shall ) ( ? print_if_zero = we_shall ) handler profiling_information error ( f ( ' : a , ' b , ' a ) binary ) a li...
let _fold_over_the_causal_past_of_observables_through_a_grid_with_a_progress_bar parameter handler log_info error f t a = let grid = convert_trace_into_grid t handler in Causal . fold_over_causal_past_of_obs parameter handler log_info error Graph_closure . config_big_graph_with_progress_bar grid f ( error , ...
let fold_over_the_causal_past_of_observables_with_a_progress_bar parameter ? shall_we_compute : _ ? shall_we_compute_profiling_information : _ ? print_if_zero : _ handler log_info error log_step debug_mode counter f t a = let ( ) = if log_step parameter then Loggers . fprintf ( S . PH . B . PB ...
let compute_canonical_form parameter ? shall_we_compute : _ ? shall_we_compute_profiling_information : _ ? print_if_zero : _ handler log_info error trace = let grid = convert_trace_into_grid trace handler in let error , log_info , graph = Dag . graph_of_grid parameter handler log_info error grid in le...
module Event = ( struct type event = step type eid = int type ' a t = ' a array let key_of_event event = if ( Trace . step_is_rule event || Trace . step_is_pert event ) && not ( Trace . has_creation_of_step event ) then get_id_of_event event else None let init eid default = Array . make ei...
module BlackList = ( Black_list . Make ( ( Event : Black_list . Event with type event = step ) ) : Black_list . Blacklist with type Event . event = step )
let create_black_list n = BlackList . init n
let black_list _parameter ? shall_we_compute : _ ? shall_we_compute_profiling_information : _ ? print_if_zero : _ _handler log_info error trace blacklist = let blacklist = List . fold_left ( fun blacklist ( event , _ ) -> BlackList . black_list event blacklist ) blacklist ( get_compressed...
let remove_blacklisted_event _handler log_info error blacklist trace = let list , int = List . fold_left ( fun ( trace , int ) event -> if BlackList . is_black_listed event blacklist then ( trace , succ int ) else ( event :: trace , int ) ) ( [ ] , 0 ) trace in error , log_...
let remove_blacklisted_event parameter ? shall_we_compute : _ ? shall_we_compute_profiling_information : _ ? print_if_zero : _ handler log_info error blacklist trace = lift_to_care_about_ambiguities ( transform_trace_gen ( fun _parameter handler log_info error -> remove_blacklisted_event handler log_inf...
let last_eid_in_pretrace trace = let l = List . rev ( get_pretrace_of_trace trace ) in let rec aux = function | [ ] -> 0 | h :: t -> begin match get_id_of_event h with | None -> aux t | Some eid -> eid end in aux l
let profiling_state_to_json parameters = ` Assoc [ " profiling information " , Loggers . to_json ( S . PH . B . PB . CI . Po . K . H . get_profiling_logger parameters ) ]
let error_list_to_json parameters = ` Assoc [ " errors " , Loggers . to_json ( S . PH . B . PB . CI . Po . K . H . get_debugging_channel parameters ) ]
let computation_steps_to_json parameters = ` Assoc [ " computation steps " , Loggers . to_json ( S . PH . B . PB . CI . Po . K . H . get_logger parameters ) ]
type parameters = { iteration_before_calibrating : int ; global_time_factor_min : float option ; global_time_factor_max : float option ; trace_before_factor_min : int option ; trace_after_factor_min : int option ; trace_before_factor_max : int option ; trace_after_factor_max : int option ; compu...
let parameters = { iteration_before_calibrating = 10 ; global_time_factor_min = Some 5 . ; global_time_factor_max = Some 20 . ; trace_before_factor_min = Some 10 ; trace_after_factor_min = Some 10 ; trace_before_factor_max = Some 500 ; trace_after_factor_max = Some 500 ; computation_t...
type status_global = { counter_min : int ; global_time_min : float option ; global_time_max : float option ; cpu_time_min : float option ; cpu_time_max : float option ; cpu_time_ref : float option ; trace_length_before_min : int option ; trace_length_after_min : int option ; trace_length_befo...
type status = { counter : int ; global_time : float ; trace_length_before : int ; trace_length_after : int ; cpu_time : float ; }
let get_status_before counter trace = { counter = counter ; global_time = Sys . time ( ) ; trace_length_before = Utilities . size_of_pretrace trace ; trace_length_after = 0 ; cpu_time = 0 . }
let get_status_after status_before trace = { status_before with cpu_time = Sys . time ( ) . - status_before . global_time ; trace_length_after = Utilities . size_of_pretrace trace }
let cmp_opt cmp a b = match a , b with | None , _ | _ , None -> 0 | Some a , Some b -> cmp a b
let cmp_float_opt = cmp_opt ( compare : float -> float -> int )
let cmp_int_opt = cmp_opt ( compare : int -> int -> int )
let gen_bin_opt op a b = match a , b with | None , _ | _ , None -> None | Some a , Some b -> Some ( op a b )
let add_float_opt = gen_bin_opt ( . ) +
let mult_float_opt = gen_bin_opt ( . * )
let mult_int_opt = gen_bin_opt ( * )
let max_opt cmp a b = match a with None -> Some b | Some a -> Some ( if cmp a b > 0 then a else b )
let stop_before global status = status . counter > global . counter_min && ( cmp_float_opt ( Some status . global_time ) global . global_time_max > 0 || cmp_int_opt ( Some status . trace_length_before ) global . trace_length_before_max > 0 || (
let stop_after global status = status . counter > global . counter_min && ( cmp_float_opt ( Some status . global_time ) global . global_time_max > 0 || cmp_float_opt ( Some status . cpu_time ) global . cpu_time_max > 0 || cmp_int_opt ( Some status . trace_length_before ) global . ...
let set_status_init cflow_parameters parameters float1 float2 counter = { counter_min = counter + parameters . iteration_before_calibrating ; global_time_min = if Utilities . S . PH . B . PB . CI . Po . K . H . get_is_time_independent cflow_parameters None global_time_max = if Utilities . ...
let update_status_before global status = if status . counter < global . counter_min then { global with trace_length_before_ref = max_opt compare global . trace_length_before_ref status . trace_length_before } else global
let update_status_after global status = if status . counter < global . counter_min then { global with trace_length_after_ref = max_opt compare global . trace_length_after_ref status . trace_length_after ; cpu_time_ref = max_opt compare global . cpu_time_ref status . cpu_time } else global
let compute_status_ranges cflow_parameters parameter global_status = { global_status with cpu_time_min = if Utilities . S . PH . B . PB . CI . Po . K . H . get_is_time_independent cflow_parameters cpu_time_max = if Utilities . S . PH . B . PB . CI . Po . K . H . get_is_time_inde...
let fold_over_the_causal_past_of_observables_with_a_progress_bar_while_reshaking_the_trace cflow_parameters ~ shall_we_compute : _ ~ shall_we_compute_profiling_information : _ handler log_info error we_shall never parameters global_trace_simplification f ( store_result ( : Utilities . trace , Utilities ....
let print_string s list = ( Html . txt s ) :: list
let print_newline list = print_string " \ n " list
let print_single_binding_state a list = print_string Public_data . binding_state_opening_backend_symbol ( print_string a ( print_string Public_data . binding_state_closing_backend_symbol list ) )
let print_single_internal_state a list = print_string Public_data . internal_state_opening_backend_symbol ( print_string a ( print_string Public_data . internal_state_closing_backend_symbol list ) )
let print_counter_interval ( a , b ) list = let open_range , inf = match a with | None -> Public_data . open_interval_exclusive_symbol , Public_data . minus_infinity_symbol | Some a -> Public_data . open_interval_inclusive_symbol , string_of_int a in let close_range , sup = match b with | No...
let print_counter_state ( a , b ) list = print_string Public_data . counter_state_opening_backend_symbol ( print_counter_interval ( a , b ) ( print_string Public_data . counter_state_closing_backend_symbol list ) )
let print_site site list = let site_name , prop_opt , binding_opt , counter_opt = site in let list = match binding_opt with | None -> print_string Public_data . missing_binding_site_backend_symbol list | Some Public_data . Free -> print_single_binding_state Public_data . free_backend_symbol list | S...
let print_agent agent list = let agent_name , interface = agent in let list = print_string " ) " list in let list = snd ( List . fold_left ( fun ( b , list ) site -> let list = if b then print_string " , " list else list in let list = print_site site list in true , list ) ( false ...
let print_site_graph agent_list list = snd ( List . fold_left ( fun ( b , list ) agent -> let list = if b then print_string " , " list else list in true , print_agent agent list ) ( false , list ) ( List . rev agent_list ) )
let print_method_handler mh = let uncaught = Exception_without_parameter . get_uncaught_exception_list mh in let caught = Exception_without_parameter . get_caught_exception_list mh in List . fold_right ( fun x l -> Html . p [ Html . txt ( Format . asprintf " % a " Exception_without_parameter ...
module Ident = struct include Ident let string_of ( ? stamp = true ) id = if stamp then Ident . unique_toplevel_name id else Ident . name id let ocaml_of_t id = Ocaml . String ( string_of id ) let is_predef id = id . Ident . stamp > 0 && id . Ident . stamp < 1000 end
module Path = struct include Path let rec string_of ( ? stamp = true ) = function | Pident id -> Ident . string_of ~ stamp id | Pdot ( t , n , i ) when stamp = true -> string_of ~ stamp t ^ " . " ^ n ^ " " / ^ string_of_int i | Pdot ( t , n , _i ) -> string_of ~ stamp...
module Longident = struct include Longident let rec string_of = function | Lident s -> s | Ldot ( l1 , n ) -> string_of l1 ^ " . " ^ n | Lapply ( l1 , l2 ) -> string_of l1 ^ " ( " ^ string_of l2 ^ " ) " let rec of_path = let open Path in function | Pident id -> Lident id . ...
let format_module_coercion ppf mc = let rec f ppf = function | Tcoerce_none -> string ppf " none " | Tcoerce_structure ( ics , iics ) -> fprintf ppf " [ @< 2 > str @ [ % a ] @ [ % a ] ] " @ ( list " ; @ " ( fun ppf ( i , mc ) -> fprintf ppf " ( % d , % a...
module Location = struct include Location let ocaml_of_t l = Ocaml . String ( Format . sprintf " % a " Location . print_compact l ) end
module FilePath = struct type t = string [ @@ deriving conv { ocaml } ] end
module Digest = struct open Typerep_lib . Std type t = string [ @@ deriving conv { ocaml } , typerep ] let cache = Hashtbl . create 101 let reset_cache ( ) = Hashtbl . clear cache let file = Hashtbl . find_or_add Digest . file cache end
let criticalf fmt = Exn . raisef ( fun x -> Critical x ) fmt
let find_file_in_dir d p = Unix . Find . fold [ d ] None & fun st path -> match st with | Some _ -> ` Prune , st | None -> if p path then ` Prune , Some path else ` Continue , None
let find_in_path dirs m = try Misc . find_in_path dirs m with | Not_found -> !!% " [ @< 2 > Error : % s is not found in @ [ @% a ] ] . " @@@ m Format . ( list " @ " string ) dirs ; criticalf " Error : % s is not found in % s " m ( String . concat " " dirs )
let find_global_module id = try Some ( Misc . find_in_path_uncap ! Config . load_path ( id . Ident . name ^ " . cmi " ) ) with | Not_found -> None
let module_name p = String . capitalize_ascii & fst & Filename . ( split_extension & basename p )
let around_if b start end_ f = if b then start ( ) ; let res = f ( ) in if b then end_ ( ) ; res
let top_package_name x = match String . index x ' . ' with | exception _ -> x | n -> String . sub x 0 n
let is_package_path_name = function | " " -> false | s -> String . unsafe_get s 0 = ' { '
let out_ident_of_path = let open Outcometree in let rec f = function | Path . Pident id -> Oide_ident ( Ident . name id ) | Pdot ( p , s , _ ) -> Oide_dot ( f p , s ) | _ -> assert false in f
module type Arena = sig type t val create : elt_length : int -> initial_capacity : int -> t val is_full : t -> bool val expand : t -> int -> unit type id val allocate : t -> string -> id val dereference : t -> id -> string val elt_equal : t -> id -> string -> bool end
module type Small_list = sig type ' + a t val empty : _ t val cons : ' a -> ' a t -> ' a t val iter : ( ' a -> unit ) -> ' a t -> unit val exists : ( ' a -> bool ) -> ' a t -> bool end
module type String_set = sig type t val create : elt_length : int -> initial_capacity : int -> t val add : t -> string -> unit val mem : t -> string -> bool end
module type Intf = sig module Arena : Arena module Small_list : Small_list module String_set : String_set end
let split_metadata_no_metadata1 = let open Alcotest in test_case " split_metadate - no metadata 1 " ` Quick $ fun ( ) -> let str = " " in let computed = split_metadata str in let expected = None , " " in check ( pair ( option string ) string ) " should be equal " computed expecte...
let split_metadata_no_metadata2 = let open Alcotest in test_case " split_metadate - no metadata 2 " ` Quick $ fun ( ) -> let str = { | Lorem ipsum dolor sit amet , consectetur adipiscing elit . Etiam in vehicula lorem . Etiam erat libero , scelerisque eu placerat a , varius ut lorem . Nun...
let split_metadata_no_metadata3 = let open Alcotest in test_case " split_metadate - no metadata 3 " ` Quick $ fun ( ) -> let str = { |--- Lorem ipsum dolor sit amet , consectetur adipiscing elit . Etiam in vehicula lorem . Etiam erat libero , scelerisque eu placerat a , varius ut lorem . ...
let split_metadata_no_metadata4 = let open Alcotest in test_case " split_metadate - no metadata 4 " ` Quick $ fun ( ) -> let str = { } |---| in let computed = split_metadata str in let expected = None , str in check ( pair ( option string ) string ) " should be equal " computed expe...
let split_metadata_no_metadata5 = let open Alcotest in test_case " split_metadate - no metadata 5 " ` Quick $ fun ( ) -> let str = { |--- let computed = split_metadata str in let expected = None , str in check ( pair ( option string ) string ) " should be equal " computed expected ; ...
let split_metadata_no_metadata6 = let open Alcotest in test_case " split_metadate - no metadata 6 " ` Quick $ fun ( ) -> let str = { |-- --- let computed = split_metadata str in let expected = None , str in check ( pair ( option string ) string ) " should be equal " computed expected...
let split_metadata_with_metadata1 = let open Alcotest in test_case " split_metadate - with metadata 1 " ` Quick $ fun ( ) -> let str = { |--- foo ; s let computed = split_metadata str in let expected = Some " foo ; s \ n " , " " in check ( pair ( option string ) string ) " ...
let split_metadata_with_metadata2 = let open Alcotest in test_case " split_metadate - with metadata 2 " ` Quick $ fun ( ) -> let str = { |--- foo ; s --- let computed = split_metadata str in let expected = Some " foo ; s \ n " , " \ nok ok ok \ n \ n " in check ( pair ( optio...
let split_metadata_with_metadata3 = let open Alcotest in test_case " split_metadate - with metadata 3 " ` Quick $ fun ( ) -> let str = { |--- hello -- bar --- test let computed = split_metadata str in let expected = Some " foo ; s -------\ nhello \ n --\ nfooo ---\ nbar \ n " , " t...
let split_metadata_with_metadata4 = let open Alcotest in test_case " split_metadate - with metadata 4 " ` Quick $ fun ( ) -> let str = { |--- A discared text hello -- bar --- test } | in let computed = split_metadata str in let expected = Some " foo ; s -------\ nhello \ n --\ nfooo --...
let cases = ( " Util " , [ split_metadata_no_metadata1 ; split_metadata_no_metadata2 ; split_metadata_no_metadata3 ; split_metadata_no_metadata4 ; split_metadata_no_metadata5 ; split_metadata_no_metadata6 ; split_metadata_with_metadata1 ; split_metadata_with_metadata2 ; split_metadata_with_me...
let toploop_get_directive name = Toploop . get_directive name # else try Some ( Hashtbl . find Toploop . directive_table name ) with Not_found -> None # endif
let history = LTerm_history . create [ ]
let history_file_name = ref ( Some ( Filename . concat LTerm_resources . home " . utop - history " ) )
let history_file_max_size = ref None
let history_file_max_entries = ref None
let stashable_session_history = UTop_history . create ( )
let new_command_hooks = LTerm_dlist . create ( )
let at_new_command f = ignore ( LTerm_dlist . add_l f new_command_hooks )
type ui = UTop_private . ui = Console | Emacs
let get_ui ( ) = S . value UTop_private . ui
type profile = Dark | Light
let profile , set_profile = S . create Dark
let set_profile p = set_profile p
let time = ref ( Unix . time ( ) )