Release coccinelle-0.1.2
[bpt/coccinelle.git] / engine / pattern_c.ml
similarity index 92%
rename from engine/pattern3.ml
rename to engine/pattern_c.ml
index 88560ee..68cde1e 100644 (file)
@@ -1,27 +1,19 @@
-(*
-* Copyright 2005-2008, Ecole des Mines de Nantes, University of Copenhagen
-* Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller
-* 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 <http://www.gnu.org/licenses/>.
-* 
-* The authors reserve the right to distribute this or future versions of
-* Coccinelle under other licenses.
-*)
-
-
+(* Copyright (C) 2006, 2007 Yoann Padioleau
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License (GPL)
+ * version 2 as published by the Free Software Foundation.
+ * 
+ * This program 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
+ * file license.txt for more details.
+ * 
+ * This file was part of Coccinelle.
+ *)
 open Common
 
+module Flag_engine = Flag_matcher
 (*****************************************************************************)
 (* The functor argument  *) 
 (*****************************************************************************)
@@ -146,7 +138,7 @@ module XMATCH = struct
     else fail tin
 
 
-  let mode = Cocci_vs_c_3.PatternMode
+  let mode = Cocci_vs_c.PatternMode
 
   (* ------------------------------------------------------------------------*)
   (* Exp  *) 
@@ -301,7 +293,7 @@ module XMATCH = struct
           inherited variables *)
        (match Common.optionise (fun () -> tin.binding0 +> List.assoc c) with
          Some valu' ->
-           if Cocci_vs_c_3.equal_metavarval exp valu'
+           if Cocci_vs_c.equal_metavarval exp valu'
            then success else failure
        | None ->
            (* if the variable is not there, it puts no constraints *)
@@ -324,14 +316,14 @@ module XMATCH = struct
     then
       match Common.optionise (fun () -> tin.binding0 +> List.assoc k) with
       | Some (valu') ->
-          if Cocci_vs_c_3.equal_metavarval valu valu'
+          if Cocci_vs_c.equal_metavarval valu valu'
           then Some tin.binding
           else None
       |        None -> None
     else
       match Common.optionise (fun () -> tin.binding +> List.assoc k) with
       | Some (valu') ->
-          if Cocci_vs_c_3.equal_metavarval valu valu'
+          if Cocci_vs_c.equal_metavarval valu valu'
           then Some tin.binding
           else None
              
@@ -384,8 +376,8 @@ module XMATCH = struct
        (match Ast_cocci.get_pos_var k with
          Ast_cocci.MetaPos(name,constraints,per,keep,inherited) ->
            let pvalu =
-             let (file,min,max) = get_max_min() in
-             Ast_c.MetaPosValList[(file,min,max)] in
+             let (file,current_element,min,max) = get_max_min() in
+             Ast_c.MetaPosValList[(file,current_element,min,max)] in
            (* check constraints.  success means that there is a match with
               one of the constraints, which will ultimately result in
               failure. *)
@@ -468,7 +460,7 @@ end
 (*****************************************************************************)
 (* Entry point  *) 
 (*****************************************************************************)
-module MATCH  = Cocci_vs_c_3.COCCI_VS_C (XMATCH)
+module MATCH  = Cocci_vs_c.COCCI_VS_C (XMATCH)
 
 
 let match_re_node2 dropped_isos a b binding0 =