Fixed the creation of the header define when there are characters such as dashes in the file name

This commit is contained in:
Neil Brown 2009-04-19 17:01:35 +00:00
parent a48be18109
commit b0ea943c72

View File

@ -185,7 +185,7 @@ cgenTopLevel headerName s
isBodySpec (A.Specification _ n sp)
= A.nameName n `notElem` (csOriginalTopLevelProcs cs)
tellToHeader (nameString $ A.Name emptyMeta $ dropPath headerName)
tellToHeader (mungeToC $ dropPath headerName)
$ sequence_ $ map (call genForwardDeclaration True)
(reverse $ listifyDepth isHeaderSpec s)
@ -274,6 +274,10 @@ cgenTopLevel headerName s
mungeExternalName (_:cs) = [if c == '.' then '_' else c | c <- cs]
mungeToC cs = [if c `elem` valid then c else '_' | c <- cs]
where
valid = ['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9'] ++ "_"
-- | Allocate a TLP channel handler process, and return the function that
-- implements it.
genTLPHandler :: (Maybe A.Direction, TLPChannel) -> String -> String -> String -> CGen String