From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 63482BC0A for ; Wed, 23 May 2007 11:21:10 +0200 (CEST) Received: from mail-outfwd.lms.be (Kaiserslautern1.lms-gmbh.de [213.68.136.230]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4N9L6YT013605 for ; Wed, 23 May 2007 11:21:10 +0200 Received: from localhost (unknown [127.0.0.1]) by mail-outfwd.lms.be (Postfix) with ESMTP id EE9187F468; Wed, 23 May 2007 11:41:49 +0200 (CEST) Received: from mail-kl.lmsintl.com ([127.0.0.1]) by localhost (kl-ftp [127.0.0.1]) (amavisd-new, port 20024) with ESMTP id 08315-10; Wed, 23 May 2007 11:41:49 +0200 (CEST) Received: from KL-SRV57.lmsintl.com (unknown [10.2.100.57]) by mail-kl.lmsintl.com (Postfix) with ESMTP id DE489B6EC9; Wed, 23 May 2007 11:41:49 +0200 (CEST) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-2022-JP" Content-Transfer-Encoding: 7bit Subject: RE: [Caml-list] ocamlbuild and menhir on MinGW Date: Wed, 23 May 2007 11:21:06 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [Caml-list] ocamlbuild and menhir on MinGW Thread-Index: AcedDZd2x6xU7itZToat8mzHFLGVnQACoSOw References: From: "Christoph Bauer" To: "Nicolas Pouillard" Cc: "caml-list" X-Virus-Scanned: by IT Services X-Miltered: at concorde with ID 46540782.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; mingw:01 cygwin:01 cygwin:01 ocamlmgw:01 ocamlmgw:01 ocamldep:01 subst:01 buffer:01 buffer:01 failwith:01 parser:01 unix:01 char:01 char:01 rec:01 > Are you in cygwin or the windows "shell"? cygwin shell. With windows "shell" Cmd.exe the output differs but it fails as well: [KC:\ocamlmgw\bin\menhir: unknown option `-modules mlutils/globParser.mly'. Usage: C:\ocamlmgw\bin\menhir ...[CUT]... ←[KExit code 2 while executing this command: C:/ocamlmgw/bin/menhir --raw-depend --ocamldep "ocamldep -modules" mlutils/glo bParser.mly > mlutils/globParser.mly.depends In ocamlbuild/my_std.ml there is a comment about the problem: let sys_command = match Sys.os_type with | "Win32" -> fun cmd -> let cmd = "bash -c "^Filename.quote cmd in (* FIXME fix Filename.quote for windows *) let cmd = String.subst "¥"&¥"¥"&¥"" "&&" cmd in Sys.command cmd | _ -> Sys.command We could use Unix.create_process. I attached a function to split cmd in a list. Regards, Christoph Bauer let split_quoted_string_list ?(quote = '"') s = let len = String.length s in let word_buffer = Buffer.create 128 in let rec outer i acc = if i >= len then List.rev acc else let c = String.unsafe_get s i in match c with ' ' | '¥t' | '¥r' | '¥n' -> outer (i+1) acc | c when c = quote -> inner (i+1) acc | _ -> plain i acc and end_of_word i acc = let word = Buffer.contents word_buffer in Buffer.clear word_buffer; outer i (word::acc) and inner i acc = if i >= len then failwith ("parser error (split_quoted_string_list): " ^ s); let c = String.unsafe_get s i in if c = quote then end_of_word (i+1) acc else (Buffer.add_char word_buffer c; inner (i+1) acc); and plain i acc = if i >= len then end_of_word i acc else match String.unsafe_get s i with ' ' | '¥t' | '¥r' | '¥n' -> end_of_word (i+1) acc | c when c = quote -> end_of_word i acc | c -> Buffer.add_char word_buffer c; plain (i+1) acc in outer 0 []