Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] camlp4 in script
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: William Lovas <wlovas@s...>
Subject: Re: [Caml-list] camlp4 in script
On Mon, Nov 03, 2003 at 11:45:59AM -0800, Issac Trotts wrote:
> ijtrotts@beech:/tmp$ cat c4.ml
> let () =
>     let includes = "-I /usr/lib/ocaml/camlp4" in
>     let args =
>         List.fold_left (^) "" (List.tl (Array.to_list Sys.argv))

I don't think this is what you want -- this will concatenate the arguments
without putting any whitespace between them.  Maybe:

    let args =
        String.concat " " (List.tl (Array.to_list Sys.argv))

>     in
>     let cmd =
>         Printf.sprintf "ocaml %s camlp4r.cma %s" includes args
>     in
>     match Sys.command cmd with
>       0 -> ()
>     | _ -> prerr_endline ("Couldn't run "^cmd)
>
> [...]

cheers,
William

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners