mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-11-07 14:43:41 +01:00
51 lines
1.2 KiB
Bash
Executable File
51 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
function print_modules ()
|
|
{
|
|
MODULES=$(grep "val pp " ../*/lib/*.mli \
|
|
| cut -d ":" -f 1 \
|
|
| sed 's|^../||' \
|
|
| sed 's|\.mli||' \
|
|
| sed 's|/lib/| |' \
|
|
| sed 's/[^ ]*/\u&/g' \
|
|
| sed 's| |.|' \
|
|
| grep -v Top.Install_printers )
|
|
|
|
for MODULE in $MODULES ; do
|
|
M=($(echo $MODULE | sed 's|\.| |'))
|
|
if [[ "${M[0]}" == "${M[1]}" ]] ; then
|
|
echo " \"${M[1]}.pp\" ;"
|
|
else
|
|
echo " \"${M[0]}.${M[1]}.pp\" ;"
|
|
fi
|
|
done
|
|
}
|
|
|
|
cat << EOF
|
|
let printers =
|
|
[
|
|
$(print_modules)
|
|
]
|
|
|
|
let eval_exn str =
|
|
let lexbuf = Lexing.from_string str in
|
|
let phrase = !Toploop.parse_toplevel_phrase lexbuf in
|
|
Toploop.execute_phrase false Format.err_formatter phrase
|
|
|
|
|
|
let rec install_printers = function
|
|
| [] -> eval_exn "
|
|
#require \"lacaml.top\";;
|
|
#require \"trexio\";;
|
|
"
|
|
| printer :: printers ->
|
|
let cmd = Printf.sprintf "#install_printer %s;;" printer in
|
|
eval_exn cmd && install_printers printers
|
|
|
|
let () =
|
|
if not (install_printers printers) then
|
|
Format.eprintf "Problem installing QCaml-printers@."
|
|
|
|
EOF
|
|
|