From 09ea5fd610f408236ce011ee9bc17e644a1e3daa Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 10 Apr 2009 18:26:39 +0000 Subject: [PATCH] Fixed operators not being written correctly to include files --- frontends/OccamPasses.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontends/OccamPasses.hs b/frontends/OccamPasses.hs index fde9c27..812459b 100644 --- a/frontends/OccamPasses.hs +++ b/frontends/OccamPasses.hs @@ -84,7 +84,7 @@ writeIncFile = occamOnlyPass "Write .inc file" [] [] thisProc <- sequence ( [return $ "#PRAGMA TOCKEXTERNAL \"" ] ++ intersperse (return ",") (map showCode ts) ++ - [return $ " FUNCTION " ++ origN ++ "(" + [return $ " FUNCTION " ++ showFuncName origN ++ "(" ] ++ intersperse (return ",") (map showCode fs) ++ [return $ ") = " ++ nameString n ++ "\"" ]) >>* concat @@ -98,6 +98,11 @@ writeIncFile = occamOnlyPass "Write .inc file" [] [] emitProcsAsExternal (A.Several _ 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 fixConstructorTypes :: Pass