PyForTool
Python-fortran-tool
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
pyfortool.scope.PYFTscope Class Reference
Inheritance diagram for pyfortool.scope.PYFTscope:
Inheritance graph
[legend]
Collaboration diagram for pyfortool.scope.PYFTscope:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, xml, scopePath='/', parentScope=None, enableCache=False, tree=None, excludeContains=False)
 
 __copy__ (self)
 
 __deepcopy__ (self, memo)
 
 __getattr__ (self, attr)
 
 path (self)
 
 mainScope (self)
 
 parentScope (self)
 
 getParent (self, item, level=1)
 
 getSiblings (self, item, before=True, after=True)
 
 showScopesList (self, includeItself=False)
 
 getScopes (self, level=-1, excludeContains=True, excludeKinds=None, includeItself=True)
 
 getScopeNode (self, scopePath, excludeContains=True, includeItself=True)
 
 isScopeNode (self, node)
 
 getParentScopeNode (self, item, mustRaise=True)
 
 getScopePath (self, item, includeItself=True)
 
 getFileName (self)
 
 empty (self, addStmt=None, simplify=False)
 
- Public Member Functions inherited from pyfortool.scope.ElementView
 tag (self)
 
 tail (self)
 
 text (self)
 
 findtext (self, *args, **kwargs)
 
 iterfind (self, *args, **kwargs)
 
 itertext (self, *args, **kwargs)
 
 __getitem__ (self, *args, **kwargs)
 
 __len__ (self, *args, **kwargs)
 
 __iter__ (self)
 
 find (self, *args, **kwargs)
 
 findall (self, *args, **kwargs)
 
 iter (self, *args, **kwargs)
 
 items (self, *args, **kwargs)
 
 clear (self)
 
 append (self, *args, **kwargs)
 
 extend (self, *args, **kwargs)
 
 __setitem__ (self, index, item)
 
 __delitem__ (self, index)
 
 insert (self, index, item)
 
 remove (self, node)
 
- Public Member Functions inherited from pyfortool.variables.Variables
 varList (self)
 
 attachArraySpecToEntity (self)
 
 checkImplicitNone (self, mustRaise=False)
 
 checkIntent (self, mustRaise=False)
 
 removeVar (self, varList, simplify=False)
 
 addVar (self, varList)
 
 addModuleVar (self, moduleVarList)
 
 showUnusedVar (self)
 
 removeUnusedLocalVar (self, excludeList=None, simplify=False)
 
 addExplicitArrayBounds (self, node=None)
 
 addArrayParentheses (self)
 
 addArrayParenthesesInNode (self, node)
 
 modifyAutomaticArrays (self, declTemplate=None, startTemplate=None, endTemplate=None)
 
 findIndexArrayBounds (self, arr, index, loopVar)
 
 arrayR2parensR (self, namedE, table)
 
 findArrayBounds (self, arr, loopVar, extraVarList=None)
 
 renameVar (self, oldName, newName)
 
 removeVarIfUnused (self, varList, excludeDummy=False, excludeModule=False, simplify=False)
 
 isVarUsed (self, varList, exactScope=False, dummyAreAlwaysUsed=False)
 
 addArgInTree (self, varName, declStmt, pos, stopScopes, moduleVarList=None, otherNames=None, parser=None, parserOptions=None, wrapH=False)
 
- Public Member Functions inherited from pyfortool.cosmetics.Cosmetics
 upperCase (self)
 
 lowerCase (self)
 
 indent (self, nodeToUpdate=None, indentProgramunit=0, indentBranch=2, exclDirectives=None)
 
 removeEmptyLines (self)
 
 removeComments (self, exclDirectives=None, pattern=None)
 
 updateContinuation (self, nodeToUpdate=None, align=True, removeALL=False, addBegin=True, removeBegin=False)
 
 updateSpaces (self, beforeOp=1, afterOp=1, inOperator=True, beforeComma=0, afterComma=1, beforeParenthesis=0, afterParenthesis=0, beforeAffectation=1, afterAffectation=1, inAffectation=True, beforeRangeDelim=0, afterRangeDelim=0, beforeUseDelim=0, afterUseDelim=1, beforeDeclDelim=1, afterDeclDelim=1, inDeclDelim=True, afterTypeDecl=1, beforeEqDo=0, afterEqDo=0, beforeEqCall=0, afterEqCall=0, beforeEqInit=0, afterEqInit=0, beforeEndcnt=1, afterBegincnt=1, afterIfwherecase=1, beforeThen=1, beforeIfaction=1, afterProgunit=1, endOfLine=True, afterName=0, inName=True, beforeCmdsep=0, afterCmdsep=1, adjacentKeywords=__NO_VALUE__, afterKeywords=__NO_VALUE__)
 
 changeIfStatementsInIfConstructs (self, singleItem=None)
 
 removeEmptyCONTAINS (self)
 
