pax_global_header00006660000000000000000000000064145455700230014517gustar00rootroot0000000000000052 comment=6df244cbefc636856efc116fee8a345013b49afa ocaml-compiler-libs-0.17.0/000077500000000000000000000000001454557002300154365ustar00rootroot00000000000000ocaml-compiler-libs-0.17.0/.gitignore000066400000000000000000000000331454557002300174220ustar00rootroot00000000000000_build *.install *.merlin ocaml-compiler-libs-0.17.0/CHANGES.md000066400000000000000000000002001454557002300170200ustar00rootroot00000000000000v0.12.3 ------- - Update opam file v0.12.2 ------- - Fix deprecation messages in `Ocaml_shadow` (fixes #7, @jeremiedimino) ocaml-compiler-libs-0.17.0/CONTRIBUTING.md000066400000000000000000000043371454557002300176760ustar00rootroot00000000000000This repository contains open source software that is developed and maintained by [Jane Street][js]. Contributions to this project are welcome and should be submitted via GitHub pull requests. Signing contributions --------------------- We require that you sign your contributions. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify the below (from [developercertificate.org][dco]): ``` Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 1 Letterman Drive Suite D4700 San Francisco, CA, 94129 Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ``` Then you just add a line to every git commit message: ``` Signed-off-by: Joe Smith ``` Use your real name (sorry, no pseudonyms or anonymous contributions.) If you set your `user.name` and `user.email` git configs, you can sign your commit automatically with git commit -s. [dco]: http://developercertificate.org/ ocaml-compiler-libs-0.17.0/LICENSE.md000066400000000000000000000021351454557002300170430ustar00rootroot00000000000000The MIT License Copyright (c) 2017--2018 Jane Street Group, LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ocaml-compiler-libs-0.17.0/Makefile000066400000000000000000000004031454557002300170730ustar00rootroot00000000000000INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),) default: dune build install: dune install $(INSTALL_ARGS) uninstall: dune uninstall $(INSTALL_ARGS) reinstall: uninstall install clean: dune clean .PHONY: default install uninstall reinstall clean ocaml-compiler-libs-0.17.0/README.org000066400000000000000000000005221454557002300171030ustar00rootroot00000000000000* OCAML-COMPILER-LIBS This package simply repackage the OCaml compiler libraries so they don't expose everything at toplevel. For instance =Ast_helper= is now =Ocaml_common.Ast_helper=. The special library =ocaml_shadow= add a deprecation warning on all modules from the compiler libraries, to force the user to use the prefixed names. ocaml-compiler-libs-0.17.0/dune-project000066400000000000000000000000531454557002300177560ustar00rootroot00000000000000(lang dune 1.0) (name ocaml-compiler-libs) ocaml-compiler-libs-0.17.0/ocaml-compiler-libs.opam000066400000000000000000000012501454557002300221440ustar00rootroot00000000000000opam-version: "2.0" version: "v0.17.0" maintainer: "opensource@janestreet.com" authors: ["Jane Street Group, LLC "] homepage: "https://github.com/janestreet/ocaml-compiler-libs" bug-reports: "https://github.com/janestreet/ocaml-compiler-libs/issues" dev-repo: "git+https://github.com/janestreet/ocaml-compiler-libs.git" license: "MIT" build: [ ["dune" "build" "-p" name "-j" jobs] ] depends: [ "ocaml" {>= "5.2.0"} "dune" {>= "1.5.1"} ] synopsis: """OCaml compiler libraries repackaged""" description: """ This packages exposes the OCaml compiler libraries repackages under the toplevel names Ocaml_common, Ocaml_bytecomp, Ocaml_optcomp, ... """ ocaml-compiler-libs-0.17.0/src/000077500000000000000000000000001454557002300162255ustar00rootroot00000000000000ocaml-compiler-libs-0.17.0/src/gen/000077500000000000000000000000001454557002300167765ustar00rootroot00000000000000ocaml-compiler-libs-0.17.0/src/gen/dune000066400000000000000000000001601454557002300176510ustar00rootroot00000000000000(executables (names gen) (flags :standard -safe-string) (libraries read_cma) (preprocess no_preprocessing)) ocaml-compiler-libs-0.17.0/src/gen/gen.ml000066400000000000000000000016131454557002300201020ustar00rootroot00000000000000(* Note: this file is very similar to the one in Base for building the Caml library. However the Caml library should once this is merged: https://github.com/ocaml/ocaml/pull/1010 It's going to be hard to do this for compiler-libs as it is a big breaking change. So we expect the gen.ml file in Base to go soon and this file to stay for longer. *) open StdLabels let () = let archive_fn, oc = match Sys.argv with | [|_; "-archive"; archive_fn; "-o"; fn|] -> (archive_fn, open_out fn) | _ -> failwith "bad command line arguments" in let units = Read_cma.units archive_fn in let pr fmt = Printf.fprintf oc (fmt ^^ "\n") in pr "(* This file is automatically generated *)"; pr ""; let max_len = List.fold_left units ~init:0 ~f:(fun acc unit -> max acc (String.length unit)) in List.iter units ~f:(fun u -> pr "module %-*s = %s" max_len u u); ocaml-compiler-libs-0.17.0/src/ocaml_bytecomp/000077500000000000000000000000001454557002300212225ustar00rootroot00000000000000ocaml-compiler-libs-0.17.0/src/ocaml_bytecomp/dune000066400000000000000000000005441454557002300221030ustar00rootroot00000000000000(library (name ocaml_bytecomp) (public_name ocaml-compiler-libs.bytecomp) (flags :standard -safe-string) (libraries compiler-libs.bytecomp) (preprocess no_preprocessing)) (rule (targets ocaml_bytecomp.ml) (deps (:first_dep ../gen/gen.exe)) (action (run %{first_dep} -archive %{ocaml_where}/compiler-libs/ocamlbytecomp.cma -o %{targets}))) ocaml-compiler-libs-0.17.0/src/ocaml_common/000077500000000000000000000000001454557002300206705ustar00rootroot00000000000000ocaml-compiler-libs-0.17.0/src/ocaml_common/dune000066400000000000000000000005321454557002300215460ustar00rootroot00000000000000(library (name ocaml_common) (public_name ocaml-compiler-libs.common) (flags :standard -safe-string) (libraries compiler-libs.common) (preprocess no_preprocessing)) (rule (targets ocaml_common.ml) (deps (:first_dep ../gen/gen.exe)) (action (run %{first_dep} -archive %{ocaml_where}/compiler-libs/ocamlcommon.cma -o %{targets}))) ocaml-compiler-libs-0.17.0/src/ocaml_optcomp/000077500000000000000000000000001454557002300210615ustar00rootroot00000000000000ocaml-compiler-libs-0.17.0/src/ocaml_optcomp/dune000066400000000000000000000005531454557002300217420ustar00rootroot00000000000000(library (name ocaml_optcomp) (public_name ocaml-compiler-libs.optcomp) (flags :standard -safe-string) (optional) (libraries compiler-libs.optcomp) (preprocess no_preprocessing)) (rule (targets ocaml_optcomp.ml) (deps (:first_dep ../gen/gen.exe)) (action (run %{first_dep} -archive %{ocaml_where}/compiler-libs/ocamloptcomp.cma -o %{targets}))) ocaml-compiler-libs-0.17.0/src/ocaml_toplevel/000077500000000000000000000000001454557002300212325ustar00rootroot00000000000000ocaml-compiler-libs-0.17.0/src/ocaml_toplevel/dune000066400000000000000000000005441454557002300221130ustar00rootroot00000000000000(library (name ocaml_toplevel) (public_name ocaml-compiler-libs.toplevel) (flags :standard -safe-string) (libraries compiler-libs.toplevel) (preprocess no_preprocessing)) (rule (targets ocaml_toplevel.ml) (deps (:first_dep ../gen/gen.exe)) (action (run %{first_dep} -archive %{ocaml_where}/compiler-libs/ocamltoplevel.cma -o %{targets}))) ocaml-compiler-libs-0.17.0/src/read_cma/000077500000000000000000000000001454557002300177605ustar00rootroot00000000000000ocaml-compiler-libs-0.17.0/src/read_cma/dune000066400000000000000000000002231454557002300206330ustar00rootroot00000000000000(library (name read_cma) (flags :standard -safe-string) (libraries compiler-libs.common compiler-libs.bytecomp) (preprocess no_preprocessing)) ocaml-compiler-libs-0.17.0/src/read_cma/read_cma.ml000066400000000000000000000011331454557002300220430ustar00rootroot00000000000000open StdLabels let compunit_name Cmo_format.{ cu_name = Compunit name ; _ } = name let units fn = (* The cma format is documented in typing/cmo_format.mli in the compiler sources *) let ic = open_in_bin fn in let len_magic_number = String.length Config.cma_magic_number in let magic_number = really_input_string ic len_magic_number in assert (magic_number = Config.cma_magic_number); let toc_pos = input_binary_int ic in seek_in ic toc_pos; let toc = (input_value ic : Cmo_format.library) in close_in ic; List.map toc.lib_units ~f:compunit_name |> List.sort ~cmp:String.compare ocaml-compiler-libs-0.17.0/src/read_cma/read_cma.mli000066400000000000000000000000421454557002300222120ustar00rootroot00000000000000val units : string -> string list ocaml-compiler-libs-0.17.0/src/shadow/000077500000000000000000000000001454557002300175125ustar00rootroot00000000000000ocaml-compiler-libs-0.17.0/src/shadow/dune000066400000000000000000000004541454557002300203730ustar00rootroot00000000000000(library (name ocaml_shadow) (public_name ocaml-compiler-libs.shadow) (flags (:standard -safe-string) -w -49) (preprocess no_preprocessing)) (rule (targets ocaml_shadow.ml) (deps (:first_dep gen/gen.exe)) (action (run %{first_dep} -dir %{ocaml_where}/compiler-libs -o %{targets}))) ocaml-compiler-libs-0.17.0/src/shadow/gen/000077500000000000000000000000001454557002300202635ustar00rootroot00000000000000ocaml-compiler-libs-0.17.0/src/shadow/gen/dune000066400000000000000000000001601454557002300211360ustar00rootroot00000000000000(executables (names gen) (flags :standard -safe-string) (libraries read_cma) (preprocess no_preprocessing)) ocaml-compiler-libs-0.17.0/src/shadow/gen/gen.ml000066400000000000000000000035441454557002300213740ustar00rootroot00000000000000module List = ListLabels open MoreLabels module Smap = Map.Make(String) let () = let dir, oc = match Sys.argv with | [|_; "-dir"; dir; "-o"; fn|] -> (dir, open_out fn) | _ -> failwith "bad command line arguments" in let files = Sys.readdir dir |> Array.to_list |> List.sort ~cmp:String.compare in let all_exposed_modules = List.filter files ~f:(fun fn -> Filename.check_suffix fn ".cmi") |> List.map ~f:(fun fn -> String.capitalize_ascii (Filename.chop_extension fn)) in let module_to_lib = List.filter files ~f:(fun fn -> Filename.check_suffix fn ".cma") |> List.fold_left ~init:Smap.empty ~f:(fun acc fn -> let lib_mod = try Scanf.sscanf fn "ocaml%s.cma" (fun s -> "Ocaml_" ^ s) with _ -> String.capitalize_ascii (Filename.chop_extension fn) in let units = Read_cma.units (Filename.concat dir fn) in List.fold_left units ~init:acc ~f:(fun acc unit -> Smap.add acc ~key:unit ~data:lib_mod)) in (* If we keep the alias, we can't use -linkall... *) Printf.fprintf oc "module Do_not_use_directly = struct end\n"; List.sort all_exposed_modules ~cmp:String.compare |> List.iter ~f:(fun m -> let repl = match Smap.find m module_to_lib with | lib -> let lib = let prefix = "Ocaml" in let prefix_len = String.length prefix in let lib_len = String.length lib in if lib_len >= prefix_len && String.sub lib 0 prefix_len = prefix then prefix ^ "_" ^ String.sub lib prefix_len (lib_len - prefix_len) else lib in Printf.sprintf ", use %s.%s instead" lib m | exception Not_found -> "" in Printf.fprintf oc "module %s = Do_not_use_directly [@@deprecated \"Accessing this module directly is deprecated%s\"]\n" m repl)