| 2 |
|
|
| 3 |
let dump = ref None |
let dump = ref None |
| 4 |
let src = ref [] |
let src = ref [] |
| 5 |
|
let args = ref [] |
| 6 |
|
|
| 7 |
let specs = |
let specs = |
| 8 |
[ "-dump", Arg.String (fun s -> dump := Some s), |
[ "-dump", Arg.String (fun s -> dump := Some s), |
| 9 |
" specify filename for persistency"; |
" specify filename for persistency"; |
| 10 |
"-quiet", Arg.Set Cduce.quiet, |
"-quiet", Arg.Set Cduce.quiet, |
| 11 |
"suppress normal output (typing, results)" |
"suppress normal output (typing, results)"; |
| 12 |
|
"-v", Arg.Unit (fun () -> |
| 13 |
|
Printf.eprintf "CDuce, version %s\n" |
| 14 |
|
Cduce.version; exit 0), |
| 15 |
|
" print CDuce version"; |
| 16 |
|
"--", Arg.Rest (fun s -> args := s :: !args), |
| 17 |
|
" the following argument are passed to the CDuce program (in argv)"; |
| 18 |
] |
] |
| 19 |
|
|
| 20 |
let () = |
let () = |
| 57 |
Format.fprintf ppf "done ...@." |
Format.fprintf ppf "done ...@." |
| 58 |
with Sys_error _ -> |
with Sys_error _ -> |
| 59 |
Format.fprintf ppf "failed ...@.") |
Format.fprintf ppf "failed ...@.") |
| 60 |
| None -> ()); |
| None -> |
| 61 |
|
let l = List.rev_map Value.string_latin1 !args in |
| 62 |
|
let l = Value.sequence l in |
| 63 |
|
let t = Sequence.star Sequence.string in |
| 64 |
|
Cduce.enter_global_value "argv" l t |
| 65 |
|
); |
| 66 |
(match !src with |
(match !src with |
| 67 |
| [] -> |
| [] -> |
| 68 |
Format.fprintf ppf "No script specified; using stdin ...@."; |
Format.fprintf ppf |
| 69 |
|
"CDuce %s\nNo script specified; using stdin ...@." |
| 70 |
|
Cduce.version; |
| 71 |
do_file "" |
do_file "" |
| 72 |
| l -> List.iter do_file l); |
| l -> List.iter do_file l); |
| 73 |
(match !dump with |
(match !dump with |