- * Copyright 2010, INRIA, University of Copenhagen
+ * Copyright 2012, INRIA
+ * Julia Lawall, Gilles Muller
+ * Copyright 2010-2011, 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
* 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
(* pos is an offset indicating where in the C code the mcodekind
has an effect *)
(* int list is the match instances, which are only meaningful in annotated
C code *)
(* pos is an offset indicating where in the C code the mcodekind
has an effect *)
(* int list is the match instances, which are only meaningful in annotated
C code *)
(* iteration is only allowed on context code, the intuition vaguely being
that there is no way to replace something more than once. Actually,
allowing iterated additions on minus code would cause problems with some
(* iteration is only allowed on context code, the intuition vaguely being
that there is no way to replace something more than once. Actually,
allowing iterated additions on minus code would cause problems with some
on - code for the moment. Although it may be confusing that there can be
iterated addition of code before context code where the context code is
immediately followed by removed code. *)
on - code for the moment. Although it may be confusing that there can be
iterated addition of code before context code where the context code is
immediately followed by removed code. *)
| MetaFreshIdDecl of meta_name (* name *) * seed (* seed *)
| MetaTypeDecl of arity * meta_name (* name *)
| MetaInitDecl of arity * meta_name (* name *)
| MetaFreshIdDecl of meta_name (* name *) * seed (* seed *)
| MetaTypeDecl of arity * meta_name (* name *)
| MetaInitDecl of arity * meta_name (* name *)
| MetaListlenDecl of meta_name (* name *)
| MetaParamDecl of arity * meta_name (* name *)
| MetaParamListDecl of arity * meta_name (*name*) * list_len (*len*)
| MetaListlenDecl of meta_name (* name *)
| MetaParamDecl of arity * meta_name (* name *)
| MetaParamListDecl of arity * meta_name (*name*) * list_len (*len*)
| MetaId of meta_name mcode * idconstraint * keep_binding * inherited
| MetaFunc of meta_name mcode * idconstraint * keep_binding * inherited
| MetaLocalFunc of meta_name mcode * idconstraint * keep_binding * inherited
| MetaId of meta_name mcode * idconstraint * keep_binding * inherited
| MetaFunc of meta_name mcode * idconstraint * keep_binding * inherited
| MetaLocalFunc of meta_name mcode * idconstraint * keep_binding * inherited
expression dots * string mcode (* ) *)
| Assignment of expression * assignOp mcode * expression *
bool (* true if it can match an initialization *)
expression dots * string mcode (* ) *)
| Assignment of expression * assignOp mcode * expression *
bool (* true if it can match an initialization *)
| CondExpr of expression * string mcode (* ? *) * expression option *
string mcode (* : *) * expression
| Postfix of expression * fixOp mcode
| CondExpr of expression * string mcode (* ? *) * expression option *
string mcode (* : *) * expression
| Postfix of expression * fixOp mcode
| MetaErr of meta_name mcode * constraints * keep_binding *
inherited
| MetaExpr of meta_name mcode * constraints * keep_binding *
Type_cocci.typeC list option * form * inherited
| MetaExprList of meta_name mcode * listlen * keep_binding *
inherited (* only in arg lists *)
| MetaErr of meta_name mcode * constraints * keep_binding *
inherited
| MetaExpr of meta_name mcode * constraints * keep_binding *
Type_cocci.typeC list option * form * inherited
| MetaExprList of meta_name mcode * listlen * keep_binding *
inherited (* only in arg lists *)
| EComma of string mcode (* only in arg lists *)
| DisjExpr of expression list
| NestExpr of string mcode (* <.../<+... *) *
expression dots *
| EComma of string mcode (* only in arg lists *)
| DisjExpr of expression list
| NestExpr of string mcode (* <.../<+... *) *
expression dots *
expression option * multi
(* can appear in arg lists, and also inside Nest, as in:
expression option * multi
(* can appear in arg lists, and also inside Nest, as in:
(* ANY = int E; ID = idexpression int X; CONST = constant int X; *)
and form = ANY | ID | LocalID | CONST (* form for MetaExp *)
(* ANY = int E; ID = idexpression int X; CONST = constant int X; *)
and form = ANY | ID | LocalID | CONST (* form for MetaExp *)
- Type of const_vol mcode option * typeC
+ Type of bool (* true if all minus *) *
+ const_vol mcode option * typeC
+ | AsType of fullType * fullType (* as type, always metavar *)
-and baseType = VoidType | CharType | ShortType | IntType | DoubleType
- | FloatType | LongType | LongLongType | SizeType | SSizeType | PtrDiffType
+and baseType = VoidType | CharType | ShortType | ShortIntType | IntType
+| DoubleType | LongDoubleType | FloatType
+| LongType | LongIntType | LongLongType | LongLongIntType
+| SizeType | SSizeType | PtrDiffType
| TyDecl of fullType * string mcode (* ; *)
| MacroDecl of ident (* name *) * string mcode (* ( *) *
expression dots * string mcode (* ) *) * string mcode (* ; *)
| TyDecl of fullType * string mcode (* ; *)
| MacroDecl of ident (* name *) * string mcode (* ( *) *
expression dots * string mcode (* ) *) * string mcode (* ; *)
| Typedef of string mcode (*typedef*) * fullType *
typeC (* either TypeName or metavar *) * string mcode (*;*)
| DisjDecl of declaration list
| Typedef of string mcode (*typedef*) * fullType *
typeC (* either TypeName or metavar *) * string mcode (*;*)
| DisjDecl of declaration list
| MetaDecl of meta_name mcode * keep_binding * inherited
| MetaField of meta_name mcode * keep_binding * inherited
| MetaFieldList of meta_name mcode * listlen * keep_binding * inherited
| MetaDecl of meta_name mcode * keep_binding * inherited
| MetaField of meta_name mcode * keep_binding * inherited
| MetaFieldList of meta_name mcode * listlen * keep_binding * inherited
| InitExpr of expression
| ArInitList of string mcode (*{*) * initialiser dots * string mcode (*}*)
| StrInitList of bool (* true if all are - *) *
| InitExpr of expression
| ArInitList of string mcode (*{*) * initialiser dots * string mcode (*}*)
| StrInitList of bool (* true if all are - *) *
(* --------------------------------------------------------------------- *)
(* Function declaration *)
(* --------------------------------------------------------------------- *)
(* Function declaration *)
| IfHeader of string mcode (* if *) * string mcode (* ( *) *
expression * string mcode (* ) *)
| Else of string mcode (* else *)
| IfHeader of string mcode (* if *) * string mcode (* ( *) *
expression * string mcode (* ) *)
| Else of string mcode (* else *)
| IfThen of rule_elem (* header *) * statement * end_info (* endif *)
| IfThenElse of rule_elem (* header *) * statement *
rule_elem (* else *) * statement * end_info (* endif *)
| IfThen of rule_elem (* header *) * statement * end_info (* endif *)
| IfThenElse of rule_elem (* header *) * statement *
rule_elem (* else *) * statement * end_info (* endif *)
| Do of rule_elem (* do *) * statement * rule_elem (* tail *)
| For of rule_elem (* header *) * statement * end_info (*endfor*)
| Iterator of rule_elem (* header *) * statement * end_info (*enditer*)
| Do of rule_elem (* do *) * statement * rule_elem (* tail *)
| For of rule_elem (* header *) * statement * end_info (*endfor*)
| Iterator of rule_elem (* header *) * statement * end_info (*enditer*)
(statement dots,statement) whencode list * multi *
dots_whencode list * dots_whencode list
| FunDecl of rule_elem (* header *) * rule_elem (* { *) *
statement dots * rule_elem (* } *)
| Define of rule_elem (* header *) * statement dots
(statement dots,statement) whencode list * multi *
dots_whencode list * dots_whencode list
| FunDecl of rule_elem (* header *) * rule_elem (* { *) *
statement dots * rule_elem (* } *)
| Define of rule_elem (* header *) * statement dots
| Dots of string mcode (* ... *) *
(statement dots,statement) whencode list *
dots_whencode list * dots_whencode list
| Dots of string mcode (* ... *) *
(statement dots,statement) whencode list *
dots_whencode list * dots_whencode list
| CODE of statement dots
| FILEINFO of string mcode (* old file *) * string mcode (* new file *)
| ERRORWORDS of expression list
| CODE of statement dots
| FILEINFO of string mcode (* old file *) * string mcode (* new file *)
| ERRORWORDS of expression list
let set_isos x isos = {x with iso_info = isos}
let get_pos_var (_,_,_,p) = p
let set_pos_var vr (a,b,c,_) = (a,b,c,vr)
let set_isos x isos = {x with iso_info = isos}
let get_pos_var (_,_,_,p) = p
let set_pos_var vr (a,b,c,_) = (a,b,c,vr)
-let drop_pos (a,b,c,_) = (a,b,c,NoMetaPos)
+let drop_pos (a,b,c,_) = (a,b,c,[])
| MetaFreshIdDecl(nm,seed) -> nm
| MetaTypeDecl(ar,nm) -> nm
| MetaInitDecl(ar,nm) -> nm
| MetaFreshIdDecl(nm,seed) -> nm
| MetaTypeDecl(ar,nm) -> nm
| MetaInitDecl(ar,nm) -> nm
| MetaListlenDecl(nm) -> nm
| MetaParamDecl(ar,nm) -> nm
| MetaParamListDecl(ar,nm,nm1) -> nm
| MetaListlenDecl(nm) -> nm
| MetaParamDecl(ar,nm) -> nm
| MetaParamListDecl(ar,nm,nm1) -> nm
- (MetaRuleElem(((rule,s),no_info,d,NoMetaPos),Type_cocci.Unitary,false)))
+ (MetaRuleElem(((rule,s),no_info,d,[]),Type_cocci.Unitary,false)))
with free_vars = fvs; fresh_vars = fresh; inherited = inh}
let make_meta_decl s d (fvs,fresh,inh) =
let rule = "" in
{(make_term
with free_vars = fvs; fresh_vars = fresh; inherited = inh}
let make_meta_decl s d (fvs,fresh,inh) =
let rule = "" in
{(make_term
- (MetaDecl(((rule,s),no_info,d,NoMetaPos),Type_cocci.Unitary,false))) with
+ (MetaDecl(((rule,s),no_info,d,[]),Type_cocci.Unitary,false))) with
-let make_mcode x = (x,no_info,CONTEXT(NoPos,NOTHING),NoMetaPos)
+let make_mcode x = (x,no_info,CONTEXT(NoPos,NOTHING),[])