text
stringlengths
12
786k
let flag_and_dep tags cmd_spec = flag tags cmd_spec ; let ps = Command . fold_pathnames ( fun p ps -> p :: ps ) ( Cmd cmd_spec ) [ ] in dep tags ps
let stdlib_dir = lazy begin let ocamlc_where = sprintf " % s / ocamlc . where " ( Pathname . pwd / ! Options . build_dir ) in let ( ) = Command . execute ~ quiet : true ( Cmd ( S [ ! Options . ocamlc ; A " - where " ; Sh " " ; > P ocamlc_where ] ) ) in String ...
let pflag_and_dep tags ptag cmd_spec = Param_tags . declare ptag ( fun param -> flag_and_dep ( Param_tags . make ptag param :: tags ) ( cmd_spec param ) )
let module_name_of_filename f = String . capitalize ( Pathname . remove_extensions f )
let module_name_of_pathname x = module_name_of_filename ( Pathname . to_string ( Pathname . basename x ) )
let ignore_stdlib x = if ! Options . nostdlib then false else let x ' = !* stdlib_dir ( ( / String . uncapitalize x ) . " -- cmi " ) in Pathname . exists x '
let non_dependencies = ref [ ]
let non_dependency m1 m2 = if String . length ( Pathname . get_extensions m1 ) = 0 then invalid_arg " non_dependency : no extension " ; non_dependencies := ( m1 , m2 ) :: ! non_dependencies
let path_importance path x = if List . mem ( path , x ) ! non_dependencies || ( List . mem x ! Options . ignore_list ) then begin let ( ) = dprintf 3 " This module ( % s ) is ignored by % s " x path in ` ignored end else if ignore_stdlib x then ` just_try else ` mandatory
let expand_module include_dirs module_name exts = let dirname = Pathname . dirname module_name in let basename = Pathname . basename module_name in let module_name_cap = dirname ( / String . capitalize basename ) in let module_name_uncap = dirname ( / String . uncapitalize basename ) in List . ...
let string_list_of_file file = with_input_file file begin fun ic -> Lexers . blank_sep_strings ( Lexing . from_channel ic ) end
let ocaml_ppflags tags = let flags = Flags . of_tags ( tags " ++ ocaml " " ++ pp " ) in let reduced = Command . reduce flags in if reduced = N then N else S [ A " - pp " ; Quote reduced ]
let ocaml_add_include_flag x acc = if x = Pathname . current_dir_name then acc else A " - I " :: A x :: acc
let ocaml_include_flags path = S ( List . fold_right ocaml_add_include_flag ( Pathname . include_dirs_of ( Pathname . dirname path ) ) [ ] )
let info_libraries = Hashtbl . create 103
let libraries = Hashtbl . create 103
let libraries_of m = try Hashtbl . find libraries m with Not_found -> [ ]
let use_lib m lib = Hashtbl . replace libraries m ( lib :: libraries_of m )
let ocaml_lib ( ? extern = false ) ( ? byte = true ) ( ? native = true ) ? dir ? tag_name libpath = let add_dir x = match dir with | Some dir -> S [ A " - I " ; P dir ; x ] | None -> x in let tag_name = match tag_name with | Some x -> x | None -> " use_ " ^ Pathname . ...
let cmi_of = Pathname . update_extensions " cmi "
let read_path_dependencies = let path_dependencies = Hashtbl . create 103 in let read path = let module_name = module_name_of_pathname path in let depends = path . " -- depends " in with_input_file depends begin fun ic -> let ocamldep_output = try Lexers . ocamldep_output ( Lexing . from_channel ...
let path_dependencies_of = memo read_path_dependencies
let all_modules = make ( " all_modules " , " All the modules to compile and link " )
let arch = make ( " arch " , " Host architecture " )
let binary_modules = make ( " binary_modules " , " Additional binary modules to link " )
let bytecc_libs = make ( " bytecc_libs " , " Libraries to link with for bytecode " )
let c_preprocessor = make ( " c_preprocessor " , " Command to use to invoke the C preprocessor " )
let cc = make ( " cc " , " Command to use to invoke the C compiler " )
let export_caml_ld_library_path value = let current_value = Sys . safe_getenv caml_ld_library_path_name in let local_value = ( String . concat Filename . path_sep ( String . words value ) ) in let new_value = if local_value " " = then current_value else if current_value " " = then local_va...
let caml_ld_library_path = make_with_exporter export_caml_ld_library_path ( " ld_library_path " , " List of paths to lookup for loading dynamic libraries " )
let codegen_exit_status = make ( " codegen_exit_status " , " Expected exit status of codegen " )
let compare_programs = make ( " compare_programs " , " Set to " \ false " \ to disable program comparison " )
let compiler_directory_suffix = make ( " compiler_directory_suffix " , " Suffix to add to the directory where the test will be compiled " )
let compiler_reference = make ( " compiler_reference " , " Reference file for compiler output for ocamlc . byte and ocamlopt . byte " )
let compiler_reference2 = make ( " compiler_reference2 " , " Reference file for compiler output for ocamlc . opt and ocamlopt . opt " )
let compiler_reference_suffix = make ( " compiler_reference_suffix " , " Suffix to add to the file name containing the reference for compiler output " )
let compiler_output = make ( " compiler_output " , " Where to log output of bytecode compilers " )
let compiler_output2 = make ( " compiler_output2 " , " Where to log output of native compilers " )
let compiler_stdin = make ( " compiler_stdin " , " standard input of compilers " )
let compile_only = make ( " compile_only " , " Compile only ( do not link ) " )
let csc = make ( " csc " , " Path to the CSharp compiler " )
let csc_flags = make ( " csc_flags " , " Flags for the CSharp compiler " )
let directories = make ( " directories " , " Directories to include by all the compilers " )
let flags = make ( " flags " , " Flags passed to all the compilers " )
let last_flags = make ( " last_flags " , " Flags passed to all the compilers at the end of the commandline " )
let libraries = make ( " libraries " , " Libraries the program should be linked with " )
let mkdll = make ( " mkdll " , " Command to use to build a DLL " )
let mkexe = make ( " mkexe " , " Command used to build an executable program DLL " )
let module_ = make ( " module " , " Compile one module at once " )
let modules = make ( " modules " , " Other modules of the test " )
let nativecc_libs = make ( " nativecc_libs " , " Libraries to link with for native code " )
let objext = make ( " objext " , " Extension of object files " )
let asmext = make ( " asmext " , " Extension of assembly files " )
let ocamlc_byte = make ( " ocamlc_byte " , " Path of the ocamlc . byte executable " )
let ocamlopt_byte = make ( " ocamlopt_byte " , " Path of the ocamlopt . byte executable " )
let ocamlrun = make ( " ocamlrun " , " Path of the ocamlrun executable " )
let ocamlc_flags = make ( " ocamlc_flags " , " Flags passed to ocamlc . byte and ocamlc . opt " )
let ocamlc_default_flags = make ( " ocamlc_default_flags " , " Flags passed by default to ocamlc . byte and ocamlc . opt " )
let ocamllex_flags = make ( " ocamllex_flags " , " Flags passed to ocamllex " )
let ocamlopt_flags = make ( " ocamlopt_flags " , " Flags passed to ocamlopt . byte and ocamlopt . opt " )
let ocamlopt_default_flags = make ( " ocamlopt_default_flags " , " Flags passed by default to ocamlopt . byte and ocamlopt . opt " )
let ocamlyacc_flags = make ( " ocamlyacc_flags " , " Flags passed to ocamlyacc " )
let ocaml_exit_status = make ( " ocaml_exit_status " , " Expected exit status of ocaml " )
let ocaml_filetype_flag = make ( " ocaml_filetype_flag " , " Filetype of the testfile ( - impl , - intf , etc . ) " )
let ocamlc_byte_exit_status = make ( " ocamlc_byte_exit_status " , " Expected exit status of ocac . byte " )
let ocamlopt_byte_exit_status = make ( " ocamlopt_byte_exit_status " , " Expected exit status of ocamlopt . byte " )
let ocamlnat_exit_status = make ( " ocamlnat_exit_status " , " Expected exit status of ocamlnat " )
let ocamlc_opt_exit_status = make ( " ocamlc_opt_exit_status " , " Expected exit status of ocac . opt " )
let ocamlopt_opt_exit_status = make ( " ocamlopt_opt_exit_status " , " Expected exit status of ocamlopt . opt " )
let export_ocamlrunparam value = Printf . sprintf " % s =% s " " OCAMLRUNPARAM " value
let ocamlrunparam = make_with_exporter export_ocamlrunparam ( " ocamlrunparam " , " Equivalent of OCAMLRUNPARAM " )
let ocamlsrcdir = make ( " ocamlsrcdir " , " Where OCaml sources are " )
let ocamldebug_flags = make ( " ocamldebug_flags " , " Flags for ocamldebug " )
let ocamldebug_script = make ( " ocamldebug_script " , " Where ocamldebug should read its commands " )
let os_type = make ( " os_type " , " The OS we are running on " )
let ocamldoc_flags = Variables . make ( " ocamldoc_flags " , " ocamldoc flags " )
let ocamldoc_backend = Variables . make ( " ocamldoc_backend " , " ocamldoc backend ( html , latex , man , . . . ) " )
let ocamldoc_exit_status = Variables . make ( " ocamldoc_exit_status " , " expected ocamldoc exit status " )
let ocamldoc_output = Variables . make ( " ocamldoc_output " , " Where to log ocamldoc output " )
let ocamldoc_reference = Variables . make ( " ocamldoc_reference " , " Where to find expected ocamldoc output " )
let ocaml_script_as_argument = Variables . make ( " ocaml_script_as_argument " , " Whether the ocaml script should be passed as argument or on stdin " )
let plugins = Variables . make ( " plugins " , " plugins for ocamldoc " )
let shared_library_cflags = Variables . make ( " shared_library_cflags " , " Flags used to compile C files for inclusion in shared libraries " )
let sharedobjext = Variables . make ( " sharedobjext " , " Extension of shared object files " )
let use_runtime = Variables . make ( " use_runtime " , " Whether the - use - runtime option should be used " )
let _ = List . iter register_variable [ all_modules ; arch ; binary_modules ; bytecc_libs ; c_preprocessor ; caml_ld_library_path ; codegen_exit_status ; compare_programs ; compiler_directory_suffix ; compiler_reference ; compiler_reference2 ; compiler_reference_suffix ; compiler_output ; ...
do { if len >= String . length buff . val then buff . val := buff . val ^ String . create ( String . length buff . val ) else ( ) ; buff . val . [ len ] := x ; succ len } ; match cs with parser [ [ : ` ' ' $ ] : -> maybe_locate cs | [ : ` c ] : -> do...
let arg_list = Array . to_list Sys . argv
let ( plugins , paths ) = let rec iter ( files , incs ) = function [ ] | _ :: [ ] -> ( List . rev files , List . rev incs ) | " - g " :: file :: q when ( ( Filename . check_suffix file " cmo " ) || ( Filename . check_suffix file " cma " ) || ( Filena...
let get_real_filename name = if Filename . basename name <> name then name else ( let paths = Filename . current_dir_name :: paths @ [ Odoc_config . custom_generators_path ] in try let d = List . find ( fun d -> Sys . file_exists ( Filename . concat d name ) ) paths in Filename . conc...
let load_plugin file = let file = Dynlink . adapt_filename file in Dynlink . allow_unsafe_modules true ; try let real_file = get_real_filename file in ignore ( Dynlink . loadfile real_file ) with Dynlink . Error e -> prerr_endline ( Odoc_messages . load_file_error file ( Dynlink . error_messag...
let ( ) = Odoc_args . parse ( )
let loaded_modules = List . flatten ( List . map ( fun f -> Odoc_info . verbose ( Odoc_messages . loading f ) ; try let l = Odoc_analyse . load_modules f in Odoc_info . verbose Odoc_messages . ok ; l with Failure s -> prerr_endline s ; incr Odoc_global . errors ; [ ] ) ! Odoc_...
let modules = Odoc_analyse . analyse_files ~ init : loaded_modules ! Odoc_global . files
let _ = match ! Odoc_global . dump with None -> ( ) | Some f -> try Odoc_analyse . dump_modules f modules with Failure s -> prerr_endline s ; incr Odoc_global . errors
let _ = match ! Odoc_args . current_generator with None -> ( ) | Some gen -> let generator = Odoc_gen . get_minimal_generator gen in Odoc_info . verbose Odoc_messages . generating_doc ; generator # generate modules ; Odoc_info . verbose Odoc_messages . ok
let _ = if ! Odoc_global . errors > 0 then ( prerr_endline ( Odoc_messages . errors_occured ! Odoc_global . errors ) ; exit 1 ) else exit 0
let init_path ( ) = Compmisc . init_path ( )
let initial_env ( ) = let current = Env . get_unit_name ( ) in let initial = ! Odoc_global . initially_opened_module in let initially_opened_module = if initial = current then None else Some initial in let open_implicit_modules = let ln = ! Odoc_global . library_namespace in let ln = if current ...
let preprocess sourcefile = try Pparse . preprocess sourcefile with Pparse . Error err -> Format . eprintf " Preprocessing error . @% a . " @ Pparse . report_error err ; exit 2