text stringlengths 0 601k |
|---|
let stdin = open_descriptor_in 0 |
let stdout = open_descriptor_out 1 |
let stderr = open_descriptor_out 2 |
type open_flag = Open_rdonly | Open_wronly | Open_append | Open_creat | Open_trunc | Open_excl | Open_binary | Open_text | Open_nonblock " caml_ml_set_channel_name " |
let open_out_gen mode perm name = let c = open_descriptor_out ( open_desc name mode perm ) in set_out_channel_name c name ; c |
let open_out name = open_out_gen [ Open_wronly ; Open_creat ; Open_trunc ; Open_text ] 0o666 name |
let open_out_bin name = open_out_gen [ Open_wronly ; Open_creat ; Open_trunc ; Open_binary ] 0o666 name = " caml_ml_out_channels_list " |
let flush_all ( ) = let rec iter = function [ ] -> ( ) | a :: l -> begin try flush a with Sys_error _ -> ( ) end ; iter l in iter ( out_channels_list ( ) ) = " caml_ml_output_bytes " = " caml_ml_output " |
let output_bytes oc s = unsafe_output oc s 0 ( bytes_length s ) |
let output_string oc s = unsafe_output_string oc s 0 ( string_length s ) |
let output oc s ofs len = if ofs < 0 || len < 0 || ofs > bytes_length s - len then invalid_arg " output " else unsafe_output oc s ofs len |
let output_substring oc s ofs len = if ofs < 0 || len < 0 || ofs > string_length s - len then invalid_arg " output_substring " else unsafe_output_string oc s ofs len = " caml_output_value " |
let output_value chan v = marshal_to_channel chan v [ ] |
let close_out oc = flush oc ; close_out_channel oc |
let close_out_noerr oc = ( try flush oc with _ -> ( ) ) ; ( try close_out_channel oc with _ -> ( ) ) = " caml_ml_set_binary_mode " " caml_ml_set_channel_name " |
let open_in_gen mode perm name = let c = open_descriptor_in ( open_desc name mode perm ) in set_in_channel_name c name ; c |
let open_in name = open_in_gen [ Open_rdonly ; Open_text ] 0 name |
let open_in_bin name = open_in_gen [ Open_rdonly ; Open_binary ] 0 name = " caml_ml_input " |
let input ic s ofs len = if ofs < 0 || len < 0 || ofs > bytes_length s - len then invalid_arg " input " else unsafe_input ic s ofs len |
let rec unsafe_really_input ic s ofs len = if len <= 0 then ( ) else begin let r = unsafe_input ic s ofs len in if r = 0 then raise End_of_file else unsafe_really_input ic s ( ofs + r ) ( len - r ) end |
let really_input ic s ofs len = if ofs < 0 || len < 0 || ofs > bytes_length s - len then invalid_arg " really_input " else unsafe_really_input ic s ofs len |
let really_input_string ic len = let s = bytes_create len in really_input ic s 0 len ; bytes_unsafe_to_string s |
let input_line chan = let rec build_result buf pos = function [ ] -> buf | hd :: tl -> let len = bytes_length hd in bytes_blit hd 0 buf ( pos - len ) len ; build_result buf ( pos - len ) tl in let rec scan accu len = let n = input_scan_line chan in if n = 0 then begin match accu with [ ] -> raise End_of_file | _ -> bui... |
let close_in_noerr ic = ( try close_in ic with _ -> ( ) ) = " caml_ml_set_binary_mode " |
let print_char c = output_char stdout c |
let print_string s = output_string stdout s |
let print_bytes s = output_bytes stdout s |
let print_int i = output_string stdout ( string_of_int i ) |
let print_float f = output_string stdout ( string_of_float f ) |
let print_endline s = output_string stdout s ; output_char stdout ' \ n ' ; flush stdout |
let print_newline ( ) = output_char stdout ' \ n ' ; flush stdout |
let prerr_char c = output_char stderr c |
let prerr_string s = output_string stderr s |
let prerr_bytes s = output_bytes stderr s |
let prerr_int i = output_string stderr ( string_of_int i ) |
let prerr_float f = output_string stderr ( string_of_float f ) |
let prerr_endline s = output_string stderr s ; output_char stderr ' \ n ' ; flush stderr |
let prerr_newline ( ) = output_char stderr ' \ n ' ; flush stderr |
let read_line ( ) = flush stdout ; input_line stdin |
let read_int ( ) = int_of_string ( read_line ( ) ) |
let read_int_opt ( ) = int_of_string_opt ( read_line ( ) ) |
let read_float ( ) = float_of_string ( read_line ( ) ) |
let read_float_opt ( ) = float_of_string_opt ( read_line ( ) ) |
module LargeFile = struct external seek_out : out_channel -> int64 -> unit = " caml_ml_seek_out_64 " external pos_out : out_channel -> int64 = " caml_ml_pos_out_64 " external out_channel_length : out_channel -> int64 = " caml_ml_channel_size_64 " external seek_in : in_channel -> int64 -> unit = " caml_ml_seek_in_64 " e... |
type ( ' a , ' b , ' c , ' d , ' e , ' f ) format6 = ( ' a , ' b , ' c , ' d , ' e , ' f ) CamlinternalFormatBasics . format6 = Format of ( ' a , ' b , ' c , ' d , ' e , ' f ) CamlinternalFormatBasics . fmt * string |
type ( ' a , ' b , ' c , ' d ) format4 = ( ' a , ' b , ' c , ' c , ' c , ' d ) format6 |
type ( ' a , ' b , ' c ) format = ( ' a , ' b , ' c , ' c ) format4 |
let string_of_format ( Format ( _fmt , str ) ) = str ( ' a , ' b , ' c , ' d , ' e , ' f ) format6 -> ( ' a , ' b , ' c , ' d , ' e , ' f ) format6 = " % identity " |
let ( ^^ ) ( Format ( fmt1 , str1 ) ) ( Format ( fmt2 , str2 ) ) = Format ( CamlinternalFormatBasics . concat_fmt fmt1 fmt2 , str1 ^ " , " % ^ str2 ) |
let exit_function = ref flush_all |
let at_exit f = let g = ! exit_function in let f_already_ran = ref false in exit_function := ( fun ( ) -> if not ! f_already_ran then begin f_already_ran := true ; f ( ) end ; g ( ) ) |
let do_at_exit ( ) = ( ! exit_function ) ( ) |
let exit retcode = do_at_exit ( ) ; sys_exit retcode |
let _ = register_named_value " Pervasives . do_at_exit " do_at_exit |
type t = { loc_start : position ; loc_end : position ; loc_ghost : bool } ; ; |
let none = { loc_start = dummy_pos ; loc_end = dummy_pos ; loc_ghost = true } ; ; |
let curr lexbuf = { loc_start = lexbuf . lex_start_p ; loc_end = lexbuf . lex_curr_p ; loc_ghost = false } ; ; |
let symbol_rloc ( ) = { loc_start = Parsing . symbol_start_pos ( ) ; loc_end = Parsing . symbol_end_pos ( ) ; loc_ghost = false ; } ; ; |
let symbol_gloc ( ) = { loc_start = Parsing . symbol_start_pos ( ) ; loc_end = Parsing . symbol_end_pos ( ) ; loc_ghost = true ; } ; ; |
let rhs_loc n = { loc_start = Parsing . rhs_start_pos n ; loc_end = Parsing . rhs_end_pos n ; loc_ghost = false ; } ; ; end |
type constant = Const_int of int | Const_char of char | Const_string of string | Const_float of string | Const_int32 of int32 | Const_int64 of int64 | Const_nativeint of nativeint |
type rec_flag = Nonrecursive | Recursive | Default |
type direction_flag = Upto | Downto |
type private_flag = Private | Public |
type mutable_flag = Immutable | Mutable |
type virtual_flag = Virtual | Concrete |
type override_flag = Override | Fresh |
type closed_flag = Closed | Open |
type label = string end |
type t = Lident of string | Ldot of t * string | Lapply of t * t end |
type core_type = { ptyp_desc : core_type_desc ; ptyp_loc : Location . t } Ptyp_any | Ptyp_var of string | Ptyp_arrow of label * core_type * core_type | Ptyp_tuple of core_type list | Ptyp_constr of Longident . t * core_type list | Ptyp_object of core_field_type list | Ptyp_class of Longident . t * core_type list * labe... |
type ' a class_infos = { pci_virt : virtual_flag ; pci_params : string list * Location . t ; pci_name : string ; pci_expr : ' a ; pci_variance : ( bool * bool ) bool list ; pci_loc : Location . t } |
type pattern = { ppat_desc : pattern_desc ; ppat_loc : Location . t } Ppat_any | Ppat_var of string | Ppat_alias of pattern * string | Ppat_constant of constant | Ppat_tuple of pattern list | Ppat_construct of Longident . t * pattern option * bool | Ppat_variant of label * pattern option | Ppat_record of ( Longident . ... |
type expression = { pexp_desc : expression_desc ; pexp_loc : Location . t } Pexp_ident of Longident . t | Pexp_constant of constant | Pexp_let of rec_flag * ( pattern * expression ) expression list * expression | Pexp_function of label * expression option * ( pattern * expression ) expression list | Pexp_apply of expre... |
type toplevel_phrase = Ptop_def of structure | Ptop_dir of string * directive_argument Pdir_none | Pdir_string of string | Pdir_int of int | Pdir_ident of Longident . t | Pdir_bool of bool end |
type foo = Foo of int | Bar of int | Baz |
let tests = " Stdlib_pervasives " >::: [ " infinity " >:: begin fun ( ) -> assert_equal ( string_of_float infinity ) infinity " inf " end ; " neg_infinity " >:: begin fun ( ) -> assert_equal ( string_of_float neg_infinity ) neg_infinity " - inf " end ; " nan " >:: begin fun ( ) -> assert_equal ( string_of_float nan ) n... |
module Stdlib = struct # else = " caml_register_named_value " |
let ( ) = register_named_value " Pervasives . array_bound_error " ( Invalid_argument " index out of bounds " ) # end |
let failwith s = raise ( Failure s ) |
let invalid_arg s = raise ( Invalid_argument s ) # else |
let min x y = if x <= y then x else y |
let max x y = if x >= y then x else y # end |
let abs x = if x >= 0 then x else - x |
let lnot x = x lxor ( - 1 ) |
let max_int = ( - 1 ) lsr 1 |
let min_int = max_int + 1 # else [ @@ unboxed ] [ @@ noalloc ] # end [ @@ unboxed ] [ @@ noalloc ] # else [ @@ unboxed ] [ @@ noalloc ] [ @@ unboxed ] [ @@ noalloc ] [ @@ unboxed ] [ @@ noalloc ] [ @@ unboxed ] [ @@ noalloc ] # end = " caml_hypot_float " " caml_hypot " [ @@ unboxed ] [ @@ noalloc ] # else [ @@ unboxed ... |
let epsilon_float = 2 . 22044604925031308e - 16 # else |
let infinity = float_of_bits 0x7F_F0_00_00_00_00_00_00L |
let neg_infinity = float_of_bits 0xFF_F0_00_00_00_00_00_00L |
let nan = float_of_bits 0x7F_F0_00_00_00_00_00_01L |
let max_float = float_of_bits 0x7F_EF_FF_FF_FF_FF_FF_FFL |
let min_float = float_of_bits 0x00_10_00_00_00_00_00_00L |
let epsilon_float = float_of_bits 0x3C_B0_00_00_00_00_00_00L # end |
type fpclass = FP_normal | FP_subnormal | FP_zero | FP_infinite | FP_nan |
let classify_float ( x : float ) : fpclass = if ( [ % raw { | isFinite } ] | : _ -> _ [ @ bs ] ) x [ @ bs ] then if abs_float x >= min_float then FP_normal else if x <> 0 . then FP_subnormal else FP_zero else if ( [ % raw { | isNaN } ] | : _ -> _ [ @ bs ] ) x [ @ bs ] then FP_nan else FP_infinite # else " caml_classify... |
let ( ^ ) s1 s2 = let l1 = string_length s1 and l2 = string_length s2 in let s = bytes_create ( l1 + l2 ) in string_blit s1 0 s 0 l1 ; string_blit s2 0 s l1 l2 ; bytes_unsafe_to_string s # end |
let char_of_int n = if n < 0 || n > 255 then invalid_arg " char_of_int " else unsafe_char_of_int n |
type ' a ref = { mutable contents : ' a } |
type ( ' a , ' b ) result = ( ' a , ' b ) Belt . Result . t = Ok of ' a | Error of ' b # else # end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.