ANTAREX API

Clava API

LARA API

LARA Common Language API

Global Functions

ImportDeclarations

ImportDeclarations($st, $splittedfile)

Import in a file ($splittedfile) the declaration of the external references of a statement ( $st).
These declarations are attributed "extern" in the $splittedfile file.
The declaration imported by the file of ($st) are filtered (they are assumed known via includes).

Parameters

$st: any
$splittedfile: any

ImportIncludes

ImportIncludes($aStmt, $afile)

Import in a file ($afile) the includes of the file of a statement ($aStmt).

Parameters

$aStmt: any
$afile: any

TRACE_HERE

TRACE_HERE(mess)

Parameters

mess: any

cleanCode

cleanCode($Decls)

Remove the declaration, element of $Decls, from the code.
The operation is not applied for some declarations (global one, member of classes).

Parameters

$Decls: any

declNewSymbolsAsGlobals

declNewSymbolsAsGlobals($Decls)

Declare as global the declaration element of $Decls.
The operation is not applied for some declarations (global one, member of classes,...).

Parameters

$Decls: any

declareNewMethod

declareNewMethod($FunctionOrMethod, nfunc, inter)

Declaration of a new method in a class.

Parameters

$FunctionOrMethod: any - the ast of a function or a method.
nfunc: any - the name of the new function or method to declare.
inter: any - the interface of the function/method to declare.

Returns

any - the name to use for the definition. If $FunctionOrMethod is a function, the declaration is not added and nfunc is returned, for a method a new method is declared in the class of the $FunctionOrMethod method, it returns the string to use for the definition of the new method (ie C::nfunc, where C is the name of the class of $FunctionOrMethod).

getImportedIncludes

getImportedIncludes($vFile, id)

Parameters

$vFile: any
id: any

getNewId

getNewId(name)

Parameters

name: any

Returns

any - a new identifier.

initMustBeKept

initMustBeKept($f)

Parameters

$f: any

isInitClassWithoutParameters

isInitClassWithoutParameters($f)

Parameters

$f: any

Returns

any - true if a declaration ($decl) is initialized with the default class constructor, false otherwise.

isfilteredDeclaration

isfilteredDeclaration($decl)

Parameters

$decl: any

Returns

any - true if the identifier of a declaration ($decl) may not be replaced, false otherwise. Return true for - global variable, - reference to a member of a class.

keepInitDeclarations

keepInitDeclarations($Decls)

Keep initialisation assigned to a declaration, element of $Decls, as a new statement
The operation is not applied for some declarations (global one, member of classes)
and not for an index variable of a loop.

Example:
For a declaration such that {...; int i = 88; ...}, it produces {...; i = 88; int i = 88; ...}
The declaration is removed later.

Parameters

$Decls: any

removeInit

removeInit($vstmt)

Remove the initialisations of a decl statement.

Parameters

$vstmt: any

removeInitDecl

removeInitDecl($vdecl)

Remove the initial value assigned to a declaration.

Parameters

$vdecl: any

substituteIdentDeclaration

substituteIdentDeclaration($decl)

Assign a new ident to a declaration ($decl).

Parameters

$decl: any

substituteSymbols

substituteSymbols($Decls)

Substitute the name of the symbol of a declaration, element of $Decls, by a new name.
The operation is not applied for some declarations (global one, member of classes,...).

Parameters

$Decls: any