summaryrefslogtreecommitdiff
path: root/src/compiler/GFI.hs
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2011-09-22 12:11:03 +0000
committeraarne <aarne@chalmers.se>2011-09-22 12:11:03 +0000
commit6db0c74c2f120c829e666879b39f57afe1ed3318 (patch)
treef4e9846a63fe6630091ac11d1e6bf29b01b3815d /src/compiler/GFI.hs
parentbaa9bcd9d072277261d0bf85c9623a0db9e8f9d6 (diff)
the sd -size command now shows the size of all code needed for defining an oper
Diffstat (limited to 'src/compiler/GFI.hs')
-rw-r--r--src/compiler/GFI.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/compiler/GFI.hs b/src/compiler/GFI.hs
index 28f7b1dc2..7bb4df878 100644
--- a/src/compiler/GFI.hs
+++ b/src/compiler/GFI.hs
@@ -193,8 +193,15 @@ execute1 opts gfenv0 s0 =
let Right t = runP pExp (encodeUnicode utf8 (unwords ts))
err error return $ constantDepsTerm sgr t
_ -> error "give a term as argument"
- let printer = showTerm sgr TermPrintDefault Qualified
- putStrLn $ unwords $ map printer ops
+ let prTerm = showTerm sgr TermPrintDefault Qualified
+ let size = sizeConstant sgr
+ let printed
+ | elem "-size" os =
+ let sz = map size ops in
+ unlines $ ("total: " ++ show (sum sz)) :
+ [prTerm f ++ "\t" ++ show s | (f,s) <- zip ops sz]
+ | otherwise = unwords $ map prTerm ops
+ putStrLn $ printed
continue gfenv
show_operations ws =