text stringlengths 12 786k |
|---|
let dll_run dll entry = match ( try Result ( Obj . magic ( ndl_run_toplevel dll entry ) ) with exn -> Exception exn ) with | Exception _ as r -> r | Result r -> match Obj . magic r with | Ok x -> Result x | Err s -> fatal_error ( " Toploop . dll_run " ^ s ) |
module Backend = struct let symbol_for_global ' = Compilenv . symbol_for_global ' let closure_symbol = Compilenv . closure_symbol let really_import_approx = Import_approx . really_import_approx let import_symbol = Import_approx . import_symbol let size_int = Arch . size_int let big_endian = Arch . ... |
let backend = ( module Backend : Backend_intf . S ) |
let load ppf phrase_name program = let dll = if ! Clflags . keep_asm_file then phrase_name ^ ext_dll else Filename . temp_file ( " caml " ^ phrase_name ) ext_dll in let filename = Filename . chop_extension dll in let middle_end = if Config . flambda then Flambda_middle_end . lambda_to_clambda e... |
type lookup_fn = string -> Obj . t option |
type load_fn = Format . formatter -> string -> Lambda . program -> Topcommon . evaluation_outcome |
type assembler = { mutable lookup : lookup_fn ; mutable load : load_fn } |
let fns = { lookup ; load } |
let load ppf = fns . load ppf |
let lookup sym = fns . lookup sym |
let register_loader ~ lookup ~ load = fns . lookup <- lookup ; fns . load <- load |
type output_type = [ | ` HTML of string | ` CSV of string ] |
module Configuration = struct type t = { name : string ; rna_gene_fpkm_tracking_file : string option ; rna_min_gene_expression : float ; rna_transcript_fpkm_tracking_file : string option ; rna_min_transcript_expression : float ; rna_transcript_fkpm_gtf_file : string option ; mhc_epitope_lengths :... |
let run ( ~ run_with : Machine . t ) ~ configuration ~ reference_build ~ vcfs ~ predictor ~ alleles_file ~ output = let open KEDSL in let open Hla_utilities in let topiary = Machine . get_tool run_with Machine . Tool . Default . topiary in let predictor_tool = predictor_to_tool ~ run_with pred... |
let received_msg = option int |
let s = " ReWeb . Topic " , [ Alcotest . test_case " make , subscribe , publish , pull " ` Quick begin fun ( ) -> let topic = Topic . make ( ) in Lwt_main . run begin let open Lwt . Syntax in let * subscription = Topic . subscribe topic in let * ( ) = Topic . publish... |
module type Env = sig val bool : string -> bool val native : bool val native_dynlink : bool end |
module type Exts = sig val interface : string list val interface_opt : string list val library : string list val module_library : string list end |
module type Pkg = sig type builder = [ ` OCamlbuild | ` Other of string * string ] type moves type field = ? cond : bool -> ? exts : string list -> ? dst : string -> string -> moves val lib : field val lib_exec : ? auto : bool -> field val bin : ? auto : bool -> field val sbin : ? auto... |
module Topkg : sig val cmd : [ ` Build | ` Explain | ` Help ] val env : ( string * bool ) list val err_parse : string -> ' a val err_mdef : string -> ' a val err_miss : string -> ' a val err_file : string -> string -> ' a val warn_unused : string -> unit let err fmt = let k _ =... |
module Env : sig include Env val get : unit -> ( string * bool ) list let env = ref [ ] let get ( ) = ! env let add_bool key b = env := ( key , b ) :: ! env let bool key = let b = try List . assoc key Topkg . env with | Not_found -> if Topkg . cmd = ` Build then Topkg . err_m... |
module Exts : Exts = struct let interface = [ " . mli " ; " . cmi " ; " . cmti " ] let interface_opt = " . cmx " :: interface let library = [ " . cma " ; " . cmxa " ; " . cmxs " ; " . a " ] let module_library = ( interface_opt @ library ) end |
module Pkg : Pkg = struct type builder = [ ` OCamlbuild | ` Other of string * string ] type moves = ( string * ( string * string ) ) list type field = ? cond : bool -> ? exts : string list -> ? dst : string -> string -> moves let str = Printf . sprintf let warn_unused ( ) = le... |
let cmds = [ Bistro . cmd ; Browse . cmd ; Build . cmd ; Clean . cmd ; Distrib . cmd ; Doc . cmd ; Help . cmd ; Ipc . cmd ; Issue . cmd ; Lint . cmd ; Log . cmd ; Opam . cmd ; Publish . cmd ; Run . cmd ; Status . cmd ; Tag . cmd ; Test . cmd ; ] |
let main ( ) = ` Help ( ` Pager , None ) None |
let doc = " Topkg package care " |
let man = [ ` S Manpage . s_description ; ` P ( " $ mname ) mname takes care of topkg packages . " ; ` P " Use ' ( $ mname ) mname help release ' for help to release a package . " ; ` Noblank ; ` P " Use ' ( $ mname ) mname help delegate ' for help about the topkg deleg... |
let main = Term ( . ret ( const main $ Cli . setup ) setup ) setup , Term . info " topkg " ~ version " :%% VERSION " %% ~ doc ~ sdocs ~ exits ~ man |
let main ( ) = Topkg . Private . disable_main ( ) ; Term ( . exit_status @@ eval_choice main cmds ) cmds |
let ( ) = main ( ) |
let ocamlbuild_flags = Topkg_cmd ( . empty % " - use - ocamlfind " % " - classic - display ) " |
let build_cmd c os = let ocamlbuild = Topkg_conf . tool " ocamlbuild " os in let build_dir = Topkg_conf . build_dir c in let toolchain = match Topkg_conf . toolchain c with | Some toolchain -> Topkg_cmd ( . v " - toolchain " % toolchain ) toolchain | _ -> Topkg_cmd . empty in let debug = Top... |
let clean_cmd os ~ build_dir = let ocamlbuild = Topkg_conf . tool " ocamlbuild " os in Topkg_cmd ( . ocamlbuild %% ocamlbuild_flags % " - build - dir " % build_dir % " - clean ) " |
type t = { prepare_on_pin : bool ; dir : Topkg_fpath . t ; pre : Topkg_conf . t -> unit result ; cmd : Topkg_conf . t -> Topkg_conf . os -> Topkg_fpath . t list -> unit result ; post : Topkg_conf . t -> unit result ; clean : Topkg_conf . os -> build_dir : Topkg_fpath . t -> unit res... |
let with_dir b dir = { b with dir } |
let nop = fun _ -> Ok ( ) |
let cmd c os files = Topkg_os . Cmd . run @@ Topkg_cmd ( . build_cmd c os %% of_list files ) files |
let clean os ~ build_dir = Topkg_os . Cmd . run @@ clean_cmd os ~ build_dir |
let v ( ? prepare_on_pin = true ) true ( ? dir = " _build ) " ( ? pre = nop ) nop ( ? cmd = cmd ) cmd ( ? post = nop ) nop ( ? clean = clean ) clean ( ) = { prepare_on_pin ; dir ; pre ; cmd ; post ; clean ; } |
let prepare_on_pin b = b . prepare_on_pin |
let dir b = b . dir |
let pre b = b . pre |
let cmd b = b . cmd |
let post b = b . post |
let clean b = b . clean |
let codec = let prepare_on_pin = Topkg_codec ( . with_kind " prepare_on_pin " @@ bool ) bool in let dir = Topkg_codec ( . with_kind " dir " @@ string ) string in let fields = let stub _ = invalid_arg " not executable outside package definition " in ( fun b -> b . prepare_on_pin , ... |
let ocb_tag c key tag = let tag = Topkg_string . strf " % s ( s % a ) a " tag ( Topkg_conf . pp_value c ) c key in Topkg_cmd ( . v " - tag " % tag ) tag |
let ocb_bool_tag c key tag = Topkg_cmd ( . on ( Topkg_conf . value c key ) key @@ v " - tag " % tag ) tag |
let ocb_bool_tags c tags = let f ( key , tag ) tag = Topkg_cmd ( ) . %% ( ocb_bool_tag c key tag ) tag in List . fold_right f tags Topkg_cmd . empty |
module Tar = struct type ptime = int type t = string list let empty = [ ] let to_unix_path_string = if Fpath . dir_sep = " " / then Fpath . to_string else fun f -> String . concat ~ sep " " :/ ( Fpath . segs f ) f let set_filename h f = let s = to_unix_path_string f in match String . length s ... |
let path_set_of_dir dir ~ exclude_paths = let add_prefix p acc = Fpath ( . Set . add ( dir // p ) p acc ) acc in let exclude_paths = Fpath . Set ( . fold add_prefix exclude_paths empty ) empty in let not_excluded p = Ok ( not ( Fpath . Set . mem p exclude_paths ) exclude_paths ) ex... |
let tar dir ~ exclude_paths ~ root ~ mtime = let tar_add file tar = let fname = match Fpath . rem_prefix dir file with | None -> assert false | Some file -> Fpath ( . root // file ) file in Logs . info ( fun m -> m " Archiving % a " Fpath . pp fname ) fname ; tar >>= fun tar -> OS . Di... |
let bzip2_cmd = OS . Env ( . value " TOPKG_BZIP2 " cmd ~ absent ( : Cmd . v " bzip2 ) ) " |
let ensure_bzip2 ( ) = OS . Cmd . must_exist bzip2_cmd >>| fun _ -> ( ) |
let bzip2 s ~ dst = OS . Cmd ( . in_string s |> run_io bzip2_cmd |> to_file dst ) dst |
let tar_cmd = OS . Env ( . value " TOPKG_TAR " cmd ~ absent ( : Cmd . v " tar ) ) " |
let ensure_tar ( ) = OS . Cmd . must_exist tar_cmd >>| fun _ -> ( ) |
let untbz ( ? clean = false ) false ar = let clean_dir dir = OS . Dir . exists dir >>= function | true when clean -> OS . Dir . delete ~ recurse : true dir | _ -> Ok ( ) in let archive_dir , ar = Fpath . split_base ar in let unarchive ar = let dir = Fpath . rem_ext ar in OS . Cmd . must_exi... |
let run_delegate pkg args = let verbosity = Logs . level_to_string ( Logs . level ( ) ) in Topkg_care_pkg . delegate pkg >>= fun del -> Ok Cmd ( . del % " ipc " % verbosity %% args ) args >>= fun cmd -> OS . Cmd . run_status cmd >>= function | ` Exited 0 -> Ok ( ) | ` Exited... |
let publish_distrib p ~ msg ~ archive = Topkg_care_pkg . name p >>= fun name -> Topkg_care_pkg . version p >>= fun version -> Topkg_care_pkg . distrib_uri p >>= fun distrib_uri -> run_delegate p Cmd ( . v " publish " % " distrib " % distrib_uri % name % version % msg % p archive ) archiv... |
let publish_doc p ~ msg ~ docdir = let doc_uri p = Topkg_care_pkg . opam_field_hd p " doc " >>= function | None -> Ok " " | Some uri -> Ok uri in Topkg_care_pkg . name p >>= fun name -> Topkg_care_pkg . version p >>= fun version -> doc_uri p >>= fun doc_uri -> run_delegate p Cmd ( . v " pu... |
let publish_alt p ~ kind ~ msg ~ archive = Topkg_care_pkg . name p >>= fun name -> Topkg_care_pkg . version p >>= fun version -> Topkg_care_pkg . distrib_uri p >>= fun distrib_uri -> run_delegate p Cmd ( . v " publish " % " alt " % distrib_uri % kind % name % version % msg % p archive ) ... |
let publish_in_git_branch ~ remote ~ branch ~ name ~ version ~ docdir ~ dir = let pp_distrib ppf ( name , version ) version = Fmt . pf ppf " % a % a " Topkg_care_text . Pp . name name Topkg_care_text . Pp . version version in let log_publish_result msg distrib dir = Logs . app ( fun m -> m " ... |
let issues_uri p = Topkg_care_pkg . opam_field p " dev - repo " >>| function |
let issue_list p = issues_uri p >>= fun issues_uri -> run_delegate p Cmd ( . v " issue " % " list " % issues_uri ) issues_uri |
let issue_show p ~ id = issues_uri p >>= fun issues_uri -> run_delegate p Cmd ( . v " issue " % " show " % issues_uri % " id ) " |
let issue_open p ~ title ~ body = issues_uri p >>= fun issues_uri -> match run_delegate p Cmd ( . v " issue " % " open " % issues_uri % title % body ) body with | Ok _ as v -> v | Error _ as e -> let pp_body ppf = function " " -> ( ) | body -> Fmt . pf ppf " , , @@% s " body i... |
let issue_close p ~ id ~ msg = issues_uri p >>= fun issues_uri -> match run_delegate p Cmd ( . v " issue " % " close " % issues_uri % id % msg ) msg with | Ok _ as v -> v | Error _ as e -> Logs . app ( fun m -> m [ " @< v > Your closing message was , , :@---@% s ] " @ msg ) ms... |
let ocaml = Cmd . of_list @@ Topkg . Cmd . to_list @@ Topkg . Conf . tool " ocaml " ` Build_os |
let pkg_must_exist pkg_file = match OS . File . must_exist pkg_file with let p = match OS . Dir . current ( ) with | Error _ -> pkg_file | Ok dir -> Fpath ( . dir // pkg_file ) pkg_file in R . error_msgf " Not a package : no file % a " Fpath . pp p |
let ask ~ pkg_file ipc = let codec = Topkg . Private . Ipc . codec ipc in let verbosity = Logs ( . level_to_string ( level ( ) ) ) in let ipc_cmd = Cmd . of_list @@ Topkg . Cmd . to_list @@ Topkg . Private . Ipc . cmd ipc in let cmd = Cmd ( . ocaml % p pkg_file % " ipc " % verbosity... |
let cmd = Cmd . of_list @@ Topkg . Cmd . to_list @@ Topkg . Conf . tool " ocamlbuild " ` Host_os |
let find_packages ~ roots s = let package = String . sub " package ( package " in let not_rpar c = not ( Char . equal ' ) ' ' c ) c in let not_dot c = not ( Char . equal ' . ' c ) c in let is_comma c = Char . equal ' , ' c in let is_sep c = Char . Ascii . is_white c || is_... |
let package_tags ( ? roots = false ) false file = OS . File . read file >>= fun contents -> Ok ( find_packages ~ roots contents ) contents |
let cmd = Cmd . of_list @@ Topkg . Cmd . to_list @@ Topkg . Conf . tool " opam " ` Host_os |
let publish = let absent = Cmd ( . v " opam - publish ) " in OS . Env ( . value " TOPKG_OPAM_PUBLISH " cmd ~ absent ) absent |
let ensure_publish ( ) = OS . Cmd . must_exist publish >>= fun cmd -> OS . Cmd . run_out Cmd ( . publish % " -- version ) " |> OS . Cmd . out_string >>= fun ( version , _ ) _ -> match Topkg . String . parse_version version with | None -> R . error_msgf " Could not determine the vers... |
let submit ? msg ~ opam_file = let msg = match msg with | None -> Ok ( Cmd . empty ) empty | Some msg -> OS . File . tmp " topkg - opam - submit - msg -% s " >>= fun m -> OS . File . write m msg >>= fun ( ) -> Ok Cmd ( . v " -- msg - file " % p m ) m in msg >>= fun msg -> OS... |
let ocaml_base_packages = String . Set . of_list [ " base - bigarray " ; " base - bytes " ; " base - threads " ; " base - unix " ; ] |
module File = struct let id x = x let list f = fun v -> [ f v ] v let field name field conv = name , fun acc o -> String . Map . add name ( conv ( field o ) o ) o acc let opt_field name field conv = name , fun acc o -> match field o with | None -> acc | Some v -> String . Map . add name ( ... |
module Descr = struct type t = string * string let of_string s = match String . cuts ~ sep " :\ n " s with | [ ] -> R . error_msgf " Cannot extract opam descr . " | synopsis :: descr -> Ok ( synopsis , String . concat ~ sep " :\ n " descr ) descr let to_string ( synopsis , descr ) ... |
module Url = struct type t = string let v ~ uri ~ checksum = strf " archive : " \% s " \\ nchecksum : " \% s " " \ uri checksum let with_distrib_file ~ uri distrib_file = try let checksum = Digest ( . to_hex @@ file ( Fpath . to_string distrib_file ) distrib_file ) distrib_file in Ok ( v ... |
let path_set_of_strings ps = try let add_excl acc p = match Fpath . of_string p with | Error ( ` Msg msg ) msg -> failwith msg | Ok p -> Fpath . Set . add p acc in Ok ( List . fold_left add_excl Fpath . Set . empty ps ) ps with Failure msg -> R . error_msg msg |
let rec path_list_of_strings ps = let rec loop acc = function | [ ] -> Ok ( List . rev acc ) acc | p :: ps -> match Fpath . of_string p with | Error _ as e -> e | Ok p -> loop ( p :: acc ) acc ps in loop [ ] ps |
let uri_sld uri = match Topkg_care_text . split_uri uri with match List . rev ( String . cuts ~ sep " . " : host ) host with | fst :: snd :: _ -> Some snd | _ -> None |
let uri_append u s = match String . head ~ rev : true u with |
let chop_ext u = match String . cut ~ rev : true ~ sep " . " : u with |
let chop_git_prefix u = match String . cut ~ sep " : git " + u with |
type t = { name : string option ; version : string option ; delegate : Cmd . t option ; build_dir : Fpath . t option ; opam : Fpath . t option ; opam_descr : Fpath . t option ; opam_fields : ( string list String . map , R . msg ) msg result Lazy . t ; readmes : Fpath . t list o... |
let empty p = { p with pkg = lazy ( Ok ( Topkg . Private . Pkg . empty ) empty ) empty } |
let pkg p = Lazy . force p . pkg |
let opam_fields p = Lazy . force p . opam_fields |
let opam_field p f = opam_fields p >>| fun fields -> String . Map . find f fields |
let opam_field_hd p f = opam_field p f >>| function |
let opam_homepage_sld p = opam_field_hd p " homepage " >>| function |
let pkg_file p = p . pkg_file |
let name p = match p . name with |
let version p = match p . version with |
let delegate p = let not_found ( ) = R . error_msg " No package delegate found . \ Try ` topkg help delegate ` for more information . " in match p . delegate with | Some cmd -> Ok cmd | None -> pkg p >>| Topkg . Private . Pkg . delegate >>= function | Some cmd -> Ok ( Cmd . of_list @@ T... |
let build_dir p = match p . build_dir with |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.