Hcy2c-0.1.1.0: Generate C code for cycle algorithms

Safe HaskellNone
LanguageHaskell2010

Cycles.IO

Synopsis

Documentation

removeIfExists :: FilePath -> IO ()

This function allows one to remove a file with included exception handling

removeDirIfExists :: FilePath -> IO ()

Like removeIfExists, this function allows one to remove a file with included exception handling

putStrLongLn :: String -> IO ()

This function only prints a line when its length is > 2. It's useful, because without it, many of these function print blank lines when there are no compile/run errors.

readInt :: String -> Int

Note: the string is presumed to be in little endian order

readIntList' :: String -> String -> [Int]

Note: numStr is in little endian order

ifElseError :: Bool -> t -> t

This allows one to easily use monadic values for if-then

graphToNumCycles :: [[Int]] -> Bool -> IO Int

This function takes a graph and whether it is a digraph and returns the number of directed cycles in it

processCycles :: String -> [[Int]] -> [[Int]]

This function takes an output from the FindCy C code, performs a basic check ('is there a "done" mark?'), makes sure the output agrees with the expected graph, and reads the cycles into an [Int]

graphToCycles :: [[Int]] -> Bool -> IO [[Int]]

This function takes a graph and whether it is a digraph and returns a list of all directed cycles (somewhat slow, because it uses Haskell's read function)

graphToMaxcyCode :: [[Int]] -> Int -> String -> String -> IO String

This function takes a graph and automatically finds all cycles to output a string containing the C code to compute its maximally cyclic orientations

compileAllInDir :: String -> IO ()

This function does exactly what it says, for '.c' files

runAllInDir :: String -> IO ()

This function runs all the files in a given directory, ascertained by those filenames that do not include a .