Last change
on this file since 769 was
453,
checked in by ayache, 10 years ago
|
Import of the Paris's sources.
|
-
Property svn:executable set to
*
|
File size:
1.3 KB
|
Line | |
---|
1 | #!/usr/bin/env ocaml |
---|
2 | |
---|
3 | (* This script is a wrapper for ocamldoc. |
---|
4 | |
---|
5 | This is a simple workaround for the defaults ocamldoc rules of |
---|
6 | ocamlbuild. *) |
---|
7 | |
---|
8 | (* We assume that the command line arguments are given in the |
---|
9 | following order: |
---|
10 | |
---|
11 | ocamldoc [options] FILE.(ml|mli) |
---|
12 | |
---|
13 | where FILE is either an implementation or an interface. |
---|
14 | |
---|
15 | This script rewrites this command line into something of |
---|
16 | the shape: |
---|
17 | |
---|
18 | ocamldoc [options] -intf FILE.mli -impl FILE.ml |
---|
19 | |
---|
20 | provided that FILE.mli and FILE.ml exist (otherwise, one of these |
---|
21 | two options is dropped out). |
---|
22 | |
---|
23 | *) |
---|
24 | |
---|
25 | open List |
---|
26 | |
---|
27 | let nb = Array.length Sys.argv |
---|
28 | let args = List.tl (Array.to_list Sys.argv) |
---|
29 | let file = Filename.chop_extension (Sys.argv.(nb - 1)) |
---|
30 | let file_is = Filename.check_suffix Sys.argv.(nb - 1) |
---|
31 | let impl = file ^ ".ml" |
---|
32 | let opt what f = if Sys.file_exists f then what ^ " " ^ f else "" |
---|
33 | |
---|
34 | let cmd = |
---|
35 | match args with |
---|
36 | | [] -> "ocamlfind ocamldoc" |
---|
37 | | _ -> |
---|
38 | if file_is ".ml" || file_is ".mli" then |
---|
39 | let options = rev (tl (rev args)) in |
---|
40 | Printf.sprintf "ocamlfind ocamldoc %s %s %s" |
---|
41 | (opt "-impl" (file ^ ".ml")) |
---|
42 | (opt "-intf" (file ^ ".mli")) |
---|
43 | (String.concat " " options) |
---|
44 | else |
---|
45 | Printf.sprintf "ocamlfind ocamldoc %s" |
---|
46 | (String.concat " " args) |
---|
47 | |
---|
48 | let _ = |
---|
49 | exit (Sys.command cmd) |
---|
50 | |
---|
Note: See
TracBrowser
for help on using the repository browser.