daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Feb 16th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/driver/compenv.ml b/driver/compenv.ml
  2. index 6279136..3261634 100644
  3. --- a/driver/compenv.ml
  4. +++ b/driver/compenv.ml
  5. @@ -190,6 +190,7 @@ let read_OCAMLPARAM ppf position =
  6.              (Warnings.Bad_env_variable ("OCAMLPARAM", "value for inline should be an interger"))
  7.          end
  8.  
  9. +      | "impl-suffix" -> Config.implementation_suffix := v
  10.        | "intf-suffix" -> Config.interface_suffix := v
  11.  
  12.        | "I" -> begin
  13. diff --git a/driver/main.ml b/driver/main.ml
  14. index 8deb883..1884bc7 100644
  15. --- a/driver/main.ml
  16. +++ b/driver/main.ml
  17. @@ -23,8 +23,7 @@ let process_implementation_file ppf name =
  18.    objfiles := (opref ^ ".cmo") :: !objfiles
  19.  
  20.  let process_file ppf name =
  21. -  if Filename.check_suffix name ".ml"
  22. -  || Filename.check_suffix name ".mlt" then begin
  23. +  if Filename.check_suffix name !Config.implementation_suffix then begin
  24.      let opref = output_prefix name in
  25.      Compile.implementation ppf name opref;
  26.      objfiles := (opref ^ ".cmo") :: !objfiles
  27. @@ -89,6 +88,7 @@ module Options = Main_args.Make_bytecomp_options (struct
  28.    let _i () = print_types := true; compile_only := true
  29.    let _I s = include_dirs := s :: !include_dirs
  30.    let _impl = impl
  31. +  let _impl_suffix s = Config.implementation_suffix := s
  32.    let _intf = intf
  33.    let _intf_suffix s = Config.interface_suffix := s
  34.    let _labels = unset classic
  35. diff --git a/driver/main_args.ml b/driver/main_args.ml
  36. index 487a929..181a9c4 100644
  37. --- a/driver/main_args.ml
  38. +++ b/driver/main_args.ml
  39. @@ -103,6 +103,11 @@ let mk_impl f =
  40.    "-impl", Arg.String f, "<file>  Compile <file> as a .ml file"
  41.  ;;
  42.  
  43. +let mk_impl_suffix f =
  44. +  "-impl-suffix", Arg.String f,
  45. +  "<string>  Suffix for implementation files (default: .ml)"
  46. +;;
  47. +
  48.  let mk_init f =
  49.    "-init", Arg.String f, "<file>  Load <file> instead of default init file"
  50.  ;;
  51. @@ -435,6 +440,7 @@ module type Bytecomp_options = sig
  52.    val _i : unit -> unit
  53.    val _I : string -> unit
  54.    val _impl : string -> unit
  55. +  val _impl_suffix : string -> unit
  56.    val _intf : string -> unit
  57.    val _intf_suffix : string -> unit
  58.    val _labels : unit -> unit
  59. @@ -530,6 +536,7 @@ module type Optcomp_options = sig
  60.    val _i : unit -> unit
  61.    val _I : string -> unit
  62.    val _impl : string -> unit
  63. +  val _impl_suffix : string -> unit
  64.    val _inline : int -> unit
  65.    val _intf : string -> unit
  66.    val _intf_suffix : string -> unit
  67. @@ -665,6 +672,7 @@ struct
  68.      mk_i F._i;
  69.      mk_I F._I;
  70.      mk_impl F._impl;
  71. +    mk_impl_suffix F._impl_suffix;
  72.      mk_intf F._intf;
  73.      mk_intf_suffix F._intf_suffix;
  74.      mk_intf_suffix_2 F._intf_suffix;
  75. @@ -771,6 +779,7 @@ struct
  76.      mk_i F._i;
  77.      mk_I F._I;
  78.      mk_impl F._impl;
  79. +    mk_impl_suffix F._impl_suffix;
  80.      mk_inline F._inline;
  81.      mk_intf F._intf;
  82.      mk_intf_suffix F._intf_suffix;
  83. diff --git a/driver/main_args.mli b/driver/main_args.mli
  84. index 6d431e7..fad8606 100644
  85. --- a/driver/main_args.mli
  86. +++ b/driver/main_args.mli
  87. @@ -29,6 +29,7 @@ module type Bytecomp_options =
  88.      val _i : unit -> unit
  89.      val _I : string -> unit
  90.      val _impl : string -> unit
  91. +    val _impl_suffix : string -> unit
  92.      val _intf : string -> unit
  93.      val _intf_suffix : string -> unit
  94.      val _labels : unit -> unit
  95. @@ -125,6 +126,7 @@ module type Optcomp_options = sig
  96.    val _i : unit -> unit
  97.    val _I : string -> unit
  98.    val _impl : string -> unit
  99. +  val _impl_suffix : string -> unit
  100.    val _inline : int -> unit
  101.    val _intf : string -> unit
  102.    val _intf_suffix : string -> unit
  103. diff --git a/driver/optmain.ml b/driver/optmain.ml
  104. index 7571fca..47679f6 100644
  105. --- a/driver/optmain.ml
  106. +++ b/driver/optmain.ml
  107. @@ -25,8 +25,7 @@ let process_implementation_file ppf name =
  108.  let cmxa_present = ref false;;
  109.  
  110.  let process_file ppf name =
  111. -  if Filename.check_suffix name ".ml"
  112. -  || Filename.check_suffix name ".mlt" then
  113. +  if Filename.check_suffix name !Config.implementation_suffix then
  114.      process_implementation_file ppf name
  115.    else if Filename.check_suffix name !Config.interface_suffix then begin
  116.      let opref = output_prefix name in
  117. @@ -87,6 +86,7 @@ module Options = Main_args.Make_optcomp_options (struct
  118.    let _i () = print_types := true; compile_only := true
  119.    let _I dir = include_dirs := dir :: !include_dirs
  120.    let _impl = impl
  121. +  let _impl_suffix s = Config.implementation_suffix := s
  122.    let _inline n = inline_threshold := n * 8
  123.    let _intf = intf
  124.    let _intf_suffix s = Config.interface_suffix := s
  125. diff --git a/tools/ocamlcp.ml b/tools/ocamlcp.ml
  126. index 67a2bae..eff48ee 100644
  127. --- a/tools/ocamlcp.ml
  128. +++ b/tools/ocamlcp.ml
  129. @@ -58,6 +58,7 @@ module Options = Main_args.Make_bytecomp_options (struct
  130.    let _i = option "-i"
  131.    let _I s = option_with_arg "-I" s
  132.    let _impl s = with_impl := true; option_with_arg "-impl" s
  133. +  let _impl_suffix s = option_with_arg "-impl-suffix" s
  134.    let _intf s = with_intf := true; option_with_arg "-intf" s
  135.    let _intf_suffix s = option_with_arg "-intf-suffix" s
  136.    let _labels = option "-labels"
  137. diff --git a/tools/ocamloptp.ml b/tools/ocamloptp.ml
  138. index 74d1314..d082118 100644
  139. --- a/tools/ocamloptp.ml
  140. +++ b/tools/ocamloptp.ml
  141. @@ -58,6 +58,7 @@ module Options = Main_args.Make_optcomp_options (struct
  142.    let _i = option "-i"
  143.    let _I s = option_with_arg "-I" s
  144.    let _impl s = with_impl := true; option_with_arg "-impl" s
  145. +  let _impl_suffix s = option_with_arg "-impl-suffix" s
  146.    let _inline n = option_with_int "-inline" n
  147.    let _intf s = with_intf := true; option_with_arg "-intf" s
  148.    let _intf_suffix s = option_with_arg "-intf-suffix" s
  149. diff --git a/utils/config.mlbuild b/utils/config.mlbuild
  150. index 264ed6d..870d2f8 100644
  151. --- a/utils/config.mlbuild
  152. +++ b/utils/config.mlbuild
  153. @@ -72,6 +72,7 @@ and cmt_magic_number = "Caml2012T002"
  154.  
  155.  let load_path = ref ([] : string list)
  156.  
  157. +let implementation_suffix = ref ".ml"
  158.  let interface_suffix = ref ".mli"
  159.  
  160.  let max_tag = 245
  161. diff --git a/utils/config.mli b/utils/config.mli
  162. index 7b178e5..8ead446 100644
  163. --- a/utils/config.mli
  164. +++ b/utils/config.mli
  165. @@ -52,6 +52,9 @@ val cc_profile : string
  166.  val load_path: string list ref
  167.          (* Directories in the search path for .cmi and .cmo files *)
  168.  
  169. +val implementation_suffix: string ref
  170. +        (* Suffix for implementation file names *)
  171. +
  172.  val interface_suffix: string ref
  173.          (* Suffix for interface file names *)
  174.  
  175. diff --git a/utils/config.mlp b/utils/config.mlp
  176. index f77bc54..fc115aa 100644
  177. --- a/utils/config.mlp
  178. +++ b/utils/config.mlp
  179. @@ -61,6 +61,7 @@ and cmt_magic_number = "Caml2012T002"
  180.  
  181.  let load_path = ref ([] : string list)
  182.  
  183. +let implementation_suffix = ref ".ml"
  184.  let interface_suffix = ref ".mli"
  185.  
  186.  let max_tag = 245
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top