- Public Member Functions inherited from pyfortool.applications.Applications
 splitModuleRoutineFile (self)
 
 buildModi (self)
 
 deleteNonColumnCallsPHYEX (self, simplify=False)
 
 convertTypesInCompute (self)
 
 deleteDrHook (self, simplify=False)
 
 addDrHook (self)
 
 deleteBudgetDDH (self, simplify=False)
 
 deleteRoutineCallsMesoNHGPU (self, simplify=True)
 
 addMPPDB_CHECKS (self, printsMode=False)
 
 addStack (self, model, stopScopes, parser=None, parserOptions=None, wrapH=False)
 
 inlineContainedSubroutinesPHYEX (self, simplify=False)
 
 removeIJDim (self, stopScopes, parser=None, parserOptions=None, wrapH=False, simplify=False)
 
 removePHYEXUnusedLocalVar (self, excludeList=None, simplify=False)
 
 expandAllArraysPHYEX (self, concurrent=False)
 
 mathFunctoBRFunc (self)
 
 shumanFUNCtoCALL (self)
 
 buildACCTypeHelpers (self)
 
- Public Member Functions inherited from pyfortool.statements.Statements
 isNodeInProcedure (self, node, procList)
 
 isNodeInCall (self, node)
 
 removeCall (self, callName, simplify=False)
 
 removePrints (self, simplify=False)
 
 removeArraySyntax (self, concurrent=False, useMnhExpand=True, everywhere=True, loopVar=None, reuseLoop=True, funcList=None, updateMemSet=False, updateCopy=False, addAccIndependentCollapse=True)
 
 inlineContainedSubroutines (self, simplify=False, loopVar=None)
 
 inline (self, subContained, callStmt, mainScope, simplify=False, loopVar=None)
 
 setFalseIfStmt (self, flags, simplify=False)
 
 evalFalseIfStmt (self, nodes, simplify=False)
 
 checkOpInCall (self, mustRaise=False)
 
 insertStatement (self, stmt, first)
 
 removeStmtNode (self, nodes, simplifyVar, simplifyStruct)
 
 removeConstructNode (self, node, simplifyVar, simplifyStruct)
 
 removeFromList (self, item, itemPar)
 
- Public Member Functions inherited from pyfortool.cpp.Cpp
 applyCPPifdef (self, keys)
 
- Public Member Functions inherited from pyfortool.openacc.Openacc
 removeACC (self)
 
 removebyPassDOCONCURRENT (self)
 
 craybyPassDOCONCURRENT (self)
 
 addACCData (self)
 
 addACCRoutineSeq (self, stopScopes)
 

Static Public Member Functions

 normalizeScope (scopePath)
 
- Static Public Member Functions inherited from pyfortool.variables.Variables
 varSpec2stmt (varSpec)
 
- Static Public Member Functions inherited from pyfortool.statements.Statements
 createDoConstruct (loopVariables, indent=0, concurrent=False)
 
 insertInList (pos, item, parent)
 

Public Attributes

 tree
 
 path
 
- Public Attributes inherited from pyfortool.scope.ElementView
 text
 
 tail
 
- Public Attributes inherited from pyfortool.variables.Variables

Static Public Attributes

dict SCOPE_STMT
 
dict SCOPE_CONSTRUCT
 

Protected Member Functions

 _getNodePath (self, node)
 
- Protected Member Functions inherited from pyfortool.scope.ElementView
 _virtual (self)
 
 _getIndex (self, index)
 
