Reference Guide  2.5.0
psyclone.f2pygen.SubroutineGen Class Reference
Inheritance diagram for psyclone.f2pygen.SubroutineGen:
Collaboration diagram for psyclone.f2pygen.SubroutineGen:

Public Member Functions

def __init__ (self, parent, name="", args=None, implicitnone=False)
 
def args (self)
 
def args (self, namelist)
 
- Public Member Functions inherited from psyclone.f2pygen.ProgUnitGen
def __init__ (self, parent, sub)
 
def add (self, content, position=None, bubble_up=False)
 
- Public Member Functions inherited from psyclone.f2pygen.BaseGen
def parent (self)
 
def children (self)
 
def root (self)
 
def add (self, new_object, position=None)
 
def previous_loop (self)
 
def last_declaration (self)
 
def start_parent_loop (self, debug=False)
 

Detailed Description

 Generate a Fortran subroutine 

Definition at line 706 of file f2pygen.py.

Constructor & Destructor Documentation

◆ __init__()

def psyclone.f2pygen.SubroutineGen.__init__ (   self,
  parent,
  name = "",
  args = None,
  implicitnone = False 
)
:param parent: node in AST to which to add Subroutine as a child
:type parent: :py:class:`psyclone.f2pygen.BaseGen`
:param str name: name of the Fortran subroutine
:param list args: list of arguments accepted by the subroutine
:param bool implicitnone: whether or not we should specify
                          "implicit none" for the body of this
                          subroutine

Definition at line 708 of file f2pygen.py.

708  def __init__(self, parent, name="", args=None, implicitnone=False):
709  '''
710  :param parent: node in AST to which to add Subroutine as a child
711  :type parent: :py:class:`psyclone.f2pygen.BaseGen`
712  :param str name: name of the Fortran subroutine
713  :param list args: list of arguments accepted by the subroutine
714  :param bool implicitnone: whether or not we should specify
715  "implicit none" for the body of this
716  subroutine
717  '''
718  reader = FortranStringReader(
719  "subroutine vanilla(vanilla_arg)\nend subroutine")
720  reader.set_format(FortranFormat(True, True)) # free form, strict
721  subline = reader.next()
722  endsubline = reader.next()
723 
724  from fparser.one.block_statements import Subroutine, EndSubroutine
725  self._sub = Subroutine(parent.root, subline)
726  self._sub.name = name
727  if args is None:
728  args = []
729  self._sub.args = args
730  endsub = EndSubroutine(self._sub, endsubline)
731  self._sub.content.append(endsub)
732  ProgUnitGen.__init__(self, parent, self._sub)
733  if implicitnone:
734  self.add(ImplicitNoneGen(self))
735 

References psyclone.f2pygen.SubroutineGen._sub, psyclone.f2pygen.IfThenGen.add(), psyclone.f2pygen.ProgUnitGen.add(), psyclone.f2pygen.DoGen.add(), psyclone.psyir.symbols.datatypes.StructureType.add(), psyclone.f2pygen.BaseGen.add(), and psyclone.psyir.symbols.symbol_table.SymbolTable.add().

Here is the call graph for this function:

Member Function Documentation

◆ args() [1/2]

def psyclone.f2pygen.SubroutineGen.args (   self)
 Returns the list of arguments of this subroutine 

Definition at line 737 of file f2pygen.py.

737  def args(self):
738  ''' Returns the list of arguments of this subroutine '''
739  return self._sub.args
740 

References psyclone.f2pygen.SubroutineGen._sub.

Here is the caller graph for this function:

◆ args() [2/2]

def psyclone.f2pygen.SubroutineGen.args (   self,
  namelist 
)
 sets the subroutine arguments to the values in the list provide.

Definition at line 742 of file f2pygen.py.

742  def args(self, namelist):
743  ''' sets the subroutine arguments to the values in the list provide.'''
744  self._sub.args = namelist
745 
746 

References psyclone.f2pygen.SubroutineGen._sub, and psyclone.f2pygen.SubroutineGen.args().

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

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