logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Coccilib - Library of functions for use with Coccinelle OCaml script code

Author

       This manual page was written by Julia Lawall <Julia.Lawall@lip6.fr>.

Documentation

       Module Coccilib
        : sigend===Positions===typepos = {
        current_element : string ;
        current_element_line : int ;
        current_element_col : int ;
        current_element_line_end : int ;
        current_element_col_end : int ;
        file : string ;
        line : int ;
        col : int ;
        line_end : int ;
        col_end : int ;
        }

       A  value  of type pos describes a position in a source file.  current_element is the name of the function
       containing the matched position; current_element_line is the number of  the  line  containing  the  first
       character  of  the  function containing the matched position; current_element_col is the (0-based) column
       containing the first character of the function containing the matched position;  current_element_line_end
       is  the number of the line containing the last character of the function containing the matched position;
       current_element_col_end is the (0-based) column containing the last character of the function  containing
       the  matched position file is the name of the file containing the matched position; line is the number of
       the line containing the first character of the matched position; col is the (0-based)  column  containing
       the  first  character  of  the  matched  position; line_end is the number of the line containing the last
       character of the matched position; col_end is the (0-based) column containing the last character  of  the
       matched position.

       ===AbstractSyntaxTree===typeparam_type
        =
        | Pos ofposlist
        | Str ofstring
        | Type ofAst_c.fullType
        | Init ofAst_c.initialiser
        | InitList ofAst_c.initialiserAst_c.wrap2list
        | Int ofint
        | Param ofAst_c.parameterType
        | ParamList ofAst_c.parameterTypeAst_c.wrap2list
        | Expr ofAst_c.expression
        | ExprList ofAst_c.argumentAst_c.wrap2list
        | Decl ofAst_c.declaration
        | Field ofAst_c.field
        | FieldList ofAst_c.fieldlist
        | Stmt ofAst_c.statementvalmake_ident : string->Ast_c.metavar_binding_kind

       Make an identifier

       valmake_expr : string->Ast_c.metavar_binding_kind

       Make an expression

       valmake_expr_with_env : string->string->Ast_c.metavar_binding_kind

       Make  an  expression  in  a  type  environment.  The first argument is a string containing any C variable
       declarations needed to make  the  environment  and  the  second  argument  is  a  string  containing  the
       expression.

       valmake_stmt : string->Ast_c.metavar_binding_kind

       Make a single statement

       valmake_stmt_in_env : string->Ast_c.metavar_binding_kind

       Make  a single statement in a type environment.  The first argument is a string containing any C variable
       declarations needed to make the environment and the second argument is a string containing the statement.

       valmake_type : string->Ast_c.metavar_binding_kind

       Make a type

       valmake_listlen : int->Ast_c.metavar_binding_kind

       Make a list length, for parameter lists, expression lists, etc.

       valmake_full_position : string->string->int->int->int->int->int->int->int->int->Ast_c.metavar_binding_kind

       Make  a position.  The arguments are the file name, the function or other toplevel element containing the
       position, the starting line of the containing element, the starting column of the containing element, the
       ending line of the containing element, the ending column of the containing element, the starting line  of
       the  created  position,  the  starting  column  of  the  created position, the ending line of the created
       position, and the ending column of the created position.

       start at 0.  The ending line is the one that contains the last character of what is to be  matched.   The
       ending  character  is  one  past  the  last character of the thing to be matched.  The containing element
       position will be a default value.

       valmake_position : string->string->int->int->int->int->Ast_c.metavar_binding_kind

       Make a position.  The arguments are the file name, the function or other toplevel element containing  the
       position, the starting line, the starting column, the ending line, and the ending column.  Lines start at
       1.   Columns  start  at  0.  The ending line is the one that contains the last character of what is to be
       matched.  The ending character is one past the last character of the thing to be matched.  The containing
       element position will be a default value.

       ===Matchmanagementfunctions===valinclude_match : bool->unit

       If the argument is true, retain the environment with respect to which the  ocaml  script  code  is  being
       executed  for  use in subsequent rules.  If the argument is false, discard this environment.  By default,
       the environment is retained.

       valexit : unit->unit

       If called, aborts the treatment of the current file.  All previous changes take effect.

       valdir : unit->string

       Returns the directory on which spatch was launched.

       valfiles : unit->stringlist

       Returns the list of files on which spatch is currently working.  The result is the empty list  if  spatch
       is not currently working on any file (eg, in an initialize or finalize rule).

       valcocci_version : unit->string

       Returns  a  string  indicating  the  current  version.  Note that if Coccinelle has been modified since a
       release, the version number will be postfixed with "-dirty".

       valprint_main : ?color:string->string->poslist->unit

       Print information about a main position using org mode.

       valprint_sec : ?color:string->string->poslist->unit

       Print information about a single secondary position using org mode.

       valprint_secs : ?color:string->string->poslist->unit

       Print information about a list of secondary positions using org mode.

Module

       Module   Coccilib

Name

       Coccilib - Library of functions for use with Coccinelle OCaml script code

References

       Y. Padioleau, J.L. Lawall, R.R Hansen, G. Muller "Documenting and  Automating  Collateral  Evolutions  in
       Linux Device Driver" EuroSys2008, Glasgow, Scotland (April 2008) pp. 247-260.

Reporting Bugs

       Send a mail to <cocci@inria.fr>

See Also