-- Copyright (C) 2007-2008 Stefan Kersten -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA module Main where import qualified Sound.SonicVisualiser as SV import System.Environment import Text.PrettyPrint class Pretty a where prettyPrint :: a -> Doc nl :: Doc nl = char '\n' data File = File FilePath SV.Document instance Pretty (File) where prettyPrint (File file doc) = cat [text file <> colon, nest 2 (prettyPrint doc)] <> nl instance Pretty (SV.Document) where prettyPrint (SV.Document models layers derivs) = cat ([text "Models (" <> int (length models) <> text "):" <> nl] ++ map (nest 2 . prettyPrint) models) instance Pretty (SV.Model) where prettyPrint m = text (SV.modelName m) $$ nest 2 (prettyPrint (SV.modelData m)) instance Pretty (SV.Data) where prettyPrint (SV.File file) = text file prettyPrint (SV.DataSet points) = cat $ map prettyPrint points instance Pretty (SV.Point) where prettyPrint (SV.Point frame value label) = sep [text (show frame)] main :: IO () main = do files <- getArgs sv <- mapM SV.readFile files mapM_ (putStr . render . prettyPrint . uncurry File) (zip files sv) -- EOF