Commit 358b5d40 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2005-03-04 16:11:39 by afrisch] Empty log message

Original author: afrisch
Date: 2005-03-04 16:11:40+00:00
parent 762d1ce2
#!/bin/sh
FLAGS=
while true; do
case "$1" in
-I)
FLAGS="$FLAGS -I $2"
shift
shift
;;
-p)
FLAGS="$FLAGS -I `ocamlfind query $2`"
shift
shift
;;
*)
break
;;
esac
done
echo $FLAGS
TARG=$1
PRIMS=$2
if [ "${TARG}" = "" ] || [ "${PRIMS}" = "" ]; then
echo "Usage: cduce_mktop <target> <primitive file>"
echo "Usage: cduce_mktop [(-I path | -p package) ...] <target> <primitive file>"
exit 2
fi
exec ocamlfind ocamlc -package cduce -o $TARG -linkpkg -pp mlcduce_wrapper -impl $PRIMS
exec ocamlfind ocamlc -package cduce -o $TARG -linkpkg -pp "mlcduce_wrapper $FLAGS" -impl $PRIMS
let loc = (Lexing.dummy_pos, Lexing.dummy_pos)
let usage =
"Usage: mlcduce_wrapper <primitive file>
"Usage: mlcduce_wrapper [-I path ...] <primitive file>
"
let err s = prerr_endline s; prerr_endline usage; exit 1
let rec args = function
| "-I"::path::rest ->
Librarian.obj_path := path::!Librarian.obj_path;
args rest
| [p] -> p
| _ -> err "Invalid command line"
let () =
if Array.length Sys.argv != 2 then err "";
let fn = Sys.argv.(1) in
let fn = args (List.tl (Array.to_list Sys.argv)) in
let ic =
try open_in fn
with Sys_error s -> err s in
......@@ -23,5 +31,9 @@ let () =
done
with End_of_file -> ());
let s = Mlstub.gen_wrapper !v in
!Pcaml.print_implem [ s,loc ]
!Pcaml.print_implem [ s,loc ];
print_endline "let () = Librarian.obj_path := [";
List.iter (fun s -> Printf.printf " %S;\n" s) !Librarian.obj_path;
print_endline " ];;";
print_endline "let () = Run.main ();;"
......@@ -580,8 +580,7 @@ let wrapper values =
let m = if g = [] then exts else <:str_item< value rec $list:g$ >>::exts in
let m = [ <:str_item< open Cduce_lib >>;
<:str_item< Config.init_all () >>] @ m @
[ <:str_item< Run.main () >> ] in
<:str_item< Config.init_all () >>] @ m in
<:str_item< declare $list:m$ end >>
......
......@@ -362,17 +362,23 @@ toplevel with built-in support for some OCaml modules / functions.
</p>
<sample>
cduce_mktop [target] [primitive file]
cduce_mktop [-I path | -p package ... ] [target] [primitive file]
</sample>
<p>
The first argument is the file name of the resulting toplevel.
The second points to a file whose contents specify a set of built-in
The <code>target</code> argument is the file name of the resulting toplevel.
The <code>primitive file</code> argument points to a file whose contents specify a set of built-in
OCaml values to be embedded in the toplevel. Each line must either
be a qualified value (like <code>List.map</code>) or
the name of an OCaml unit (like <code>List</code>). Empty lines
and lines starting with a sharp character are ignored.
</p>
<p>
The leading <code>-I</code> options enrich the search path for OCaml
units. The <code>-p</code> options serves a similar purpose; their
arguments are findlib package names. All these paths are included
in the produced toplevel.
</p>
<p>
In a custom toplevel, the directive <code>#builtins</code> prints the name
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment