File tree Expand file tree Collapse file tree 6 files changed +32
-19
lines changed
Expand file tree Collapse file tree 6 files changed +32
-19
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ let f
104104 Filename. concat (Findlib. find_pkg_dir pkg) d'
105105 | None -> d)
106106 in
107- let expunge =
107+ let exported_unit =
108108 match export_file with
109109 | None -> None
110110 | Some file ->
@@ -119,12 +119,7 @@ let f
119119 assert false
120120 with End_of_file -> () );
121121 close_in ic;
122- Some
123- (fun s ->
124- try
125- Hashtbl. find t s;
126- `Keep
127- with Not_found -> `Skip )
122+ Some (Hashtbl. fold (fun cmi () acc -> cmi :: acc) t [] )
128123 in
129124 Linker. load_files runtime_files;
130125 let paths =
@@ -247,7 +242,7 @@ let f
247242 Parse_bytecode. from_exe
248243 ~includes: paths
249244 ~toplevel
250- ?expunge
245+ ?exported_unit
251246 ~dynlink
252247 ~debug: need_debug
253248 ic
Original file line number Diff line number Diff line change @@ -2039,7 +2039,7 @@ let read_toc ic =
20392039let from_exe
20402040 ?(includes = [] )
20412041 ?(toplevel = false )
2042- ?( expunge = fun _ -> `Keep )
2042+ ?exported_unit
20432043 ?(dynlink = false )
20442044 ?(debug = `No )
20452045 ic =
@@ -2068,9 +2068,9 @@ let from_exe
20682068 Hashtbl. find keeps s;
20692069 true
20702070 with Not_found -> (
2071- match expunge s with
2072- | `Keep -> true
2073- | `Skip -> false )
2071+ match exported_unit with
2072+ | Some l -> List. mem s ~set: l
2073+ | None -> false )
20742074 in
20752075 let crcs = List. filter ~f: (fun (unit , _crc ) -> keep unit ) orig_crcs in
20762076 let symbols =
@@ -2193,6 +2193,14 @@ let from_exe
21932193 StringSet. empty
21942194 else StringSet. empty
21952195 in
2196+ let cmis =
2197+ match exported_unit with
2198+ | None -> cmis
2199+ | Some l ->
2200+ if toplevel && Config.Flag. include_cmis ()
2201+ then List. fold_left l ~init: cmis ~f: (fun acc s -> StringSet. add s acc)
2202+ else cmis
2203+ in
21962204 let code = prepend p body in
21972205 Code. invariant code;
21982206 {code; cmis; debug = debug_data}
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ type one =
4040val from_exe :
4141 ?includes : string list
4242 -> ?toplevel : bool
43- -> ?expunge : ( string -> [ `Keep | `Skip ])
43+ -> ?exported_unit : string list
4444 -> ?dynlink : bool
4545 -> ?debug : [`Full | `Names | `No ]
4646 -> in_channel
Original file line number Diff line number Diff line change @@ -105,5 +105,11 @@ let cmis files =
105105 List. fold_left files ~init: [] ~f: (fun fs file ->
106106 match kind file with
107107 | `Pkg pkg -> cmis_of_package pkg @ fs
108- | `Cmi s -> read_cmi ~dir: " ." s :: fs
108+ | `Cmi s -> (
109+ match String. split_char ~sep: ':' s with
110+ | [s] -> read_cmi ~dir: " ." s :: fs
111+ | [pkg; s] ->
112+ let dir = Findlib. package_directory pkg in
113+ read_cmi ~dir s :: fs
114+ | [] | _ :: _ :: _ :: _ -> assert false )
109115 | `Cma s -> cmis_of_cma ~dir: " ." s @ fs)
Original file line number Diff line number Diff line change 5959 js_of_ocaml.deriving
6060 lwt bigarray
6161 tyxml.functor
62+ tyxml.functor:html_types.cmi
6263 react reactiveData
6364 js_of_ocaml js_of_ocaml-lwt
6465 js_of_ocaml-tyxml
6566 js_of_ocaml-toplevel
6667 dynlink
67- ;; FIX: html_types is missing
68- ;; html_types.cmi
6968 )))
7069
7170(rule
Original file line number Diff line number Diff line change 11(* * Overview *)
2+
23let x = 10 + 10
34
45let y = x * 3
@@ -14,6 +15,7 @@ let _ = Printf.printf "fact 20 = %f\n" (fact 20)
1415let _ = " abc" < " def"
1516
1617(* * Mutually recursive function *)
18+
1719let rec even n =
1820 match n with
1921 | 0 -> true
@@ -25,6 +27,7 @@ and odd n =
2527 | x -> even (x - 1 )
2628
2729(* * Mutually recursive module *)
30+
2831module rec Odd : sig
2932 val odd : int -> bool
3033end = struct
@@ -91,22 +94,24 @@ let div_elt =
9194
9295let _ = display div_elt
9396
94- open Graphics_js
9597(* * Graphics: Draw *)
9698
99+ open Graphics_js
100+
97101let () = loop [Mouse_motion ] (function {mouse_x = x ; mouse_y = y } -> fill_circle x y 5 )
98102
99- open Graphics_js
100103(* * Graphics: Draw chars*)
101104
105+ open Graphics_js
106+
102107let () =
103108 loop [Mouse_motion ; Key_pressed ] (function {mouse_x = x ; mouse_y = y ; key} ->
104109 moveto x y;
105110 draw_char key)
106111
107- open Js_of_ocaml_lwt
108112(* * Graphics: PingPong *)
109113
114+ open Js_of_ocaml_lwt
110115open Graphics_js
111116
112117let c = 3
You can’t perform that action at this time.
0 commit comments