From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id pA2A9FQP003727 for ; Wed, 2 Nov 2011 11:09:15 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArMFAJ4VsU5QW+UMgWdsb2JhbABDmX+OK4EeIgEBFiYlgXIBAQUnLhkbCxgNCAcLBxARGwkBERAJEgmHaQa1JYNDgjGDHASRC4MJijuHKg X-IronPort-AV: E=Sophos;i="4.69,443,1315173600"; d="scan'208";a="116129284" Received: from lo.gmane.org ([80.91.229.12]) by mail4-smtp-sop.national.inria.fr with ESMTP; 02 Nov 2011 11:09:01 +0100 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RLXkf-00066Y-P5 for caml-list@inria.fr; Wed, 02 Nov 2011 11:08:57 +0100 Received: from ks368928.kimsufi.com ([94.23.39.26]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 02 Nov 2011 11:08:57 +0100 Received: from sylvain by ks368928.kimsufi.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 02 Nov 2011 11:08:57 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Sylvain Le Gall Date: Wed, 2 Nov 2011 10:08:43 +0000 (UTC) Message-ID: References: X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: ks368928.kimsufi.com User-Agent: slrn/pre1.0.0-18 (Linux) Subject: [Caml-list] Re: oasis, inter-dependent libraries and syntax extension Hello, You are indeed right, syntax extensions remain a second class citizen. I'll need to fix that situation. Please report this problem to the bug tracker, along with your solution (which seems fine). I'll try to implement it in 0.3. Cheers Sylvain Le Gall On 01-11-2011, Philippe Veber wrote: > > --20cf307abebda8d83d04b0a9e43e > Content-Type: text/plain; charset=ISO-8859-1 > Content-Transfer-Encoding: quoted-printable > > I found a workaround in lwt, which is to add some code in myocamlbuild.ml, > outside the generated part, to define appropriate tags that can then be > used in _tags (more generally, lwt has several interesting tricks about > oasis). For the record, here is how you can use a syntax extension > internally, inside a package: > > open Ocamlbuild_plugin > > let () =3D > dispatch > (fun hook -> > dispatch_default hook; > match hook with > | Before_options -> > Options.make_links :=3D false > > | After_rules -> > (* Internal syntax extension *) > List.iter > (fun base -> > let tag =3D "pa_" ^ base and file =3D "src/syntax/pa_" ^ = > base > ^ ".cmo" in > flag ["ocaml"; "compile"; tag] & S[A"-ppopt"; A file]; > flag ["ocaml"; "ocamldep"; tag] & S[A"-ppopt"; A file]; > flag ["ocaml"; "doc"; tag] & S[A"-ppopt"; A file]; > dep ["ocaml"; "ocamldep"; tag] [file]) > ["syntax_ext1";"syntax_ext2"]; (* add your syntax extensions > here *) > | _ -> > ()) > > > > 2011/10/31 Philippe Veber > >> S=E9bastien's suggestion is indeed a good start but alas for me not enoug= > h. >> The build still fails at ocamldep time, because the library B (with the >> syntax extension) seems not to be taken into account. If I replace my >> syntax extension with some findlib package (say tyxml), the compilation >> works fine. So the question remains, how can I specify that a >> library/executable in a package depends on a syntax extension that is >> defined as a library of the same package? >> >> Thanks to oasisdb, I've browsed a couple of packages that could be in the >> same situation, like a test executable for a syntax extension, but found >> none. Maybe I'm not dealing correctly with the situation ? >> >> ph. >> >> >> 2011/10/31 Sebastien Mondet >> >>> >>> Hi >>> >>> >>> I ran into the same problem last week. >>> I added a line to the _tags file after the OASIS-generated stuff: >>> >>> ... >>> # OASIS_STOP >>> >>> : syntax_camlp4o >>> >>> >>> (found in the slide 18: >>> http://oasis.forge.ocamlcore.org/documentation.html ) >>> >>> >>> Sebastien >>> >>> >>> >>> >>> >>> >>> On Mon, Oct 31, 2011 at 12:23, Philippe Veber = > wrote: >>> >>>> Hi, >>>> I have an oasis project defining three inter-dependent libraries A, B >>>> and C. B is a syntax extension, and depends on A. C depends on both A a= > nd >>>> B. I have written an _oasis file for this, which works fine if I don't = > use >>>> the extension in C, but fails if I do, during ocamldep (ocamldep lacks = > the >>>> appropriate options to understand the new syntax). Has anybody run into >>>> this problem ? >>>> >>>> ph. >>>> >>>> >>> >> > > --=20 > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > > > --20cf307abebda8d83d04b0a9e43e > Content-Type: text/html; charset=ISO-8859-1 > Content-Transfer-Encoding: quoted-printable > > I found a workaround in lwt, which is to add some code in /myocamlbuild.ml">myocamlbuild.ml, outside the generated part, to defin= > e appropriate tags that can then be used in _tags (more generally, lwt has = > several interesting tricks about oasis). For the record, here is how you ca= > n use a syntax extension internally, inside a package:
> >
open Ocamlbuild_plu= > gin

nt-family: courier new,monospace;"> monospace;">let () =3D
e;"> > >=A0 dispatch
style=3D"font-family: courier new,monospace;"> ourier new,monospace;">=A0=A0=A0 (fun hook ->
mily: courier new,monospace;"> > >=A0=A0=A0=A0=A0=A0 disp= > atch_default hook;
= >=A0=A0=A0=A0=A0=A0 matc= > h hook with
> >=A0=A0=A0=A0=A0=A0=A0= >=A0 | Before_options ->
space;">=A0=A0=A0=A0=A0= >=A0=A0=A0=A0=A0=A0=A0 Options.make_links :=3D false
-family: courier new,monospace;"> > >
y: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=A0 | After_rules -> an>
mily: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (* Inter= > nal syntax extension *)
ce;"> > >=A0=A0=A0=A0=A0=A0=A0= >=A0=A0=A0=A0=A0 List.iter
pace;">=A0=A0=A0=A0=A0= >=A0=A0=A0=A0=A0=A0=A0=A0=A0 (fun base ->
courier new,monospace;"> > >=A0=A0=A0=A0=A0=A0=A0= >=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 let tag =3D "pa_" ^ base and file = >=3D "src/syntax/pa_" ^ base ^ ".cmo" in
=3D"font-family: courier new,monospace;"> > >=A0=A0=A0=A0=A0=A0=A0= >=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 flag ["ocaml"; "compile"= > ; tag] & S[A"-ppopt"; A file];
: courier new,monospace;"> ;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 flag ["ocaml&qu= > ot;; "ocamldep"; tag] & S[A"-ppopt"; A file];>
> >=A0=A0=A0=A0=A0=A0=A0= >=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 flag ["ocaml"; "doc"; ta= > g] & S[A"-ppopt"; A file];
urier new,monospace;">= >=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 dep ["ocaml";= > "ocamldep"; tag] [file])
new,monospace;"> > >=A0=A0=A0=A0=A0=A0=A0= >=A0=A0=A0=A0=A0=A0=A0 ["syntax_ext1";"syntax_ext2"]; pan> (* add your syntax= > extensions here *)
> >=A0=A0=A0=A0=A0=A0=A0= >=A0 | _ ->
style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=A0=A0= >=A0=A0=A0 ())

