English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

Browse thread
ocamlbuild rule with recursive action
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-12-02 (11:27)
From: DooMeeR <d@d...>
Subject: Re: [Caml-list] ocamlbuild rule with recursive action
Daniel Bünzli a écrit :
> Hello,
> Is it possible to define a rule with an action that is performed 
> repeatedly until a condition is reached ?
> Best,
> Daniel

Well, you can define a rule like this :

rule ~prod: "%.rec" (fun env build ->
   let x = env "%2.rec" in (* a new fresh name *)
   if some condition then build x else Nop)

When your rule is executed, for exemple to produce "toto.rec", it will 
(if some condition) first produce "toto2.rec", which will produce 
"toto22.rec", and so on until some condition is false.

I didn't try it though.

Romain Bardou