tools/pas2c/Pas2C.hs
changeset 15893 9cd8d7748199
parent 15776 aa011799cb63
child 15894 c09063ea0267
equal deleted inserted replaced
15892:f550a79274fa 15893:9cd8d7748199
   709                   (Identifier "LongWord" _) -> return $ text "4294967295"
   709                   (Identifier "LongWord" _) -> return $ text "4294967295"
   710                   _ -> error $ "BuiltInFunction 'high' in initExpr: " ++ show e'
   710                   _ -> error $ "BuiltInFunction 'high' in initExpr: " ++ show e'
   711          a -> error $ "BuiltInFunction 'high' in initExpr: " ++ show a ++ ": " ++ show hi
   711          a -> error $ "BuiltInFunction 'high' in initExpr: " ++ show a ++ ": " ++ show hi
   712 initExpr2C' (BuiltInFunction "succ" [BuiltInFunction "pred" [e]]) = initExpr2C' e
   712 initExpr2C' (BuiltInFunction "succ" [BuiltInFunction "pred" [e]]) = initExpr2C' e
   713 initExpr2C' (BuiltInFunction "pred" [BuiltInFunction "succ" [e]]) = initExpr2C' e
   713 initExpr2C' (BuiltInFunction "pred" [BuiltInFunction "succ" [e]]) = initExpr2C' e
   714 initExpr2C' (BuiltInFunction "succ" [e]) = liftM (<> text " + 1") $ initExpr2C' e
   714 initExpr2C' (BuiltInFunction "succ" [e]) = liftM (\e' ->  text "(" <> e' <> text " + 1)") $ initExpr2C' e
   715 initExpr2C' (BuiltInFunction "pred" [e]) = liftM (<> text " - 1") $ initExpr2C' e
   715 initExpr2C' (BuiltInFunction "pred" [e]) = liftM (\e' ->  text "(" <> e' <> text " - 1)") $ initExpr2C' e
   716 initExpr2C' b@(BuiltInFunction _ _) = error $ show b
   716 initExpr2C' b@(BuiltInFunction _ _) = error $ show b
   717 initExpr2C' (InitTypeCast t' i) = do
   717 initExpr2C' (InitTypeCast t' i) = do
   718     e <- initExpr2C i
   718     e <- initExpr2C i
   719     t <- id2C IOLookup t'
   719     t <- id2C IOLookup t'
   720     return . parens $ parens t <> e
   720     return . parens $ parens t <> e