the sd -size command now shows the size of all code needed for defining an oper

This commit is contained in:
aarne
2011-09-22 12:11:03 +00:00
parent baa9bcd9d0
commit 6db0c74c2f
3 changed files with 30 additions and 13 deletions

View File

@@ -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 =