text stringlengths 12 786k |
|---|
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 ... |
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 ( ... |
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 = Interfac... |
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 ->... |
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 ) ] i... |
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 =... |
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 e... |
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 -> ( ) | L... |
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 ... |
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_... |
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... |
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_cons... |
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 . ... |
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 des... |
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 . o... |
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... |
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... |
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 ) ... |
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 ... |
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 ; b... |
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 " ... |
let cCAMLtoTKmodifier = function | Control -> " Control " - | Shift -> " Shift " - | Lock -> " Lock " - | Button1 -> " Button1 " - | Button2 -> " Button2 " - | Button3 -> " Button3 " - | Button4 -> " Button4 " - | Button5 -> " Button5 " - | Double -> " Double... |
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 " - | ` ... |
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 " | ` ButtonReleaseDet... |
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... |
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 ]... |
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 " ... |
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 ( ... |
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 " ... |
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_argu... |
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 ; ; |
let cCAMLtoTKtextTag x = TkToken x ; ; |
let cTKtoCAMLtextTag x = x ; ; |
let ppTextModifier = function CharOffset n -> if n > 0 then " " + ^ ( string_of_int n ) ^ " chars " else if n = 0 then " " else ( string_of_int n ) ^ " chars " | LineOffset n -> if n > 0 then " " + ^ ( string_of_int n ) ^ " lines " else if n = 0 then " " else (... |
let ppTextIndex = function | TextIndexNone -> " " | TextIndex ( base , ml ) -> match cCAMLtoTKindex index_text_table base with | TkToken ppbase -> List . fold_left ( ) ^ ppbase ( List . map ppTextModifier ml ) | _ -> assert false ; ; |
let cCAMLtoTKtextIndex i = TkToken ( ppTextIndex i ) ; ; ## else |
let cCAMLtoTKtextIndex ( i : textIndex ) = let ppTextModifier = function | ` Char n -> if n > 0 then " " + ^ ( string_of_int n ) ^ " chars " else if n = 0 then " " else ( string_of_int n ) ^ " chars " | ` Line n -> if n > 0 then " " + ^ ( string_of_int n ) ^ "... |
let reason_with_fallback env fallback = match Environments . lookup Builtin_variables . reason env with | None -> fallback | Some reason -> reason |
let pass = make " pass " ( fun _log env -> let reason = reason_with_fallback env " the pass action always succeeds " in let result = Result . pass_with_reason reason in ( result , env ) ) |
let skip = make " skip " ( fun _log env -> let reason = reason_with_fallback env " the skip action always skips " in let result = Result . skip_with_reason reason in ( result , env ) ) |
let fail = make " fail " ( fun _log env -> let reason = reason_with_fallback env " the fail action always fails " in let result = Result . fail_with_reason reason in ( result , env ) ) |
let cd = make " cd " ( fun _log env -> let cwd = Environments . safe_lookup Builtin_variables . cwd env in begin try Sys . chdir cwd ; ( Result . pass , env ) with _ -> let reason = " Could not chidir to " " \ ^ cwd ^ " " " \ in let result = Result . fail_with_reason reas... |
let dumpenv = make " dumpenv " ( fun log env -> Environments . dump log env ; ( Result . pass , env ) ) |
let hasinstrumentedruntime = make " hasinstrumentedruntime " ( Actions_helpers . pass_or_skip ( Ocamltest_config . has_instrumented_runtime ) " instrumented runtime available " " instrumented runtime not available " ) |
let hasunix = make " hasunix " ( Actions_helpers . pass_or_skip ( Ocamltest_config . libunix <> None ) " unix library available " " unix library not available " ) |
let libunix = make " libunix " ( Actions_helpers . pass_or_skip ( Ocamltest_config . libunix = Some true ) " libunix available " " libunix not available " ) |
let libwin32unix = make " libwin32unix " ( Actions_helpers . pass_or_skip ( Ocamltest_config . libunix = Some false ) " libwin32unix available " " libwin32unix not available " ) |
let hassysthreads = make " hassysthreads " ( Actions_helpers . pass_or_skip Ocamltest_config . systhreads " systhreads library available " " systhreads library not available " ) |
let hasstr = make " hasstr " ( Actions_helpers . pass_or_skip Ocamltest_config . str " str library available " " str library not available " ) |
let get_OS ( ) = Sys . safe_getenv " OS " |
let windows = make " windows " ( Actions_helpers . pass_or_skip ( get_OS ( ) = windows_OS ) " running on Windows " " not running on Windows " ) |
let not_windows = make " not - windows " ( Actions_helpers . pass_or_skip ( get_OS ( ) <> windows_OS ) " not running on Windows " " running on Windows " ) |
let is_bsd_system s = match s with | " bsd_elf " | " netbsd " | " freebsd " | " openbsd " -> true | _ -> false |
let bsd = make " bsd " ( Actions_helpers . pass_or_skip ( is_bsd_system Ocamltest_config . system ) " on a BSD system " " not on a BSD system " ) |
let not_bsd = make " not - bsd " ( Actions_helpers . pass_or_skip ( not ( is_bsd_system Ocamltest_config . system ) ) " not on a BSD system " " on a BSD system " ) |
let macos = make " macos " ( Actions_helpers . pass_or_skip ( Ocamltest_config . system = macos_system ) " on a MacOS system " " not on a MacOS system " ) |
let arch32 = make " arch32 " ( Actions_helpers . pass_or_skip ( Sys . word_size = 32 ) " 32 - bit architecture " " non - 32 - bit architecture " ) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.