Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
To: "Christoph Bauer" <Christoph.Bauer@lmsintl.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] ocamlbuild and menhir on MinGW
Date: Wed, 23 May 2007 16:46:40 +0200	[thread overview]
Message-ID: <cd67f63a0705230746if63ecc3m1cae27b24b22cf5a@mail.gmail.com> (raw)
In-Reply-To: <BB046CA812535C45BD0029AA9D04BA79DC37BE@KL-SRV57.lmsintl.com>

On 5/23/07, Christoph Bauer <Christoph.Bauer@lmsintl.com> wrote:
> > 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 <options> <filenames>
> ...[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 []
>

IMHO quoting of windows is not so simple. Does it solves really your problem?

-- 
Nicolas Pouillard

  reply	other threads:[~2007-05-23 14:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-22 16:14 Christoph Bauer
2007-05-23  7:40 ` [Caml-list] " Nicolas Pouillard
2007-05-23  9:21   ` Christoph Bauer
2007-05-23 14:46     ` Nicolas Pouillard [this message]
2007-05-24  7:17       ` Christoph Bauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd67f63a0705230746if63ecc3m1cae27b24b22cf5a@mail.gmail.com \
    --to=nicolas.pouillard@gmail.com \
    --cc=Christoph.Bauer@lmsintl.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox