ford.sourceform module#
- class ford.sourceform.ExternalBoundProcedure(name, url='', parent=None)#
Bases:
FortranBoundProcedure
- class ford.sourceform.ExternalFunction(name, url='', parent=None)#
Bases:
FortranFunction
- class ford.sourceform.ExternalInterface(name, url='', parent=None)#
Bases:
FortranInterface
- class ford.sourceform.ExternalModule(name, url='', parent=None)#
Bases:
FortranModule
- class ford.sourceform.ExternalProgram(name)#
Bases:
FortranProgram
- class ford.sourceform.ExternalSourceFile(name)#
Bases:
FortranSourceFile
- class ford.sourceform.ExternalSubmodule(name)#
Bases:
FortranSubmodule
- class ford.sourceform.ExternalSubroutine(name, url='', parent=None)#
Bases:
FortranSubroutine
- class ford.sourceform.ExternalType(name, url='', parent=None)#
Bases:
FortranType
- class ford.sourceform.ExternalVariable(name, url='', parent=None)#
Bases:
FortranVariable
- class ford.sourceform.FortranBase(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
object
An object containing the data common to all of the classes used to represent Fortran data.
- IS_SPOOF = False#
- POINTS_TO_RE = re.compile('\\s*=>\\s*', re.IGNORECASE)#
- SPLIT_RE = re.compile('\\s*,\\s*', re.IGNORECASE)#
- SRC_CAPTURE_STR = '^[ \\t]*([\\w(),*: \\t]+?[ \\t]+)?{0}([\\w(),*: \\t]+?)?[ \\t]+{1}[ \\t\\n,(].*?end[ \\t]*{0}[ \\t]+{1}[ \\t]*?(!.*?)?$'#
- base_url = ''#
- property children#
Iterator over all child entities
- filter_display(collection)#
Remove items from collection if they shouldn’t be displayed
- Return type:
- get_url()#
- iterator(*argv)#
Iterator returning any list of elements via attribute lookup in
self
This iterator retains the order of the arguments
- lines_description(total, total_all=0, obj=None)#
- make_links(project)#
Process intra-site links to documentation of other parts of the program.
- markdown(md, project)#
Process the documentation with Markdown to produce HTML.
- pretty_obj = {'blockdata': 'block data units', 'interface': 'abstract interfaces', 'module': 'modules and submodules', 'proc': 'procedures', 'program': 'programs', 'sourcefile': 'source files', 'submodule': 'modules and submodules', 'type': 'derived types'}#
- property routines#
Iterator returning all procedures
- sort_components()#
Sorts components using the method specified in the object meta/project settings
- class ford.sourceform.FortranBlockData(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranContainer
An object representing a block-data unit. Now obsolete due to modules, block data units allowed variables held in common blocks to be initialized outside of an executing program unit.
- correlate(project)#
- process_attribs()#
- prune()#
- class ford.sourceform.FortranBoundProcedure(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranBase
An object representing a type-bound procedure, possibly overloaded.
- correlate(project)#
- class ford.sourceform.FortranCodeUnit(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranContainer
A class on which programs, modules, functions, and subroutines are based.
- correlate(project)#
- process_attribs()#
Attach standalone attributes to the correct object, and compute the list of public objects
- prune()#
Remove anything which shouldn’t be displayed.
- class ford.sourceform.FortranCommon(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranBase
An object representing a common block. This is a legacy feature.
- correlate(project)#
- class ford.sourceform.FortranContainer(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranBase
A class on which any classes requiring further parsing are based.
- ARITH_GOTO_RE = re.compile('go\\s*to\\s*\\([0-9,\\s]+\\)', re.IGNORECASE)#
- ASSOCIATE_RE = re.compile('^(\\w+\\s*:)?\\s*associate\\s*\\((.+)\\)\\s*$', re.IGNORECASE)#
- ATTRIB_RE = re.compile('^(asynchronous|allocatable|bind\\s*\\(.*\\)|data|dimension|external|intent\\s*\\(\\s*\\w+\\s*\\)|optional|parameter|pointer|private|protected|public|save|target|value|volatile)(?:\\s+|\\s*::\\s*)((/|, re.IGNORECASE)#
- BLOCK_DATA_RE = re.compile('^block\\s*data\\s*(\\w+)?\\s*$', re.IGNORECASE)#
- BLOCK_RE = re.compile('^(\\w+\\s*:)?\\s*block\\s*$', re.IGNORECASE)#
- BOUNDPROC_RE = re.compile('^(?P<generic>generic|procedure)\\s* # Required keyword\n (?P<prototype>\\([^()]*\\))?\\s* # Optional interface name\n (?:,\\s*(?P<attributes>\\w[^:]*))? # Optional lis, re.IGNORECASE|re.VERBOSE)#
- CALL_RE = re.compile('(?:^|[^a-zA-Z0-9_% ]\\s*(?:\\w+%)?)(\\w+)(?=\\s*\\(\\s*(?:.*?)\\s*\\))', re.IGNORECASE)#
- COMMON_RE = re.compile('^common(?:\\s*/\\s*(\\w+)\\s*/\\s*|\\s+)(\\w+.*)', re.IGNORECASE)#
- COMMON_SPLIT_RE = re.compile('\\s*(/\\s*\\w+\\s*/)\\s*', re.IGNORECASE)#
- END_RE = re.compile('^end\\s*(?:(module|submodule|subroutine|function|procedure|program|type|interface|enum|block\\sdata|block|associate)(?:\\s+(\\w.*))?)?$', re.IGNORECASE)#
- ENUM_RE = re.compile('^enum\\s*,\\s*bind\\s*\\(.*\\)\\s*$', re.IGNORECASE)#
- FINAL_RE = re.compile('^final\\s*::\\s*(\\w.*)', re.IGNORECASE)#
- FORMAT_RE = re.compile('^[0-9]+\\s+format\\s+\\(.*\\)', re.IGNORECASE)#
- FUNCTION_RE = re.compile('^(?:(?P<attributes>.+?)\\s+)? # Optional attributes (including type)\n function\\s+(?P<name>\\w+)\\s* # Required function name\n (?P<arguments>\\([^()]*, re.IGNORECASE|re.VERBOSE)#
- INTERFACE_RE = re.compile('^(abstract\\s+)?interface(?:\\s+(.+))?$', re.IGNORECASE)#
- MODPROC_RE = re.compile('^(module\\s+)?procedure\\s*(?:::|\\s)\\s*(\\w.*)$', re.IGNORECASE)#
- MODULE_RE = re.compile('^module(?:\\s+(\\w+))?$', re.IGNORECASE)#
- PROGRAM_RE = re.compile('^program(?:\\s+(\\w+))?$', re.IGNORECASE)#
- SUBCALL_RE = re.compile('^(?:if\\s*\\(.*\\)\\s*)?call\\s+(?:\\w+%)?(\\w+)\\s*(?:\\(\\s*(.*?)\\s*\\))?$', re.IGNORECASE)#
- SUBMODULE_RE = re.compile("^submodule\\s*\n \\(\\s*(?P<ancestor_module>\\w+)\\s* # Non-optional ancestor module\n (?::\\s*(?P<parent_submod>\\w+))?\\s*\\) # Optional parent submodule\n \\s*(?P<nam, re.IGNORECASE|re.VERBOSE)#
- SUBROUTINE_RE = re.compile('^\\s*(?:(?P<attributes>.+?)\\s+)? # Optional attributes\n subroutine\\s+(?P<name>\\w+)\\s* # Required subroutine name\n (?P<arguments>\\([^()]*\\))? # Optiona, re.IGNORECASE|re.VERBOSE)#
- TYPE_RE = re.compile('^type(?:\\s+|\\s*(,.*)?::\\s*)((?!(?:is\\s*\\())\\w+)\\s*(\\([^()]*\\))?\\s*$', re.IGNORECASE)#
- USE_RE = re.compile('^use(?:\\s*(?:,\\s*(?:non_)?intrinsic\\s*)?::\\s*|\\s+)(\\w+)\\s*($|,.*)', re.IGNORECASE)#
- VARIABLE_STRING = '^(integer|real|double\\s*precision|character|complex|double\\s*complex|logical|type(?!\\s+is)|class(?!\\s+is|\\s+default)|procedure|enumerator{})\\s*((?:\\(|\\s\\w|[:,*]).*)$'#
- class ford.sourceform.FortranEnum(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranContainer
An object representing a Fortran enumeration. Contains the individual enumerators as variables.
- class ford.sourceform.FortranFinalProc(name, parent, source=None)#
Bases:
FortranBase
An object representing a finalization procedure for a derived type within Fortran.
- correlate(project)#
- class ford.sourceform.FortranFunction(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranProcedure
An object representing a Fortran function and holding all of said function’s contents.
- class ford.sourceform.FortranInterface(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranContainer
An interface block, including generic and abstract interfaces
- correlate(project)#
- class ford.sourceform.FortranModule(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranCodeUnit
An object representing individual modules within your source code. These objects contains lists of all of the module’s contents, as well as its dependencies.
- ONLY_RE = re.compile('^\\s*,\\s*only\\s*:\\s*(?=[^,])', re.IGNORECASE)#
- RENAME_RE = re.compile('(\\w+)\\s*=>\\s*(\\w+)', re.IGNORECASE)#
- get_used_entities(use_specs)#
Returns the entities which are imported by a use statement. These are contained in dicts.
- class ford.sourceform.FortranModuleProcedure(name, parent=None, inherited_permission=None)#
Bases:
FortranBase
An object representing a module procedure in an interface. Not to be confused with type of module procedure which is the implementation of a module function or module subroutine in a submodule.
- class ford.sourceform.FortranProcedure(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranCodeUnit
Base class for subroutines and functions for common functionality
- property permission#
Permission (public/private) of this procedure
- class ford.sourceform.FortranProgram(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranCodeUnit
An object representing the main Fortran program.
- class ford.sourceform.FortranSourceFile(filepath, settings, preprocessor=None, fixed=False, **kwargs)#
Bases:
FortranContainer
An object representing individual files containing Fortran code. A project will consist of a list of these objects. In turn, SourceFile objects will contains lists of all of that file’s contents
- class ford.sourceform.FortranSpoof(name, parent=None, obj='ITEM')#
Bases:
object
A dummy-type which is used to represent arguments, interfaces, type-bound procedures, etc. which lack a corresponding variable or implementation.
- IS_SPOOF = True#
- class ford.sourceform.FortranSubmodule(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranModule
- get_dir()#
- class ford.sourceform.FortranSubmoduleProcedure(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranCodeUnit
An object representing a the implementation of a Module Function or Module Subroutine in a submodule.
- module = True#
- class ford.sourceform.FortranSubroutine(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranProcedure
An object representing a Fortran subroutine and holding all of said subroutine’s contents.
- class ford.sourceform.FortranType(source, first_line, parent=None, inherited_permission='public', strings=[])#
Bases:
FortranContainer
An object representing a Fortran derived type and holding all of said type’s components and type-bound procedures. It also contains information on the type’s inheritance.
- correlate(project)#
- prune()#
Remove anything which shouldn’t be displayed.
- class ford.sourceform.FortranVariable(name, vartype, parent, attribs=[], intent='', optional=False, permission='public', parameter=False, kind=None, strlen=None, proto=None, doc=None, points=False, initial=None)#
Bases:
FortranBase
An object representing a variable within Fortran.
- correlate(project)#
- property full_declaration#
Return the full type declaration, including attributes, dimensions, kind, and so on
- property full_type#
Return the full type, including class, kind, len, and so on
- class ford.sourceform.GenericSource(filename, settings)#
Bases:
FortranBase
Represent a non-Fortran source file. The contents of the file will not be analyzed, but documentation can be extracted.
- lines_description(total, total_all=0)#
- class ford.sourceform.NameSelector#
Bases:
object
Object which tracks what names have been provided for different entities in Fortran code. It will provide an identifier which is guaranteed to be unique. This identifier can then me used as a filename for the documentation of that entity.
- get_name(item)#
Return the name for this item registered with this NameSelector. If no name has previously been registered, then generate a new one.
- ford.sourceform.get_mod_procs(source, line, parent)#
- ford.sourceform.line_to_variables(source, line, inherit_permission, parent)#
Returns a list of variables declared in the provided line of code. The line of code should be provided as a string.
- ford.sourceform.parse_type(string, capture_strings, extra_vartypes)#
Gets variable type, kind, length, and/or derived-type attributes from a variable declaration.
- Return type:
- ford.sourceform.remove_kind_suffix(literal, is_character=False)#
Return the literal without the kind suffix of a numerical literal, or the kind prefix of a character literal
- ford.sourceform.set_base_url(url)#