X-Git-Url: http://git.hcoop.net/bpt/coccinelle.git/blobdiff_plain/5636bb2c2537506718da74f85a2b81a5ff3df16f..65038c617fe3e5d7a284059fbfa78dddfbb9b9c4:/ctl/ctl_engine.ml diff --git a/ctl/ctl_engine.ml b/ctl/ctl_engine.ml index d39ad0a..776dcc6 100644 --- a/ctl/ctl_engine.ml +++ b/ctl/ctl_engine.ml @@ -1,27 +1,7 @@ (* - * Copyright 2005-2010, Ecole des Mines de Nantes, University of Copenhagen - * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix - * This file is part of Coccinelle. - * - * Coccinelle is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, according to version 2 of the License. - * - * Coccinelle is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Coccinelle. If not, see . - * - * The authors reserve the right to distribute this or future versions of - * Coccinelle under other licenses. - *) - - -(* - * Copyright 2005-2010, Ecole des Mines de Nantes, University of Copenhagen + * Copyright 2010, INRIA, University of Copenhagen + * Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix + * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix * This file is part of Coccinelle. * @@ -1358,8 +1338,11 @@ let satEG dir ((_,_,states) as m) s reqst = (* **************************************************************** *) (* applied to the result of matching a node. collect witnesses when the states and environments are the same *) +(* not a good idea, poses problem for unparsing, because don't realize that +adjacent things come from different matches, leading to loss of newlines etc. +exple struct I { ... - int x; + int y; ...} *) -let inner_and trips = +let inner_and trips = trips (* let rec loop = function [] -> ([],[]) | (s,th,w)::trips -> @@ -1376,7 +1359,7 @@ let inner_and trips = | _ -> ([(s,th,w)],cur@acc)) in let (cur,acc) = loop (List.sort state_compare trips) (* is this sort needed? *) in - cur@acc + cur@acc *) (* *************** *) (* Partial matches *) @@ -1542,19 +1525,20 @@ let satLabel label required p = (List.map (function (st,th,_) -> (st,th)) triples); triples else setify(label p) in - normalize - (if !pREQUIRED_ENV_OPT - then - foldl - (function rest -> - function ((s,th,_) as t) -> - if List.for_all - (List.exists (function th' -> not(conj_subst th th' = None))) - required - then t::rest - else rest) - [] triples - else triples) + (* normalize first; conj_subst relies on sorting *) + let ntriples = normalize triples in + if !pREQUIRED_ENV_OPT + then + foldl + (function rest -> + function ((s,th,_) as t) -> + if List.for_all + (List.exists (function th' -> not(conj_subst th th' = None))) + required + then t::rest + else rest) + [] ntriples + else ntriples let get_required_states l = if !pREQUIRED_STATES_OPT && not !Flag_ctl.partial_match