text stringlengths 0 601k |
|---|
let get d x = I . get ( d . data ) x |
let getUndefined d x = I . getUndefined ( d . data ) x |
let getExn d x = I . getExn ( d . data ) x |
let split d key = let arr = N . toArray ( d . data ) in let i = S . binarySearch arr key in let len = A . length arr in if i < 0 then let next = - i - 1 in ( { data = N . fromSortedArrayAux arr 0 next } , { data = N . fromSortedArrayAux arr next ( len - next ) } ) , false else ( { data = N . fromSortedArrayAux arr 0 i ... |
let keepU d p = { data = ( N . keepCopyU ( d . data ) p ) } |
let keep d p = keepU d ( fun [ @ bs ] a -> p a ) |
let partitionU d p = let a , b = N . partitionCopyU ( d . data ) p in { data = a } , { data = b } |
let partition d p = partitionU d ( fun [ @ bs ] a -> p a ) |
let subset a b = I . subset a . data b . data |
let intersect dataa datab = let dataa , datab = dataa . data , datab . data in match dataa , datab with | None , _ -> make ( ) | _ , None -> make ( ) | Some dataa0 , Some datab0 -> let sizea , sizeb = N . lengthNode dataa0 , N . lengthNode datab0 in let totalSize = sizea + sizeb in let tmp = A . makeUninitializedUnsafe... |
let diff dataa datab : t = let dataa , datab = dataa . data , datab . data in match dataa , datab with | None , _ -> make ( ) | _ , None -> { data = N . copy dataa } | Some dataa0 , Some datab0 -> let sizea , sizeb = N . lengthNode dataa0 , N . lengthNode datab0 in let totalSize = sizea + sizeb in let tmp = A . makeUni... |
let union ( dataa : t ) ( datab : t ) : t = let dataa , datab = dataa . data , datab . data in match dataa , datab with | None , _ -> { data = ( N . copy datab ) } | _ , None -> { data = ( N . copy dataa ) } | Some dataa0 , Some datab0 -> let sizea , sizeb = N . lengthNode dataa0 , N . lengthNode datab0 in let totalSiz... |
let has d x = I . has ( d . data ) x |
let copy d = { data = ( N . copy ( d . data ) ) } |
module type OrderedType = sig type t val compare : t -> t -> int val print : Format . formatter -> t -> unit end |
type ( ' parameters , ' error , ' a ) with_log_wrap = ( ' parameters -> ' error -> string -> string option -> exn -> ' error ) -> ' parameters -> ' error -> ' a |
module type Set = sig type elt type t val empty : t val is_empty : t -> bool val singleton : elt -> t val is_singleton : t -> bool val add : elt -> t -> t val add_with_logs : ( ' parameters , ' error , elt -> t -> ' error * t ) with_log_wrap val remove : elt -> t -> t val add_while_testing_freshness : ( ' parameters , ... |
module type Map = sig type elt type set type ' + a t val empty : ' a t val is_empty : ' a t -> bool val size : ' a t -> int val root : ' a t -> ( elt * ' a ) option val max_key : ' a t -> elt option val add : elt -> ' a -> ' a t -> ' a t val remove : elt -> ' a t -> ' a t val add_while_testing_freshness : ( ' parameter... |
module type S = sig type elt module Set : Set with type elt = elt module Map : Map with type elt = elt and type set = Set . t end |
module Make ( Ord : OrderedType ) : S with type elt = Ord . t = struct type elt = Ord . t module Set = struct type elt = Ord . t module Private : sig type t = private Empty | Node of t * elt * t * int * int val empty : t val height : t -> int val size : t -> int val node : t -> elt -> t -> t end = struct type t = Empty... |
module type Projection = sig type elt_a type elt_b type ' a map_a type ' a map_b type set_a type set_b val proj_map : ( elt_a -> elt_b ) -> ' b -> ( ' b -> ' a -> ' b ) -> ' a map_a -> ' b map_b val proj_map_monadic : ' parameters -> ' method_handler -> ( elt_a -> elt_b ) -> ' b -> ( ' parameters -> ' method_handler ->... |
module Proj ( A : S ) ( B : S ) = struct module MA = A . Map module MB = B . Map module SA = A . Set module SB = B . Set type elt_a = MA . elt type elt_b = MB . elt type set_a = SA . t type set_b = SB . t type ' a map_a = ' a MA . t type ' a map_b = ' a MB . t let proj_map f identity_elt merge map = MA . fold ( fun key... |
module IntMap = Make ( struct type t = int let compare = compare end ) |
let f = List . fold_left IntMap . Map . empty [ 1 , [ 2 ; 3 ] ; 2 , [ 3 ; 4 ] ; 5 , [ 6 ; 7 ] ; 8 , [ 12 ; 13 ] ] |
let g = P . proj ( fun i -> i mod 2 ) [ ] ( List . append ) f |
let g ' = IntMap . Map . map List . rev ( P . proj ( fun i -> i mod 2 ) [ ] ( fun x y -> List . append ( List . rev y ) x ) f ) |
let dump ( s : string ) f = let _ = Printf . fprintf stderr " % s : \ n " s in let _ = IntMap . Map . iter |
let _ = Printf . fprintf stderr " % i " : a in |
let _ = List . iter ( Printf . fprintf stderr " % i , " ) l in |
let _ = Printf . fprintf stderr " \ n " in ( ) ) ( ) |
let _ = dump " f " f |
let _ = dump " g " g |
let _ = dump " g ' " g ' ) * |
module type Projection2 = sig type elt_a type elt_b type elt_c type ' a map_a type ' a map_b type ' a map_c val proj2 : ( elt_a -> elt_b ) -> ( elt_a -> elt_c ) -> ' b -> ( ' b -> ' a -> ' b ) -> ' a map_a -> ' b map_c map_b val proj2_monadic : ' parameters -> ' method_handler -> ( elt_a -> elt_b ) -> ( elt_a -> elt_c ... |
module Proj2 ( A : S ) ( B : S ) ( C : S ) = struct module MA = A . Map module MB = B . Map module MC = C . Map type elt_a = MA . elt type elt_b = MB . elt type elt_c = MC . elt type ' a map_a = ' a MA . t type ' a map_b = ' a MB . t type ' a map_c = ' a MC . t let proj2 f g identity_elt merge map = MA . fold ( fun key... |
let update_hooks = ref [ ] |
let add_update_hook f = update_hooks := f :: ! update_hooks |
let exec_update_hooks ( ) = update_hooks := List . filter ! update_hooks ~ f : begin fun f -> try f ( ) ; true with Protocol . TkError _ -> false end |
let set_load_path l = Config . load_path := l ; exec_update_hooks ( ) |
let get_load_path ( ) = ! Config . load_path |
let renew_dirs box ~ var ~ dir = Textvariable . set var dir ; Listbox . delete box ~ first ( ` : Num 0 ) ~ last ` : End ; Listbox . insert box ~ index ` : End ~ texts ( : Useunix . get_directories_in_files ~ path : dir ( Useunix . get_files_in_directory dir ) ) ; Jg_box . recenter box ~ index ( ` : Num 0 ) |
let renew_path box = Listbox . delete box ~ first ( ` : Num 0 ) ~ last ` : End ; Listbox . insert box ~ index ` : End ~ texts :! Config . load_path ; Jg_box . recenter box ~ index ( ` : Num 0 ) |
let add_to_path ~ dirs ( ? base " " ) = box = let dirs = if base = " " then dirs else if dirs = [ ] then [ base ] else List . map dirs ~ f : begin function " . " -> base | " . . " -> Filename . dirname base | x -> Filename . concat base x end in set_load_path ( dirs @ List . fold_left dirs ~ init ( : get_load_path ( ) ... |
let remove_path box ~ dirs = set_load_path ( List . fold_left dirs ~ init ( : get_load_path ( ) ) ~ f ( : fun acc x -> List2 . exclude x acc ) ) |
let f ~ dir = let current_dir = ref dir in let tl = Jg_toplevel . titled " Edit Load Path " in Jg_bind . escape_destroy tl ; let var_dir = Textvariable . create ~ on : tl ( ) in let caplab = Label . create tl ~ text " : Path " and dir_name = Entry . create tl ~ textvariable : var_dir and browse = Frame . create tl in l... |
let set ~ dir = ignore ( f ~ dir ) ; ; |
type ' a setting = { key : string ; to_json : ' a -> Jsonoo . t ; of_json : Jsonoo . t -> ' a ; scope : ConfigurationTarget . t } |
let create_setting ~ scope ~ key ~ of_json ~ to_json = { scope ; key ; to_json ; of_json } |
let get ? section setting = let section = Workspace . getConfiguration ? section ( ) in match WorkspaceConfiguration . get section ~ section : setting . key with | None -> None | Some v -> ( match setting . of_json ( Jsonoo . t_of_js v ) with | s -> Some s | exception Jsonoo . Decode_error msg -> show_message ` Error "... |
let set ? section setting v = let section = Workspace . getConfiguration ? section ( ) in match Workspace . name ( ) with | None -> Promise . return ( ) | Some _ -> let value = Jsonoo . t_to_js ( setting . to_json v ) in WorkspaceConfiguration . update section ~ section : setting . key ~ value ~ configurationTarget ( `... |
let workspace_folder_var folder = Printf . sprintf " { $ workspaceFolder :% s } " ( WorkspaceFolder . name folder ) |
let workspace_folder_path folder = Uri . fsPath ( WorkspaceFolder . uri folder ) |
let resolve_workspace_vars setting = let find_folder name = let pred folder = String . equal name ( WorkspaceFolder . name folder ) in List . find ~ f : pred ( Workspace . workspaceFolders ( ) ) in let regexp = Js_of_ocaml . Regexp . regexp " { \\$\\ workspaceFolder ( [ } ] ) } " :^+\\ in let replacer ~ matched ~ captu... |
let substitute_workspace_vars setting = let folder_replace_all = match Platform . t with | Win32 -> String . Caseless . substr_replace_all | _ -> String . substr_replace_all in List . fold ( Workspace . workspaceFolders ( ) ) ~ init : setting ~ f ( : fun acc folder -> folder_replace_all acc ~ pattern ( : workspace_fold... |
module ExtraEnv = struct let setting = let of_json = let dict_of_hashtbl hashtbl = Stdlib . Hashtbl . to_seq hashtbl |> Interop . Dict . of_seq in Jsonoo . Decode . ( map ( Option . map ~ f : dict_of_hashtbl ) ( nullable ( dict string ) ) ) in let to_json = let hashtbl_of_dict json = Interop . Dict . to_seq json |> Std... |
module OASISGettext = struct let ns_ str = str let s_ str = str let f_ ( str : ( ' a , ' b , ' c , ' d ) format4 ) = str let fn_ fmt1 fmt2 n = if n = 1 then fmt1 " " ^^ else fmt2 " " ^^ let init = [ ] end |
module OASISString = struct let nsplitf str f = if str = " " then [ ] else let buf = Buffer . create 13 in let lst = ref [ ] in let push ( ) = lst := Buffer . contents buf :: ! lst ; Buffer . clear buf in let str_len = String . length str in for i = 0 to str_len - 1 do if f str . [ i ] then push ( ) else Buffer . add_c... |
module OASISUtils = struct open OASISGettext module MapExt = struct module type S = sig include Map . S val add_list : ' a t -> ( key * ' a ) list -> ' a t val of_list : ( key * ' a ) list -> ' a t val to_list : ' a t -> ( key * ' a ) list end module Make ( Ord : Map . OrderedType ) = struct include Map . Make ( Ord ) ... |
module OASISUnixPath = struct type unix_filename = string type unix_dirname = string type host_filename = string type host_dirname = string let current_dir_name = " . " let parent_dir_name = " . . " let is_current_dir fn = fn = current_dir_name || fn = " " let concat f1 f2 = if is_current_dir f1 then f2 else let f1 ' =... |
module OASISHostPath = struct open Filename open OASISGettext module Unix = OASISUnixPath let make = function | [ ] -> invalid_arg " OASISHostPath . make " | hd :: tl -> List . fold_left Filename . concat hd tl let of_unix ufn = match Sys . os_type with | " Unix " | " Cygwin " -> ufn | " Win32 " -> make ( List . map ( ... |
module OASISFileSystem = struct type ' a filename = string class type closer = object method close : unit end class type reader = object inherit closer method input : Buffer . t -> int -> unit end class type writer = object inherit closer method output : Buffer . t -> unit end class type [ ' a ] fs = object method stri... |
module OASISContext = struct open OASISGettext type level = [ ` Debug | ` Info | ` Warning | ` Error ] type source type source_filename = source OASISFileSystem . filename let in_srcdir ufn = OASISFileSystem . of_unix_filename ufn type t = { quiet : bool ; info : bool ; debug : bool ; ignore_plugins : bool ; ignore_unk... |
module PropList = struct open OASISGettext type name = string exception Not_set of name * string option exception No_printer of name exception Unknown_field of name * name let ( ) = Printexc . register_printer ( function | Not_set ( nm , Some rsn ) -> Some ( Printf . sprintf ( f_ " Field ' % s ' is not set : % s " ) nm... |
module OASISMessage = struct open OASISGettext open OASISContext let generic_message ~ ctxt lvl fmt = let cond = if ctxt . quiet then false else match lvl with | ` Debug -> ctxt . debug | ` Info -> ctxt . info | _ -> true in Printf . ksprintf ( fun str -> if cond then begin ctxt . printf lvl str end ) fmt let debug ~ c... |
module OASISVersion = struct open OASISGettext type t = string type comparator = | VGreater of t | VGreaterEqual of t | VEqual of t | VLesser of t | VLesserEqual of t | VOr of comparator * comparator | VAnd of comparator * comparator let is_digit c = ' 0 ' <= c && c <= ' 9 ' let is_alpha c = ( ' a ' <= c && c <= ' z ' ... |
module OASISLicense = struct type license = string type license_exception = string type license_version = | Version of OASISVersion . t | VersionOrLater of OASISVersion . t | NoVersion type license_dep_5_unit = { license : license ; excption : license_exception option ; version : license_version ; } type license_dep_5 ... |
module OASISExpr = struct open OASISGettext open OASISUtils type test = string type flag = string type t = | EBool of bool | ENot of t | EAnd of t * t | EOr of t * t | EFlag of flag | ETest of test * string type ' a choices = ( t * ' a ) list let eval var_get t = let rec eval ' = function | EBool b -> b | ENot e -> not... |
module OASISText = struct type elt = | Para of string | Verbatim of string | BlankLine type t = elt list end |
module OASISSourcePatterns = struct open OASISUtils open OASISGettext module Templater = struct type t = { atoms : atom list ; origin : string } and atom = | Text of string | Expr of expr and expr = | Ident of string | String of string | Call of string * expr type env = { variables : string MapString . t ; functions : ... |
module OASISTypes = struct type name = string type package_name = string type url = string type unix_dirname = string type unix_filename = string type host_dirname = string type host_filename = string type prog = string type arg = string type args = string list type command_line = ( prog * arg list ) type findlib_name ... |
module OASISFeatures = struct open OASISTypes open OASISUtils open OASISGettext open OASISVersion module MapPlugin = Map . Make ( struct type t = plugin_kind * name let compare = Pervasives . compare end ) module Data = struct type t = { oasis_version : OASISVersion . t ; plugin_versions : OASISVersion . t option MapPl... |
module OASISSection = struct open OASISTypes let section_kind_common = function | Library ( cs , _ , _ ) -> ` Library , cs | Object ( cs , _ , _ ) -> ` Object , cs | Executable ( cs , _ , _ ) -> ` Executable , cs | Flag ( cs , _ ) -> ` Flag , cs | SrcRepo ( cs , _ ) -> ` SrcRepo , cs | Test ( cs , _ ) -> ` Test , cs | ... |
module OASISBuildSection = struct open OASISTypes let find_module source_file_exists bs modul = let possible_lst = OASISSourcePatterns . all_possible_files ( bs . bs_interface_patterns @ bs . bs_implementation_patterns ) ~ path : bs . bs_path ~ modul in match List . filter source_file_exists possible_lst with | ( fn ::... |
module OASISExecutable = struct open OASISTypes let unix_exec_is ( cs , bs , exec ) is_native ext_dll suffix_program = let dir = OASISUnixPath . concat bs . bs_path ( OASISUnixPath . dirname exec . exec_main_is ) in let is_native_exec = match bs . bs_compiled_object with | Native -> true | Best -> is_native ( ) | Byte ... |
module OASISLibrary = struct open OASISTypes open OASISGettext let find_module ~ ctxt source_file_exists cs bs modul = match OASISBuildSection . find_module source_file_exists bs modul with | ` Sources _ as res -> res | ` No_sources _ as res -> OASISMessage . warning ~ ctxt ( f_ " Cannot find source file matching modul... |
module OASISObject = struct open OASISTypes open OASISGettext let find_module ~ ctxt source_file_exists cs bs modul = match OASISBuildSection . find_module source_file_exists bs modul with | ` Sources _ as res -> res | ` No_sources _ as res -> OASISMessage . warning ~ ctxt ( f_ " Cannot find source file matching module... |
module OASISFindlib = struct open OASISTypes open OASISUtils open OASISGettext type library_name = name type findlib_part_name = name type ' a map_of_findlib_part_name = ' a OASISUtils . MapString . t exception InternalLibraryNotFound of library_name exception FindlibPackageNotFound of findlib_name type group_t = | Con... |
module OASISFlag = struct end |
module OASISPackage = struct end |
module OASISSourceRepository = struct end |
module OASISTest = struct end |
module OASISDocument = struct end |
module OASISExec = struct open OASISGettext open OASISUtils open OASISMessage let run ~ ctxt ? f_exit_code ( ? quote = true ) cmd args = let cmd = if quote then if Sys . os_type = " Win32 " then if String . contains cmd ' ' then " " " ( \^ Filename . quote cmd ) else cmd else Filename . quote cmd else cmd in let cmdlin... |
module OASISFileUtil = struct open OASISGettext let file_exists_case fn = let dirname = Filename . dirname fn in let basename = Filename . basename fn in if Sys . file_exists dirname then if basename = Filename . current_dir_name then true else List . mem basename ( Array . to_list ( Sys . readdir dirname ) ) else fals... |
module BaseEnvLight = struct module MapString = Map . Make ( String ) type t = string MapString . t let default_filename = Filename . concat ( Sys . getcwd ( ) ) " setup . data " let load ( ? allow_empty = false ) ( ? filename = default_filename ) ? stream ( ) = let line = ref 1 in let lexer st = let st_line = Stream .... |
module BaseContext = struct open OASISContext let args ( ) = fst ( fspecs ( ) ) let default = default end |
module BaseMessage = struct open OASISMessage open BaseContext let debug fmt = debug ~ ctxt :! default fmt let info fmt = info ~ ctxt :! default fmt let warning fmt = warning ~ ctxt :! default fmt let error fmt = error ~ ctxt :! default fmt end |
module BaseEnv = struct open OASISGettext open OASISUtils open OASISContext open PropList module MapString = BaseEnvLight . MapString type origin_t = | ODefault | OGetEnv | OFileLoad | OCommandLine type cli_handle_t = | CLINone | CLIAuto | CLIWith | CLIEnable | CLIUser of ( Arg . key * Arg . spec * Arg . doc ) list typ... |
module BaseArgExt = struct open OASISUtils open OASISGettext let parse argv args = let current = ref 0 in try Arg . parse_argv ~ current : current ( Array . concat [ [ " | none " ] ; | argv ] ) ( Arg . align args ) ( failwithf ( f_ " Don ' t know what to do with arguments : ' % s ' " ) ) ( s_ " configure options " ) : ... |
module BaseCheck = struct open BaseEnv open BaseMessage open OASISUtils open OASISGettext let prog_best prg prg_lst = var_redefine prg ( fun ( ) -> let alternate = List . fold_left ( fun res e -> match res with | Some _ -> res | None -> try Some ( OASISFileUtil . which ~ ctxt :! BaseContext . default e ) with Not_found... |
module BaseOCamlcConfig = struct open BaseEnv open OASISUtils open OASISGettext module SMap = Map . Make ( String ) let ocamlc = BaseCheck . prog_opt " ocamlc " let ocamlc_config_map = let rec split_field mp lst = match lst with | line :: tl -> let mp = try let pos_semicolon = String . index line ' ' : in if pos_semico... |
module BaseStandardVar = struct open OASISGettext open OASISTypes open BaseCheck open BaseEnv let ocamlfind = BaseCheck . ocamlfind let ocamlc = BaseOCamlcConfig . ocamlc let ocamlopt = prog_opt " ocamlopt " let ocamlbuild = prog " ocamlbuild " let rpkg = ref None let pkg_get ( ) = match ! rpkg with | Some pkg -> pkg |... |
module BaseFileAB = struct open BaseEnv open OASISGettext open BaseMessage open OASISContext let to_filename fn = if not ( Filename . check_suffix fn " . ab " ) then warning ( f_ " File ' % s ' doesn ' t have ' . ab ' extension " ) fn ; OASISFileSystem . of_unix_filename ( Filename . chop_extension fn ) let replace ~ c... |
module BaseLog = struct open OASISUtils open OASISContext open OASISGettext open OASISFileSystem let default_filename = in_srcdir " setup . log " let load ~ ctxt ( ) = let module SetTupleString = Set . Make ( struct type t = string * string let compare ( s11 , s12 ) ( s21 , s22 ) = match String . compare s11 s21 with |... |
module BaseBuilt = struct open OASISTypes open OASISGettext open BaseStandardVar open BaseMessage type t = | BExec | BExecLib | BLib | BObj | BDoc let to_log_event_file t nm = " built_ " ^ ( match t with | BExec -> " exec " | BExecLib -> " exec_lib " | BLib -> " lib " | BObj -> " obj " | BDoc -> " doc " ) ^ " _ " ^ nm ... |
module BaseCustom = struct open BaseEnv open BaseMessage open OASISTypes open OASISGettext let run cmd args extra_args = OASISExec . run ~ ctxt :! BaseContext . default ~ quote : false ( var_expand cmd ) ( List . map var_expand ( args @ ( Array . to_list extra_args ) ) ) let hook ( ? failsafe = false ) cstm f e = let o... |
module BaseDynVar = struct open OASISTypes open OASISGettext open BaseEnv open BaseBuilt let init ~ ctxt pkg = List . iter ( function | Executable ( cs , bs , _ ) -> if var_choose bs . bs_build then var_ignore ( var_redefine ~ dump : false ~ short_desc ( : fun ( ) -> Printf . sprintf ( f_ " Filename of executable ' % s... |
module BaseTest = struct open BaseEnv open BaseMessage open OASISTypes open OASISGettext let test ~ ctxt lst pkg extra_args = let one_test ( failure , n ) ( test_plugin , cs , test ) = if var_choose ~ name ( : Printf . sprintf ( f_ " test % s run " ) cs . cs_name ) ~ printer : string_of_bool test . test_run then begin ... |
module BaseDoc = struct open BaseEnv open BaseMessage open OASISTypes open OASISGettext let doc ~ ctxt lst pkg extra_args = let one_doc ( doc_plugin , cs , doc ) = if var_choose ~ name ( : Printf . sprintf ( f_ " documentation % s build " ) cs . cs_name ) ~ printer : string_of_bool doc . doc_build then begin info ( f_ ... |
module BaseSetup = struct open OASISContext open BaseEnv open BaseMessage open OASISTypes open OASISGettext open OASISUtils type std_args_fun = ctxt : OASISContext . t -> package -> string array -> unit type ( ' a , ' b ) section_args_fun = name * ( ctxt : OASISContext . t -> package -> ( common_section * ' a ) -> stri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.