- Protected Member Functions inherited from pyfortool.variables.Variables
 _normalizeScopeVar (self, scopeVarList)
 
 _normalizeUniqVar (self, scopeVarList)
 

Static Protected Member Functions

 _getNodeName (node)
 

Protected Attributes

 _mainScope
 
 _path
 
 _parentScope
 
 _cacheParent
 
- Protected Attributes inherited from pyfortool.scope.ElementView
 _excludeContains
 
 _xml
 
 _virtual
 
- Protected Attributes inherited from pyfortool.variables.Variables
 _varList
 
 _excludeContains
 

Detailed Description

This class wrapps the xml node representing a FORTRAN scope

Definition at line 199 of file scope.py.

Constructor & Destructor Documentation

◆ __init__()

pyfortool.scope.PYFTscope.__init__ (   self,
  xml,
  scopePath = '/',
  parentScope = None,
  enableCache = False,
  tree = None,
  excludeContains = False 
)
:param xml: xml corresponding to this PYFTscope
:param scopePath: scope path ('/' separated string) of this node
:param parentScope: parent PYFTscope instance
:param enableCache: True to cache node parents
:param tree: an optional Tree instance
:param excludeContains: do not take into account the CONTAINS part

Reimplemented from pyfortool.scope.ElementView.

Reimplemented in pyfortool.pyfortool.PYFT.

Definition at line 216 of file scope.py.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ __copy__()

pyfortool.scope.PYFTscope.__copy__ (   self)

Definition at line 239 of file scope.py.

◆ __deepcopy__()

pyfortool.scope.PYFTscope.__deepcopy__ (   self,
  memo 
)

Definition at line 245 of file scope.py.

◆ __getattr__()

pyfortool.scope.PYFTscope.__getattr__ (   self,
  attr 
)
Get some attributes defined in the PYFT class

Definition at line 253 of file scope.py.

◆ _getNodeName()

pyfortool.scope.PYFTscope._getNodeName (   node)
staticprotected
Internal methode to compute the name of a scope
:param node: program-unit node
:return: name

Definition at line 328 of file scope.py.

Here is the caller graph for this function:

◆ _getNodePath()

pyfortool.scope.PYFTscope._getNodePath (   self,
  node 
)
protected
Internal methode to compute a path part from a node
:param node: program-unit node
:return: path part (e.g. module:MODU)

Definition at line 347 of file scope.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ empty()

pyfortool.scope.PYFTscope.empty (   self,
  addStmt = None,
  simplify = False 
)
Empties the scope by removing all statements except dummy arguments declaration
and USE statements (because they can be useful for the dummy argument declarations).
:param addStmt: add this statement in the body of the emptied scopes
:param simplify: try to simplify code

Definition at line 490 of file scope.py.

Here is the call graph for this function:

◆ getFileName()

pyfortool.scope.PYFTscope.getFileName (   self)
:return: the name of the input file name or 'unknown' if not available
         in the xml fragment provided

Definition at line 481 of file scope.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getParent()

pyfortool.scope.PYFTscope.getParent (   self,
  item,
  level = 1 
)
:param item: item whose parent is to be searched
:param level: number of degrees (1 to get the parent, 2 to get
              the parent of the parent...)

Definition at line 283 of file scope.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getParentScopeNode()

pyfortool.scope.PYFTscope.getParentScopeNode (   self,
  item,
  mustRaise = True 
)
:param item: item whose scope parent is to be searched
:param mustRaise: True to raise an exception if parent is not found
:return: the scope parent node of item
Example: if item is a call statement, result is the program-unit node
         in which the call statement is

Definition at line 449 of file scope.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getScopeNode()

pyfortool.scope.PYFTscope.getScopeNode (   self,
  scopePath,
  excludeContains = True,
  includeItself = True 
)
:param scopePath: scope path to search for
:param excludeContains: see getScopes
:param includeItself: include itself if self represent a "valid" scope (not a file)
:return: PYFTscope whose path is the path asked for

Definition at line 423 of file scope.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getScopePath()

