From 6db0c74c2f120c829e666879b39f57afe1ed3318 Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 22 Sep 2011 12:11:03 +0000 Subject: the sd -size command now shows the size of all code needed for defining an oper --- src/compiler/GFI.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/compiler/GFI.hs') 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 = -- cgit v1.2.3