> >


2011/10/31 Philippe Veber =3D"ltr"><philippe.veber@gma= > il.com>
0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> > > S=E9bastien's suggestion is indeed a good start but alas for me not eno= > ugh. The build still fails at ocamldep time, because the library B (with th= > e syntax extension) seems not to be taken into account. If I replace my syn= > tax extension with some findlib package (say tyxml), the compilation works = > fine. So the question remains, how can I specify that a library/executable = > in a package depends on a syntax extension that is defined as a library of = > the same package?
> > >
Thanks to oasisdb, I've browsed a couple of packages that could be = > in the same situation, like a test executable for a syntax extension, but f= > ound none. Maybe I'm not dealing correctly with the situation ?
> > >
ph.


>2011/10/31 Sebastien Mondet < ien.mondet@gmail.com" target=3D"_blank">sebastien.mondet@gmail.com><= > /span>
> >
x #ccc solid;padding-left:1ex"> >

Hi


I ran into t= > he same problem last week.
I added a line to the _tags file after= > the OASIS-generated stuff:

=A0 =A0...
> >
> > >=A0 =A0# OASIS_STOP

=A0 =A0<src/*/*.ml>: syn= > tax_camlp4o


(found in the sli= > de 18:
> > > > >


Sebastien
<= > /font>



v>


On Mon, Oct 31, 2011 at 12:2= > 3, Philippe Veber < ail.com" target=3D"_blank">philippe.veber@gmail.com> wrote: r> > > > > >
x #ccc solid;padding-left:1ex">Hi,
I have an oasis project defining thre= > e inter-dependent libraries A, B and C. B is a syntax extension, and depend= > s on A. C depends on both A and B. I have written an _oasis file for this, = > which works fine if I don't use the extension in C, but fails if I do, = > during ocamldep (ocamldep lacks the appropriate options to understand the n= > ew syntax). Has anybody run into this problem ?
> > > > > > >
ph.

>

>

>
> > --20cf307abebda8d83d04b0a9e43e-- > Cheers, Sylvain Le Gall -- My company: http://www.ocamlcore.com Linkedin: http://fr.linkedin.com/in/sylvainlegall Start an OCaml project here: http://forge.ocamlcore.org OCaml blogs: http://planet.ocamlcore.org