equal
deleted
inserted
replaced
745 BTArray (RangeFromTo _ n) _ _ -> initExpr2C n |
745 BTArray (RangeFromTo _ n) _ _ -> initExpr2C n |
746 _ -> error $ "BuiltInFunCall 'high' from " ++ show e ++ "\ntype: " ++ show lt |
746 _ -> error $ "BuiltInFunCall 'high' from " ++ show e ++ "\ntype: " ++ show lt |
747 expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "ord" _))) = liftM parens $ expr2C e |
747 expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "ord" _))) = liftM parens $ expr2C e |
748 expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "succ" _))) = liftM (<> text " + 1") $ expr2C e |
748 expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "succ" _))) = liftM (<> text " + 1") $ expr2C e |
749 expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "pred" _))) = liftM (<> text " - 1") $ expr2C e |
749 expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "pred" _))) = liftM (<> text " - 1") $ expr2C e |
|
750 expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "length" _))) = do |
|
751 e' <- expr2C e |
|
752 lt <- gets lastType |
|
753 case lt of |
|
754 BTString -> return $ text "length" <> parens e' |
|
755 BTArray {} -> return $ text "length_ar" <> parens e' |
|
756 _ -> error $ "length() called on " ++ show lt |
750 expr2C (BuiltInFunCall params ref) = do |
757 expr2C (BuiltInFunCall params ref) = do |
751 r <- ref2C ref |
758 r <- ref2C ref |
752 t <- gets lastType |
759 t <- gets lastType |
753 ps <- mapM expr2C params |
760 ps <- mapM expr2C params |
754 case t of |
761 case t of |