Safe Haskell | None |
---|---|
Language | Haskell2010 |
Format of Camfort precompiled files with information about Fortran
modules. The ModuleMap
stores information important to the
renamer. The other data is up to you.
One typical usage might look like:
let modFile1 = genModFile programFile let modFile2 = alterModFileData (const (Just ...)) "mydata" modFile1 let bytes = encodeModFile modFile1 ... case decodeModFile bytes of Left error -> print error Right modFile3 -> ... where moduleMap = combinedModuleMap (modFile3:otherModuleFiles) myData = lookupModFileData "mydata" modFile3 renamedPF = analyseRenamesWithModuleMap moduleMap programFile
- modFileSuffix :: String
- data ModFile
- type ModFiles = [ModFile]
- emptyModFile :: ModFile
- emptyModFiles :: ModFiles
- lookupModFileData :: String -> ModFile -> Maybe ByteString
- getLabelsModFileData :: ModFile -> [String]
- alterModFileData :: (Maybe ByteString -> Maybe ByteString) -> String -> ModFile -> ModFile
- genModFile :: forall a. Data a => ProgramFile (Analysis a) -> ModFile
- regenModFile :: forall a. Data a => ProgramFile (Analysis a) -> ModFile -> ModFile
- encodeModFile :: ModFile -> ByteString
- decodeModFile :: Binary a => ByteString -> Either String a
- type DeclMap = Map Name (DeclContext, SrcSpan)
- data DeclContext
- extractModuleMap :: forall a. Data a => ProgramFile (Analysis a) -> ModuleMap
- extractDeclMap :: forall a. Data a => ProgramFile (Analysis a) -> DeclMap
- moduleFilename :: ModFile -> String
- combinedDeclMap :: ModFiles -> DeclMap
- combinedModuleMap :: ModFiles -> ModuleMap
- combinedTypeEnv :: ModFiles -> TypeEnv
- genUniqNameToFilenameMap :: ModFiles -> Map Name String
Documentation
modFileSuffix :: String Source #
Standard ending of fortran-src-format "mod files"
The data stored in the "mod files"
emptyModFile :: ModFile Source #
Starting point.
emptyModFiles :: ModFiles Source #
Empty set of mod files. (future proof: may not always be a list)
lookupModFileData :: String -> ModFile -> Maybe ByteString Source #
Looks up the raw "other data" that may be stored in a ModFile by applications that make use of fortran-src.
getLabelsModFileData :: ModFile -> [String] Source #
Get a list of the labels present in the "other data" of a ModFile. More of a meta-programming / debugging feature.
alterModFileData :: (Maybe ByteString -> Maybe ByteString) -> String -> ModFile -> ModFile Source #
Allows modificationinsertiondeletion of "other data" that may
be stored in a ModFile by applications that make use of
fortran-src. See alter
for more information about
the interface of this function.
genModFile :: forall a. Data a => ProgramFile (Analysis a) -> ModFile Source #
Generate a fresh ModFile from the module map, declaration map and type analysis of a given analysed and renamed ProgramFile.
regenModFile :: forall a. Data a => ProgramFile (Analysis a) -> ModFile -> ModFile Source #
Extracts the module map, declaration map and type analysis from an analysed and renamed ProgramFile, then inserts it into the ModFile.
encodeModFile :: ModFile -> ByteString Source #
Convert ModFile to a strict ByteString for writing to file.
decodeModFile :: Binary a => ByteString -> Either String a Source #
Convert a strict ByteString to a ModFile, if possible
type DeclMap = Map Name (DeclContext, SrcSpan) Source #
Map of unique variable name to the unique name of the program unit where it was defined, and the corresponding SrcSpan.
data DeclContext Source #
Context of a declaration: the ProgramUnit where it was declared.
extractModuleMap :: forall a. Data a => ProgramFile (Analysis a) -> ModuleMap Source #
extractDeclMap :: forall a. Data a => ProgramFile (Analysis a) -> DeclMap Source #
moduleFilename :: ModFile -> String Source #
Get the associated Fortran filename that was used to compile the ModFile.
combinedDeclMap :: ModFiles -> DeclMap Source #
Extract the combined declaration map from a set of ModFiles. Useful for parsing a Fortran file in a large context of other modules.
combinedModuleMap :: ModFiles -> ModuleMap Source #
Extract the combined module map from a set of ModFiles. Useful for parsing a Fortran file in a large context of other modules.
combinedTypeEnv :: ModFiles -> TypeEnv Source #
Extract the combined module map from a set of ModFiles. Useful for parsing a Fortran file in a large context of other modules.