Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/driver/compenv.ml b/driver/compenv.ml
- index 6279136..3261634 100644
- --- a/driver/compenv.ml
- +++ b/driver/compenv.ml
- @@ -190,6 +190,7 @@ let read_OCAMLPARAM ppf position =
- (Warnings.Bad_env_variable ("OCAMLPARAM", "value for inline should be an interger"))
- end
- + | "impl-suffix" -> Config.implementation_suffix := v
- | "intf-suffix" -> Config.interface_suffix := v
- | "I" -> begin
- diff --git a/driver/main.ml b/driver/main.ml
- index 8deb883..1884bc7 100644
- --- a/driver/main.ml
- +++ b/driver/main.ml
- @@ -23,8 +23,7 @@ let process_implementation_file ppf name =
- objfiles := (opref ^ ".cmo") :: !objfiles
- let process_file ppf name =
- - if Filename.check_suffix name ".ml"
- - || Filename.check_suffix name ".mlt" then begin
- + if Filename.check_suffix name !Config.implementation_suffix then begin
- let opref = output_prefix name in
- Compile.implementation ppf name opref;
- objfiles := (opref ^ ".cmo") :: !objfiles
- @@ -89,6 +88,7 @@ module Options = Main_args.Make_bytecomp_options (struct
- let _i () = print_types := true; compile_only := true
- let _I s = include_dirs := s :: !include_dirs
- let _impl = impl
- + let _impl_suffix s = Config.implementation_suffix := s
- let _intf = intf
- let _intf_suffix s = Config.interface_suffix := s
- let _labels = unset classic
- diff --git a/driver/main_args.ml b/driver/main_args.ml
- index 487a929..181a9c4 100644
- --- a/driver/main_args.ml
- +++ b/driver/main_args.ml
- @@ -103,6 +103,11 @@ let mk_impl f =
- "-impl", Arg.String f, "<file> Compile <file> as a .ml file"
- ;;
- +let mk_impl_suffix f =
- + "-impl-suffix", Arg.String f,
- + "<string> Suffix for implementation files (default: .ml)"
- +;;
- +
- let mk_init f =
- "-init", Arg.String f, "<file> Load <file> instead of default init file"
- ;;
- @@ -435,6 +440,7 @@ module type Bytecomp_options = sig
- val _i : unit -> unit
- val _I : string -> unit
- val _impl : string -> unit
- + val _impl_suffix : string -> unit
- val _intf : string -> unit
- val _intf_suffix : string -> unit
- val _labels : unit -> unit
- @@ -530,6 +536,7 @@ module type Optcomp_options = sig
- val _i : unit -> unit
- val _I : string -> unit
- val _impl : string -> unit
- + val _impl_suffix : string -> unit
- val _inline : int -> unit
- val _intf : string -> unit
- val _intf_suffix : string -> unit
- @@ -665,6 +672,7 @@ struct
- mk_i F._i;
- mk_I F._I;
- mk_impl F._impl;
- + mk_impl_suffix F._impl_suffix;
- mk_intf F._intf;
- mk_intf_suffix F._intf_suffix;
- mk_intf_suffix_2 F._intf_suffix;
- @@ -771,6 +779,7 @@ struct
- mk_i F._i;
- mk_I F._I;
- mk_impl F._impl;
- + mk_impl_suffix F._impl_suffix;
- mk_inline F._inline;
- mk_intf F._intf;
- mk_intf_suffix F._intf_suffix;
- diff --git a/driver/main_args.mli b/driver/main_args.mli
- index 6d431e7..fad8606 100644
- --- a/driver/main_args.mli
- +++ b/driver/main_args.mli
- @@ -29,6 +29,7 @@ module type Bytecomp_options =
- val _i : unit -> unit
- val _I : string -> unit
- val _impl : string -> unit
- + val _impl_suffix : string -> unit
- val _intf : string -> unit
- val _intf_suffix : string -> unit
- val _labels : unit -> unit
- @@ -125,6 +126,7 @@ module type Optcomp_options = sig
- val _i : unit -> unit
- val _I : string -> unit
- val _impl : string -> unit
- + val _impl_suffix : string -> unit
- val _inline : int -> unit
- val _intf : string -> unit
- val _intf_suffix : string -> unit
- diff --git a/driver/optmain.ml b/driver/optmain.ml
- index 7571fca..47679f6 100644
- --- a/driver/optmain.ml
- +++ b/driver/optmain.ml
- @@ -25,8 +25,7 @@ let process_implementation_file ppf name =
- let cmxa_present = ref false;;
- let process_file ppf name =
- - if Filename.check_suffix name ".ml"
- - || Filename.check_suffix name ".mlt" then
- + if Filename.check_suffix name !Config.implementation_suffix then
- process_implementation_file ppf name
- else if Filename.check_suffix name !Config.interface_suffix then begin
- let opref = output_prefix name in
- @@ -87,6 +86,7 @@ module Options = Main_args.Make_optcomp_options (struct
- let _i () = print_types := true; compile_only := true
- let _I dir = include_dirs := dir :: !include_dirs
- let _impl = impl
- + let _impl_suffix s = Config.implementation_suffix := s
- let _inline n = inline_threshold := n * 8
- let _intf = intf
- let _intf_suffix s = Config.interface_suffix := s
- diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml
- index 67a2bae..eff48ee 100644
- --- a/tools/ocamlcp.ml
- +++ b/tools/ocamlcp.ml
- @@ -58,6 +58,7 @@ module Options = Main_args.Make_bytecomp_options (struct
- let _i = option "-i"
- let _I s = option_with_arg "-I" s
- let _impl s = with_impl := true; option_with_arg "-impl" s
- + let _impl_suffix s = option_with_arg "-impl-suffix" s
- let _intf s = with_intf := true; option_with_arg "-intf" s
- let _intf_suffix s = option_with_arg "-intf-suffix" s
- let _labels = option "-labels"
- diff --git a/tools/ocamloptp.ml b/tools/ocamloptp.ml
- index 74d1314..d082118 100644
- --- a/tools/ocamloptp.ml
- +++ b/tools/ocamloptp.ml
- @@ -58,6 +58,7 @@ module Options = Main_args.Make_optcomp_options (struct
- let _i = option "-i"
- let _I s = option_with_arg "-I" s
- let _impl s = with_impl := true; option_with_arg "-impl" s
- + let _impl_suffix s = option_with_arg "-impl-suffix" s
- let _inline n = option_with_int "-inline" n
- let _intf s = with_intf := true; option_with_arg "-intf" s
- let _intf_suffix s = option_with_arg "-intf-suffix" s
- diff --git a/utils/config.mlbuild b/utils/config.mlbuild
- index 264ed6d..870d2f8 100644
- --- a/utils/config.mlbuild
- +++ b/utils/config.mlbuild
- @@ -72,6 +72,7 @@ and cmt_magic_number = "Caml2012T002"
- let load_path = ref ([] : string list)
- +let implementation_suffix = ref ".ml"
- let interface_suffix = ref ".mli"
- let max_tag = 245
- diff --git a/utils/config.mli b/utils/config.mli
- index 7b178e5..8ead446 100644
- --- a/utils/config.mli
- +++ b/utils/config.mli
- @@ -52,6 +52,9 @@ val cc_profile : string
- val load_path: string list ref
- (* Directories in the search path for .cmi and .cmo files *)
- +val implementation_suffix: string ref
- + (* Suffix for implementation file names *)
- +
- val interface_suffix: string ref
- (* Suffix for interface file names *)
- diff --git a/utils/config.mlp b/utils/config.mlp
- index f77bc54..fc115aa 100644
- --- a/utils/config.mlp
- +++ b/utils/config.mlp
- @@ -61,6 +61,7 @@ and cmt_magic_number = "Caml2012T002"
- let load_path = ref ([] : string list)
- +let implementation_suffix = ref ".ml"
- let interface_suffix = ref ".mli"
- let max_tag = 245
Add Comment
Please, Sign In to add comment