fab.parse.c module#

C language handling classes.

class fab.parse.c.AnalysedC(fpath, file_hash=None, symbol_defs=None, symbol_deps=None, file_deps=None)#

Bases: AnalysedDependent

An analysis result for a single C file, containing symbol definitions and dependencies.

Note: We don’t need to worry about compile order with pure C projects; we can compile all in one go.

However, with a Fortran -> C -> Fortran dependency chain, we do need to ensure that one Fortran file is compiled before another, so this class must be part of the dependency tree analysis.

Parameters:
  • fpath (Union[str, Path]) – The source file that was analysed.

  • file_hash (Optional[int]) – The hash of the source. If omitted, Fab will evaluate lazily. (default: None)

  • symbol_defs (Optional[Iterable[str]]) – Set of symbol names defined by this source file. (default: None)

  • symbol_deps (Optional[Iterable[str]]) – Set of symbol names used by this source file. Can include symbols in the same file. (default: None)

  • file_deps (Optional[Iterable[Path]]) – Other files on which this source depends. Must not include itself. This attribute is calculated during symbol analysis, after everything has been parsed. (default: None)

class fab.parse.c.CAnalyser#

Bases: object

Identify symbol definitions and dependencies in a C file.

run(fpath)#
Return type:

Union[Tuple[AnalysedC, Path], Tuple[Exception, None]]