Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocamlp3l and command line options: how?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Maxence Guesdon <maxence.guesdon@i...>
Subject: Re: [Caml-list] ocamlp3l and command line options: how?
On Tue, 21 Aug 2007 18:30:52 -0700
"Luca de Alfaro" <luca@dealfaro.org> wrote:

> Thanks, but the problem seems to be the opposite one.... ocamlp3l also
> uses Args, and once I tell it to parse the command-line options, the
> options such as -rootp3l do not seem to work any more.  The problem is
> not that I need to avoid -rootp3l; the problem seems to be that the
> ocamlp3l runtime doesn't see its own options any more...

Hello,

You can add options with the Command_options.add function.
Exemple:

let my_options = [
  "-nl", Arg.Unit print_newline, "just print a newline" ;
  (* other options ... *)  
]
in
List.iter (fun (o,spec,s) -> Command_options.add o spec s) my_options;

They will be handled when ocamlp3l analyzes the command line.

Maxence
> 
> Luca
> 
> On 8/21/07, Till Varoquaux <till.varoquaux@gmail.com> wrote:
> >
> > The Arg module use a cursor to know which argument it is is currently
> > parsing. You can therefor ignore the first argument like this:
> >
> > incr Arg.current
> >
> > before calling Arg.parse
> >
> > Cheers,
> > Till
> >
> > On 8/21/07, Luca de Alfaro <luca@dealfaro.org> wrote:
> > > I am trying to use ocamlp3l to parallelize some code.  Using the
> > skeleton
> > > paradigm was a lot of fun and quite easy, but I am stumbling on the
> > easiest
> > > of issues...
> > >
> > > My code needs some command-line options, and I am processing them with
> > the
> > > Arg package.  The ocamlp3l manual does not anything about what to do
> > > for command-line options.
> > >
> > > I cannot simly run:
> > >
> > > ./foo -p3lroot -i blah -o boink
> > >
> > > because Arg tells me that it doesn't know what to do with -p3lroot.
> > > Fine, but, then how do I do?  It's not really feasible for me to do
> > without
> > > command-line options...
> > >
> > > Many thanks in advance,
> > >
> > > Luca
> > >
> > > _______________________________________________
> > > Caml-list mailing list. Subscription management:
> > > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> > > Archives: http://caml.inria.fr
> > > Beginner's list:
> > > http://groups.yahoo.com/group/ocaml_beginners
> > > Bug reports: http://caml.inria.fr/bin/caml-bugs
> > >
> > >
> >
> >
> > --
> > http://till-varoquaux.blogspot.com/
> >