pyfortool.scope.PYFTscope.getScopePath (   self,
  item,
  includeItself = True 
)
:param item: item whose path must be determined
:param includeItself: include the item if it is a scope node
:return: the full path of the structure containing item

Definition at line 465 of file scope.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getScopes()

pyfortool.scope.PYFTscope.getScopes (   self,
  level = -1,
  excludeContains = True,
  excludeKinds = None,
  includeItself = True 
)
:param level: -1 to get all child scopes
              1 to get only direct child scopes
              2 to get direct and direct of direct ...
:param excludeContains: if True, each PYFTscope which is a module, function or subroutine
                        that contain (after a 'CONTAINS' statement) other subroutines or
                        functions, those contained subroutines or functions are excluded
                        from the result; but the PYFTscope contains the 'END' statement
                        of the module/subroutine or function.
:param excludeKinds: if not None, is a list of scope kinds to exclude
:param includeItself: include itself if self represent a "valid" scope (not a file)
:return: list of PYFTscope found in the current scope

Definition at line 378 of file scope.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSiblings()

pyfortool.scope.PYFTscope.getSiblings (   self,
  item,
  before = True,
  after = True 
)
:param item: item whose siblings are to be searched
:param before: returns siblings before
:param after: returns siblings after
By default before and after are True so that all siblings are returned

Definition at line 311 of file scope.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isScopeNode()

pyfortool.scope.PYFTscope.isScopeNode (   self,
  node 
)
:param node: node to test
:return: True if node is a scope node (construct node around a
         module, subroutine, function or type declaration)

Definition at line 440 of file scope.py.

Here is the caller graph for this function:

◆ mainScope()

pyfortool.scope.PYFTscope.mainScope (   self)
Return the main scope (the upper scope in the file)

Definition at line 269 of file scope.py.

Here is the caller graph for this function:

◆ normalizeScope()

pyfortool.scope.PYFTscope.normalizeScope (   scopePath)
static
Method to normalize a scope path

Definition at line 359 of file scope.py.

Here is the caller graph for this function:

◆ parentScope()

pyfortool.scope.PYFTscope.parentScope (   self)
Return the parent of the current scope

Definition at line 276 of file scope.py.

◆ path()

pyfortool.scope.PYFTscope.path (   self)
Return the current path

Reimplemented from pyfortool.variables.Variables.

Definition at line 262 of file scope.py.

Here is the caller graph for this function:

◆ showScopesList()

pyfortool.scope.PYFTscope.showScopesList (   self,
  includeItself = False 
)
Shows the list of scopes found in the source code
:param includeItself: include itself if self represent a "valid" scope (not a file)

Definition at line 368 of file scope.py.

Here is the call graph for this function:

Member Data Documentation

◆ _cacheParent

pyfortool.scope.PYFTscope._cacheParent
protected

Definition at line 231 of file scope.py.

◆ _mainScope

pyfortool.scope.PYFTscope._mainScope
protected

Definition at line 227 of file scope.py.

◆ _parentScope

pyfortool.scope.PYFTscope._parentScope
protected

Definition at line 229 of file scope.py.

◆ _path

pyfortool.scope.PYFTscope._path
protected

Definition at line 228 of file scope.py.

◆ path

pyfortool.scope.PYFTscope.path

Definition at line 420 of file scope.py.

◆ SCOPE_CONSTRUCT

dict pyfortool.scope.PYFTscope.SCOPE_CONSTRUCT
static
Initial value:
= {'module': 'program-unit',
'func': 'program-unit',
'sub': 'program-unit',
'type': 'T-construct',
'prog': 'program-unit',
'interface': 'interface-construct'}

Definition at line 209 of file scope.py.

◆ SCOPE_STMT

dict pyfortool.scope.PYFTscope.SCOPE_STMT
static
Initial value:
= {'module': 'module-stmt',
'func': 'function-stmt',
'sub': 'subroutine-stmt',
'type': 'T-stmt',
'prog': 'program-stmt',
'interface': 'interface-stmt'}

Definition at line 203 of file scope.py.

◆ tree

pyfortool.scope.PYFTscope.tree

Definition at line 230 of file scope.py.


The documentation for this class was generated from the following file: