How to use the ford.sourceform.FortranProgram function in FORD

To help you get started, we’ve selected a few FORD examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Fortran-FOSS-Programmers / ford / ford / graphs.py View on Github external
def is_program(obj, cls):
    return isinstance(obj,FortranProgram) or issubclass(cls,FortranProgram)
github Fortran-FOSS-Programmers / ford / ford / sourceform.py View on Github external
def get_dir(self):
        if ( type(self) in [FortranSubroutine,FortranFunction] and
             type(self.parent) is FortranInterface and
             not self.parent.generic ):
            return 'interface'
        elif type(self) is FortranSubmodule:
            return 'module'
        elif ( type(self) in [FortranSourceFile,FortranProgram,FortranModule,
                              GenericSource,FortranBlockData]
               or ( type(self) in [FortranType,FortranInterface,FortranFunction,
                                   FortranSubroutine, FortranSubmoduleProcedure]
                    and type(self.parent) in [FortranSourceFile,FortranProgram,
                                              FortranModule, FortranSubmodule,
                                              FortranBlockData] ) ):
            return self.obj
        else:
            return None
github Fortran-FOSS-Programmers / ford / ford / graphs.py View on Github external
dot.node('Type',**gd.get_node('Type',cls=FortranType).attribs)
    dot.node('This Page\'s Entity')
    type_svg = dot.pipe().decode('utf-8')

    # Generate key for call graph
    dot = Digraph('Graph Key',graph_attr={'size':'8.90625,1000.0',
                                          'concentrate':'false'},
                              node_attr={'shape':'box',
                                         'height':'0.0',
                                         'margin':'0.08',
                                         'fontname':'Helvetica',
                                         'fontsize':'10.5'},
                              edge_attr={'fontname':'Helvetica',
                                         'fontsize':'9.5'},
                              format='svg', engine='dot')
    for n in [(sub,FortranSubroutine),(func,FortranFunction),(intr, FortranInterface),('Unknown Procedure Type',FortranFunction),('Program', FortranProgram)]:
        dot.node(getattr(n[0],'name',n[0]),**gd.get_node(n[0],cls=n[1]).attribs)
    dot.node('This Page\'s Entity')
    call_svg = dot.pipe().decode('utf-8')

    # Generate key for file graph
    dot = Digraph('Graph Key',graph_attr={'size':'8.90625,1000.0',
                                          'concentrate':'false'},
                              node_attr={'shape':'box',
                                         'height':'0.0',
                                         'margin':'0.08',
                                         'fontname':'Helvetica',
                                         'fontsize':'10.5'},
                              edge_attr={'fontname':'Helvetica',
                                         'fontsize':'9.5'},
                              format='svg', engine='dot')
    dot.node('Source File',**gd.get_node('Source File',cls=FortranSourceFile).attribs)
github Fortran-FOSS-Programmers / ford / ford / graphmanager.py View on Github external
def graph_all(self):
        for obj in tqdm(iter(self.graph_objs), file=sys.stdout, total=len(self.graph_objs), unit=''):
            if isinstance(obj,FortranModule):
                obj.usesgraph = ford.graphs.UsesGraph(obj,self.webdir)
                obj.usedbygraph = ford.graphs.UsedByGraph(obj,self.webdir)
                self.modules.add(obj)
            elif isinstance(obj,FortranType):
                obj.inhergraph = ford.graphs.InheritsGraph(obj,self.webdir)
                obj.inherbygraph = ford.graphs.InheritedByGraph(obj,self.webdir)
                self.types.add(obj)
            elif isinstance(obj,(FortranFunction,FortranSubroutine,FortranInterface,FortranSubmoduleProcedure)):
                obj.callsgraph = ford.graphs.CallsGraph(obj,self.webdir)
                obj.calledbygraph = ford.graphs.CalledByGraph(obj,self.webdir)
                obj.usesgraph = ford.graphs.UsesGraph(obj,self.webdir)
                self.procedures.add(obj)
            elif isinstance(obj,FortranProgram):
                obj.usesgraph = ford.graphs.UsesGraph(obj,self.webdir)
                obj.callsgraph = ford.graphs.CallsGraph(obj,self.webdir)
                self.programs.add(obj)
            elif isinstance(obj,FortranSourceFile):
                obj.afferentgraph = ford.graphs.AfferentGraph(obj,self.webdir)
                obj.efferentgraph = ford.graphs.EfferentGraph(obj,self.webdir)
                self.sourcefiles.add(obj)
            elif isinstance(obj,FortranBlockData):
                obj.usesgraph = ford.graphs.UsesGraph(obj,self.webdir)
                self.blockdata.add(obj)
        usenodes = list(self.modules)
        callnodes = list(self.procedures)
        for p in self.programs:
            if len(p.usesgraph.added) > 1: usenodes.append(p)
            if len(p.callsgraph.added) > 1: callnodes.append(p)
        for p in self.procedures:
github Fortran-FOSS-Programmers / ford / ford / sourceform.py View on Github external
def get_dir(self):
        if ( type(self) in [FortranSubroutine,FortranFunction] and
             type(self.parent) is FortranInterface and
             not self.parent.generic ):
            return 'interface'
        elif type(self) is FortranSubmodule:
            return 'module'
        elif ( type(self) in [FortranSourceFile,FortranProgram,FortranModule,
                              GenericSource,FortranBlockData]
               or ( type(self) in [FortranType,FortranInterface,FortranFunction,
                                   FortranSubroutine, FortranSubmoduleProcedure]
                    and type(self.parent) in [FortranSourceFile,FortranProgram,
                                              FortranModule, FortranSubmodule,
                                              FortranBlockData] ) ):
            return self.obj
        else:
            return None
github Fortran-FOSS-Programmers / ford / ford / sourceform.py View on Github external
if hasattr(self,'modules'):
                    self.modules.append(FortranModule(source,
                                        self.MODULE_RE.match(line),self))
                    self.num_lines += self.modules[-1].num_lines - 1
                else:
                    raise Exception("Found MODULE in {}".format(type(self).__name__[7:].upper()))
            elif self.SUBMODULE_RE.match(line):
                if hasattr(self,'submodules'):
                    self.submodules.append(FortranSubmodule(source,
                                           self.SUBMODULE_RE.match(line),self))
                    self.num_lines += self.submodules[-1].num_lines - 1
                else:
                    raise Exception("Found SUBMODULE in {}".format(type(self).__name__[7:].upper()))
            elif self.PROGRAM_RE.match(line):
                if hasattr(self,'programs'):
                    self.programs.append(FortranProgram(source,
                                         self.PROGRAM_RE.match(line),self))
                    self.num_lines += self.programs[-1].num_lines - 1
                else:
                    raise Exception("Found PROGRAM in {}".format(type(self).__name__[7:].upper()))
                if len(self.programs) > 1:
                    raise Exception("Multiple PROGRAM units in same source file.")
            elif self.SUBROUTINE_RE.match(line):
                if isinstance(self,FortranCodeUnit) and not incontains: continue
                if hasattr(self,'subroutines'):
                    self.subroutines.append(FortranSubroutine(source,
                                            self.SUBROUTINE_RE.match(line),self,
                                            permission))
                    self.num_lines += self.subroutines[-1].num_lines - 1
                else:
                    raise Exception("Found SUBROUTINE in {}".format(type(self).__name__[7:].upper()))
            elif self.FUNCTION_RE.match(line):
github Fortran-FOSS-Programmers / ford / ford / graphs.py View on Github external
def get_url(self):
        return ''
    def get_dir(self):
        return ''
    
sub = Proc('Subroutine','Subroutine')
func = Proc('Function','Function')
intr = Proc('Interface','Interface')
gd.register('Module',FortranModule)
gd.register('Submodule',FortranSubmodule)
gd.register('Type',FortranType)
gd.register(sub,FortranSubroutine)
gd.register(func,FortranFunction)
gd.register(intr,FortranInterface)
gd.register('Unknown Procedure Type',FortranSubroutine)
gd.register('Program',FortranProgram)
gd.register('Source File',FortranSourceFile)

try:
    # Generate key for module graph
    dot = Digraph('Graph Key',graph_attr={'size':'8.90625,1000.0',
                                          'concentrate':'false'},
                              node_attr={'shape':'box',
                                         'height':'0.0',
                                         'margin':'0.08',
                                         'fontname':'Helvetica',
                                         'fontsize':'10.5'},
                              edge_attr={'fontname':'Helvetica',
                                         'fontsize':'9.5'},
                              format='svg', engine='dot')
    for n in [('Module',FortranModule),('Submodule',FortranSubmodule),(sub,FortranSubroutine),(func,FortranFunction),('Program', FortranProgram)]:
        dot.node(getattr(n[0],'name',n[0]),**gd.get_node(n[0],cls=n[1]).attribs)
github Fortran-FOSS-Programmers / ford / ford / sourceform.py View on Github external
if hasattr(self,'modules'):
                    self.modules.append(FortranModule(source,
                                        self.MODULE_RE.match(line),self))
                    self.num_lines += self.modules[-1].num_lines - 1
                else:
                    raise Exception("Found MODULE in {}".format(type(self).__name__[7:].upper()))
            elif self.SUBMODULE_RE.match(line):
                if hasattr(self,'submodules'):
                    self.submodules.append(FortranSubmodule(source,
                                           self.SUBMODULE_RE.match(line),self))
                    self.num_lines += self.submodules[-1].num_lines - 1
                else:
                    raise Exception("Found SUBMODULE in {}".format(type(self).__name__[7:].upper()))
            elif self.PROGRAM_RE.match(line):
                if hasattr(self,'programs'):
                    self.programs.append(FortranProgram(source,
                                         self.PROGRAM_RE.match(line),self))
                    self.num_lines += self.programs[-1].num_lines - 1
                else:
                    raise Exception("Found PROGRAM in {}".format(type(self).__name__[7:].upper()))
                if len(self.programs) > 1:
                    raise Exception("Multiple PROGRAM units in same source file.")
            elif self.SUBROUTINE_RE.match(line):
                if isinstance(self,FortranCodeUnit) and not incontains: continue
                if hasattr(self,'subroutines'):
                    self.subroutines.append(FortranSubroutine(source,
                                            self.SUBROUTINE_RE.match(line),self,
                                            permission))
                    self.num_lines += self.subroutines[-1].num_lines - 1
                else:
                    raise Exception("Found SUBROUTINE in {}".format(type(self).__name__[7:].upper()))
            elif self.FUNCTION_RE.match(line):