Fixed operators not being written correctly to include files

This commit is contained in:
Neil Brown 2009-04-10 18:26:39 +00:00
parent ce0214cbf4
commit 09ea5fd610

View File

@ -84,7 +84,7 @@ writeIncFile = occamOnlyPass "Write .inc file" [] []
thisProc <- sequence ( thisProc <- sequence (
[return $ "#PRAGMA TOCKEXTERNAL \"" [return $ "#PRAGMA TOCKEXTERNAL \""
] ++ intersperse (return ",") (map showCode ts) ++ ] ++ intersperse (return ",") (map showCode ts) ++
[return $ " FUNCTION " ++ origN ++ "(" [return $ " FUNCTION " ++ showFuncName origN ++ "("
] ++ intersperse (return ",") (map showCode fs) ++ ] ++ intersperse (return ",") (map showCode fs) ++
[return $ ") = " ++ nameString n ++ "\"" [return $ ") = " ++ nameString n ++ "\""
]) >>* concat ]) >>* concat
@ -98,6 +98,11 @@ writeIncFile = occamOnlyPass "Write .inc file" [] []
emitProcsAsExternal (A.Several _ ss) emitProcsAsExternal (A.Several _ ss)
= foldl (liftM2 (Seq.><)) (return Seq.empty) (map emitProcsAsExternal ss) = foldl (liftM2 (Seq.><)) (return Seq.empty) (map emitProcsAsExternal ss)
showFuncName :: String -> String
showFuncName s | isOperator s = "\"" ++ doubleStars s ++ "\""
| otherwise = s
where
doubleStars cs = concat [if c == '*' then "**" else [c] | c <- cs]
-- | Fixed the types of array constructors according to the replicator count -- | Fixed the types of array constructors according to the replicator count
fixConstructorTypes :: Pass fixConstructorTypes :: Pass