# HG changeset patch # User Wuzzy # Date 1538767806 -7200 # Node ID aba78789f0bfb87c2682757eab130d70a9725fb7 # Parent 84b2191efde9f21dfde93e96ace2f96e0e261215# Parent 885ee14fe640dab3426ce012611543aba74b010e Merge unC0Rr's pas2c fix diff -r 84b2191efde9 -r aba78789f0bf tools/pas2c/Pas2C.hs --- a/tools/pas2c/Pas2C.hs Fri Oct 05 21:04:19 2018 +0200 +++ b/tools/pas2c/Pas2C.hs Fri Oct 05 21:30:06 2018 +0200 @@ -698,12 +698,16 @@ (Identifier "LongInt" _) -> int (-2^31) (Identifier "SmallInt" _) -> int (-2^15) _ -> error $ "BuiltInFunction 'low': " ++ show e -initExpr2C' (BuiltInFunction "high" [e]) = do +initExpr2C' hi@(BuiltInFunction "high" [e@(InitReference e')]) = do void $ initExpr2C e t <- gets lastType case t of (BTArray i _ _) -> initExpr2C' $ BuiltInFunction "pred" [InitRange i] - a -> error $ "BuiltInFunction 'high': " ++ show a + BTInt _ -> case e' of + (Identifier "LongInt" _) -> return $ int (2147483647) + (Identifier "LongWord" _) -> return $ text "4294967295" + _ -> error $ "BuiltInFunction 'high' in initExpr: " ++ show e' + a -> error $ "BuiltInFunction 'high' in initExpr: " ++ show a ++ ": " ++ show hi initExpr2C' (BuiltInFunction "succ" [BuiltInFunction "pred" [e]]) = initExpr2C' e initExpr2C' (BuiltInFunction "pred" [BuiltInFunction "succ" [e]]) = initExpr2C' e initExpr2C' (BuiltInFunction "succ" [e]) = liftM (<> text " + 1") $ initExpr2C' e