text stringlengths 0 601k |
|---|
let add_int64_ne b x = let new_position = b . position + 8 in if new_position > b . length then resize b 8 ; unsafe_set_int64 b . buffer b . position x ; b . position <- new_position |
let add_int16_le b x = add_int16_ne b ( if Sys . big_endian then swap16 x else x ) |
let add_int16_be b x = add_int16_ne b ( if Sys . big_endian then x else swap16 x ) |
let add_int32_le b x = add_int32_ne b ( if Sys . big_endian then swap32 x else x ) |
let add_int32_be b x = add_int32_ne b ( if Sys . big_endian then x else swap32 x ) |
let add_int64_le b x = add_int64_ne b ( if Sys . big_endian then swap64 x else x ) |
let add_int64_be b x = add_int64_ne b ( if Sys . big_endian then x else swap64 x ) |
type t = A of t * t | B ; ; |
type t2 = C of ( t2 * t2 ) | D ; ; |
type ' a t3 = S of ' a | T ; ; |
let A ( b , B ) = A ( B , B ) ; ; |
let f ( A ( B , B ) ) = ( ) ; ; |
let f B ( A ( B , B ) ) = ( ) ; ; |
let ( D , d ) = ( D , D ) ; ; |
let ( C ( D , d ) ) = ( C ( D , D ) ) ; ; function |
let Some a = Some 42 ; ; |
let Some a :: y = [ Some 42 ] ; ; |
let Some a , b = Some 42 , 43 ; ; |
let ( Some a ) , b = Some 42 , 43 ; ; |
let Some a as b = let _ = b = 42 in Some 42 ; ; |
let Some a | Some a = Some 42 ; ; |
let x , y as r = 1 , 2 ; ; |
let ( ( x , y ) as r ) = ( 1 , 2 ) ; ; |
type top = Top of ( int * int ) ; ; |
let rec f x y = ( ) ; ; |
let rec next line pos0 = ( ) in ( ) ; ; |
let best = if Sys . command " command - v ocamlopt > / dev / null " = 0 then " native " else " byte " |
module Conf = struct let server_dir = " server " let client_dir = " client " let type_dir = " type_dir " end |
module Intern = struct let with_eliom_ppx = Some ( function | ` Client -> " src / ppx / ppx_eliom_client_ex . " ^ best | ` Server -> " src / ppx / ppx_eliom_server_ex . " ^ best ) let with_package = function | " eliom . ppx . type " -> " pkg_ppx_eliom_types " | " eliom . ppx . client " | " eliom . ppx . server " | " el... |
module Eliom_plugin = Ocamlbuild_eliom . MakeIntern ( Intern ) ( Conf ) |
let _ = dispatch ( fun x -> Eliom_plugin . dispatcher x ; match x with | After_rules -> Doc . init ( ) ; let link source dest = rule ( Printf . sprintf " % s -> % s " source dest ) ~ dep : source ~ prod : dest ( fun env _ -> Cmd ( S [ A " ln " ; A " - f " ; P ( env source ) ; P ( env dest ) ] ) ) in pflag [ " ocaml " ;... |
let _ = Options . make_links := false ; Options . plugin := false ; Options . use_ocamlfind := true ; Ocamlbuild_unix_plugin . setup ( ) ; Ocamlbuild_pack . Main . main ( ) |
type c_linking_mode = LinkingStatic | LinkingShared |
type linking_mode = LinkingLibrary | LinkingPlugin | LinkingExecutable |
type annotation_mode = AnnotationNone | AnnotationBin | AnnotationText | AnnotationBoth |
type packopt = Hier . t option |
let annotToOpts = function | AnnotationNone -> [ ] | AnnotationBin -> [ " - bin - annot " ] | AnnotationText -> [ " - annot " ] | AnnotationBoth -> [ " - bin - annot " ; " - annot " ] |
let runOcamlCompile dirSpec useThread annotMode buildMode compileOpt packopt pp oflags modhier = let dstDir = dirSpec . dst_dir in let entry = Hier . get_file_entry modhier [ dirSpec . src_dir ] in let src_file = Hier . get_src_file dirSpec . src_dir entry in let compileOpt = if buildMode = Interface && compileOpt = Wi... |
let runOcamlPack srcDir dstDir annotMode buildMode packOpt dest modules = let prog = if buildMode = ByteCode then Prog . getOcamlC ( ) else Prog . getOcamlOpt ( ) in let ext = if buildMode = ByteCode then Filetype . FileCMO else Filetype . FileCMX in let ext_f = function | Filetype . FileML -> ext | Filetype . FileMLI ... |
let runOcamlInfer srcDir includes pp modname = let entry = Hier . get_file_entry modname [ srcDir ] in let args = [ Prog . getOcamlC ( ) ; " - i " ] @ Pp . to_params pp @ ( Utils . to_include_path_options includes ) @ [ fp_to_string ( Hier . get_src_file srcDir entry ) ] in match run args with | Success ( mli , _ , _ )... |
let o_from_cfile file = file . <> " o " |
let runCCompile project dirSpec cflags file = let dstDir = dirSpec . dst_dir in Filesystem . mkdirSafeRecursive dstDir 0o755 ; let callCCompiler = string_words_noempty ( Analyze . get_ocaml_config_key " bytecomp_c_compiler " project ) in let srcFile = dirSpec . src_dir </> file in let dstFile = dirSpec . dst_dir </> o_... |
let runAr dest deps = let args = [ Prog . getAR ( ) ; " rc " ; fp_to_string dest ] @ List . map fp_to_string deps in Process . make args |
let runRanlib dest = Process . make [ Prog . getRanlib ( ) ; fp_to_string dest ] |
let runCLinking sharingMode depfiles dest = let args = if gconf . ocamlmklib then [ Prog . getOcamlMklib ( ) ] @ ( match sharingMode with | LinkingStatic -> [ " - custom " ] | LinkingShared -> [ ] ) @ [ " - o " ; fp_to_string dest ] @ List . map fp_to_string depfiles else [ Prog . getCC ( ) ] @ ( match sharingMode with... |
let runOcamlLinking includeDirs buildMode linkingMode compileType useThread systhread cclibs libs modules dest = let link_maybe linking_mode dest = let file_or_link_exists fn = try let _ = Unix . lstat fn in true with _ -> false in ( match linking_mode with | LinkingPlugin | LinkingLibrary -> ( ) | LinkingExecutable ->... |
module Env : sig type t val new_descr : t -> Export_info . descr -> Export_id . t val record_descr : t -> Export_id . t -> Export_info . descr -> unit val new_value_closure_descr : t -> closure_id : Closure_id . t -> set_of_closures : Export_info . value_set_of_closures -> Export_id . t val get_descr : t -> Export_info... |
let descr_of_constant ( c : Flambda . const ) : Export_info . descr = match c with | Int i -> Value_int i | Char c -> Value_char c |
let descr_of_allocated_constant ( c : Allocated_const . t ) : Export_info . descr = match c with | Float f -> Value_float f | Int32 i -> Value_boxed_int ( Int32 , i ) | Int64 i -> Value_boxed_int ( Int64 , i ) | Nativeint i -> Value_boxed_int ( Nativeint , i ) | String s -> let v_string : Export_info . value_string = {... |
let rec approx_of_expr ( env : Env . t ) ( flam : Flambda . t ) : Export_info . approx = match flam with | Var var -> Env . find_approx env var | Let { var ; defining_expr ; body ; _ } -> let approx = descr_of_named env defining_expr in let env = Env . add_approx env var approx in approx_of_expr env body | Let_mutable ... |
let approx_of_constant_defining_value_block_field env ( c : Flambda . constant_defining_value_block_field ) : Export_info . approx = match c with | Symbol s -> if Env . is_symbol_being_defined env s then Value_unknown else Value_symbol s | Const c -> Value_id ( Env . new_descr env ( descr_of_constant c ) ) |
let describe_constant_defining_value env export_id symbol ~ symbols_being_defined ( const : Flambda . constant_defining_value ) = let env = Env . empty_of_global ~ symbols_being_defined env in match const with | Allocated_const alloc_const -> let descr = descr_of_allocated_constant alloc_const in Env . record_descr env... |
let describe_program ( env : Env . Global . t ) ( program : Flambda . program ) = let rec loop env ( program : Flambda . program_body ) = match program with | Let_symbol ( symbol , constant_defining_value , program ) -> let id , env = Env . Global . new_symbol env symbol in describe_constant_defining_value env id symbo... |
let build_transient ( ~ backend : ( module Backend_intf . S ) ) ( program : Flambda . program ) : Export_info . transient = if ! Clflags . opaque then let compilation_unit = Compilenv . current_unit ( ) in let root_symbol = Compilenv . current_unit_symbol ( ) in Export_info . opaque_transient ~ root_symbol ~ compilatio... |
let add_equation_on_var denv var shape = let kind = T . kind shape in let var_type = T . alias_type_of kind ( Simple . var var ) in match T . meet ( DE . typing_env denv ) var_type shape with | Ok ( _ty , env_extension ) -> DE . map_typing_env denv ~ f ( : fun tenv -> TE . add_env_extension tenv env_extension ) | Botto... |
let denv_of_number_decision naked_kind shape param_var naked_var denv : DE . t = let naked_name = VB . create naked_var Name_mode . normal in let denv = DE . define_variable denv naked_name naked_kind in add_equation_on_var denv param_var shape |
let rec denv_of_decision denv ~ param_var ( decision : U . decision ) : DE . t = match decision with | Do_not_unbox _ -> denv | Unbox ( Unique_tag_and_size { tag ; fields } ) -> let field_kind = if Tag . equal tag Tag . double_array_tag then K . naked_float else K . value in let denv = List . fold_left ( fun denv ( { e... |
type bindAction = | BindSet of eventField list * ( eventInfo -> unit ) | BindSetBreakable of eventField list * ( eventInfo -> unit ) | BindRemove | BindExtend of eventField list * ( eventInfo -> unit ) |
let bind widget eventsequence action = tkCommand [ | TkToken " bind " ; TkToken ( Widget . name widget ) ; cCAMLtoTKeventSequence eventsequence ; begin match action with BindRemove -> TkToken " " | BindSet ( what , f ) -> let cbId = register_callback widget ( wrapeventInfo f what ) in TkToken ( " camlcb " ^ cbId ^ ( wr... |
let bind_class clas eventsequence action = tkCommand [ | TkToken " bind " ; TkToken clas ; cCAMLtoTKeventSequence eventsequence ; begin match action with BindRemove -> TkToken " " | BindSet ( what , f ) -> let cbId = register_callback Widget . dummy ( wrapeventInfo f what ) in TkToken ( " camlcb " ^ cbId ^ ( writeevent... |
let bind_tag = bind_class ; ; |
let break = function ( ) -> Textvariable . set ( Textvariable . coerce " BreakBindingsSequence " ) " 1 " ; ; |
let class_bind = bind_class ; ; ## else |
let bind_class ~ events ( ? extend = false ) ( ? breakable = false ) ( ? fields = [ ] ) ? action ? on : widget name = let widget = match widget with None -> Widget . dummy | Some w -> coe w in tkCommand [ | TkToken " bind " ; TkToken name ; cCAMLtoTKeventSequence events ; begin match action with None -> TkToken " " | S... |
let bind ~ events ? extend ? breakable ? fields ? action widget = bind_class ~ events ? extend ? breakable ? fields ? action ~ on : widget ( Widget . name widget ) ; ; |
let bind_tag = bind_class ; ; |
let break = function ( ) -> tkCommand [ | TkToken " set " ; TkToken " BreakBindingsSequence " ; TkToken " 1 " ] | ; ; ## endif |
let cCAMLtoTKxEvent = function | Activate -> " Activate " | ButtonPress -> " ButtonPress " | ButtonPressDetail n -> " ButtonPress " -^ string_of_int n | ButtonRelease -> " ButtonRelease " | ButtonReleaseDetail n -> " ButtonRelease " -^ string_of_int n | Circulate -> " Circulate " | ColorMap -> " Colormap " | Configure ... |
let cCAMLtoTKmodifier = function | Control -> " Control " - | Shift -> " Shift " - | Lock -> " Lock " - | Button1 -> " Button1 " - | Button2 -> " Button2 " - | Button3 -> " Button3 " - | Button4 -> " Button4 " - | Button5 -> " Button5 " - | Double -> " Double " - | Triple -> " Triple " - | Mod1 -> " Mod1 " - | Mod2 -> ... |
let cCAMLtoTKevent ( ml , xe ) = match xe with | Virtual s -> if ml = [ ] then " " <<^ s " " ^>> else raise IllegalVirtualEvent | _ -> " " < ^ ( String . concat " " ( List . map cCAMLtoTKmodifier ml ) ) ^ ( cCAMLtoTKxEvent xe ) ^ " " > ; ; |
let cCAMLtoTKeventSequence l = TkToken ( List . fold_left ( ) ^ " " ( List . map cCAMLtoTKevent l ) ) ## else |
let cCAMLtoTKmodifier : modifier -> string = function | ` Control -> " Control " - | ` Shift -> " Shift " - | ` Lock -> " Lock " - | ` Button1 -> " Button1 " - | ` Button2 -> " Button2 " - | ` Button3 -> " Button3 " - | ` Button4 -> " Button4 " - | ` Button5 -> " Button5 " - | ` Double -> " Double " - | ` Triple -> " T... |
let cCAMLtoTKevent ( ev : event ) = let modified = ref false in let rec convert = function | ` Activate -> " Activate " | ` ButtonPress -> " ButtonPress " | ` ButtonPressDetail n -> " ButtonPress " -^ string_of_int n | ` ButtonRelease -> " ButtonRelease " | ` ButtonReleaseDetail n -> " ButtonRelease " -^ string_of_int ... |
let cCAMLtoTKeventSequence ( l : event list ) = TkToken ( String . concat ~ sep " " : ( List . map ~ f : cCAMLtoTKevent l ) ) ; ; ## endif |
let cCAMLtoTKcolor = function NamedColor x -> TkToken x | Black -> TkToken " black " | White -> TkToken " white " | Red -> TkToken " red " | Green -> TkToken " green " | Blue -> TkToken " blue " | Yellow -> TkToken " yellow " ; ; |
let cTKtoCAMLcolor = function s -> NamedColor s ; ; |
let cCAMLtoTKcursor = function XCursor s -> TkToken s | XCursorFg ( s , fg ) -> TkQuote ( TkTokenList [ TkToken s ; cCAMLtoTKcolor fg ] ) | XCursortFgBg ( s , fg , bg ) -> TkQuote ( TkTokenList [ TkToken s ; cCAMLtoTKcolor fg ; cCAMLtoTKcolor bg ] ) | CursorFileFg ( s , fg ) -> TkQuote ( TkTokenList [ TkToken ( " " @^ ... |
let cCAMLtoTKcolor : color -> tkArgs = function | ` Color x -> TkToken x | ` Black -> TkToken " black " | ` White -> TkToken " white " | ` Red -> TkToken " red " | ` Green -> TkToken " green " | ` Blue -> TkToken " blue " | ` Yellow -> TkToken " yellow " ; ; |
let cTKtoCAMLcolor = function s -> ` Color s ; ; |
let cCAMLtoTKcursor : cursor -> tkArgs = function | ` Xcursor s -> TkToken s | ` Xcursorfg ( s , fg ) -> TkQuote ( TkTokenList [ TkToken s ; cCAMLtoTKcolor fg ] ) | ` Xcursorfgbg ( s , fg , bg ) -> TkQuote ( TkTokenList [ TkToken s ; cCAMLtoTKcolor fg ; cCAMLtoTKcolor bg ] ) | ` Cursorfilefg ( s , fg ) -> TkQuote ( TkT... |
type index_constrs = CNumber | CActiveElement | CEnd | CLast | CNoIndex | CInsert | CSelFirst | CSelLast | CAt | CAtXY | CAnchorPoint | CPattern | CLineChar | CMark | CTagFirst | CTagLast | CEmbedded ; ; |
let index_any_table = [ CNumber ; CActiveElement ; CEnd ; CLast ; CNoIndex ; CInsert ; CSelFirst ; CSelLast ; CAt ; CAtXY ; CAnchorPoint ; CPattern ; CLineChar ; CMark ; CTagFirst ; CTagLast ; CEmbedded ] ; ; |
let index_canvas_table = [ CNumber ; CEnd ; CInsert ; CSelFirst ; CSelLast ; CAtXY ] ; ; |
let index_entry_table = [ CNumber ; CAnchorPoint ; CEnd ; CInsert ; CSelFirst ; CSelLast ; CAt ] ; ; |
let index_listbox_table = [ CNumber ; CActiveElement ; CAnchorPoint ; CEnd ; CAtXY ] ; ; |
let index_menu_table = [ CNumber ; CActiveElement ; CEnd ; CLast ; CNoIndex ; CAt ; CPattern ] ; ; |
let index_text_table = [ CLineChar ; CAtXY ; CEnd ; CMark ; CTagFirst ; CTagLast ; CEmbedded ] ; ; |
let cCAMLtoTKindex table = function Number x -> chk_sub " Number " table CNumber ; TkToken ( string_of_int x ) | ActiveElement -> chk_sub " ActiveElement " table CActiveElement ; TkToken " active " | End -> chk_sub " End " table CEnd ; TkToken " end " | Last -> chk_sub " Last " table CLast ; TkToken " last " | NoIndex ... |
let char_index c s = let rec find i = if i >= String . length s then raise Not_found else if String . get s i = c then i else find ( i + 1 ) in find 0 ; ; |
let cTKtoCAMLindex s = try let p = char_index ' . ' s in LineChar ( int_of_string ( String . sub s 0 p ) , int_of_string ( String . sub s ( p + 1 ) ( String . length s - p - 1 ) ) ) with Not_found -> try Number ( int_of_string s ) with _ -> raise ( Invalid_argument ( " TKtoCAMLindex : " ^ s ) ) ; ; ## else |
let cCAMLtoTKindex = function | ` Num x -> TkToken ( string_of_int x ) | ` Active -> TkToken " active " | ` End -> TkToken " end " | ` Last -> TkToken " last " | ` None -> TkToken " none " | ` Insert -> TkToken " insert " | ` Selfirst -> TkToken " sel . first " | ` Sellast -> TkToken " sel . last " | ` At n -> TkToken ... |
let cCAMLtoTKcanvas_index = ( cCAMLtoTKindex : canvas_index -> tkArgs ) ; ; |
let cCAMLtoTKentry_index = ( cCAMLtoTKindex : entry_index -> tkArgs ) ; ; |
let cCAMLtoTKlistbox_index = ( cCAMLtoTKindex : listbox_index -> tkArgs ) ; ; |
let cCAMLtoTKmenu_index = ( cCAMLtoTKindex : menu_index -> tkArgs ) ; ; |
let cCAMLtoTKtext_index = ( cCAMLtoTKindex : text_index -> tkArgs ) ; ; |
let cTKtoCAMLtext_index s = try let p = String . index s ' . ' in ` Linechar ( int_of_string ( String . sub s ~ pos : 0 ~ len : p ) , int_of_string ( String . sub s ~ pos ( : p + 1 ) ~ len ( : String . length s - p - 1 ) ) ) with Not_found -> raise ( Invalid_argument ( " TKtoCAMLtext_index : " ^ s ) ) ; ; |
let cTKtoCAMLlistbox_index s = try ` Num ( int_of_string s ) with _ -> raise ( Invalid_argument ( " TKtoCAMLlistbox_index : " ^ s ) ) ; ; ## endif |
let cCAMLtoTKtextMark x = TkToken x ; ; |
let cTKtoCAMLtextMark x = x ; ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.