schedevr (empty) → 0.1.0.0
raw patch · 5 files changed
+163/−0 lines, 5 filesdep +basedep +directorydep +filepathsetup-changed
Dependencies added: base, directory, filepath, old-locale, time, xturtle
Files
- LICENSE +30/−0
- Setup.hs +2/−0
- schedevr.cabal +34/−0
- src/mkschd/marge-schedule.hs +21/−0
- src/prog_graph/mkGraph.hs +76/−0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2014, Yoshikuni Jujo++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Yoshikuni Jujo nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ schedevr.cabal view
@@ -0,0 +1,34 @@+-- Initial schedevr.cabal generated by cabal init. For further +-- documentation, see http://haskell.org/cabal/users-guide/++name: schedevr+version: 0.1.0.0+synopsis: Marge schedules and show EVR+-- description: +license: BSD3+license-file: LICENSE+author: Yoshikuni Jujo+maintainer: PAF01143@nifty.ne.jp+-- copyright: +category: Development+build-type: Simple+-- extra-source-files: +cabal-version: >=1.10++executable marge-schedule+ hs-source-dirs: src/mkschd+ main-is: marge-schedule.hs+ -- other-modules: + other-extensions: TupleSections+ build-depends: base >=4.6 && <4.7, xturtle >=0.1 && <0.2, time >=1.4 && <1.5, filepath >=1.3 && <1.4, old-locale >=1.0 && <1.1+ hs-source-dirs: src+ default-language: Haskell2010++executable show-progress+ hs-source-dirs: src/mkschd, src/prog_graph+ main-is: mkGraph.hs+ -- other-modules: + other-extensions: TupleSections+ build-depends: base >=4.6 && <4.7, xturtle >=0.1 && <0.2, time >=1.4 && <1.5, filepath >=1.3 && <1.4, old-locale >=1.0 && <1.1, directory+ hs-source-dirs: src+ default-language: Haskell2010
+ src/mkschd/marge-schedule.hs view
@@ -0,0 +1,21 @@+module Main where++import Output+import Parser+import FromID+import System.Environment+import Control.Applicative+import Data.Time++main :: IO ()+main = do+ d <- localDay . zonedTimeToLocalTime <$> getZonedTime+ args <- getArgs+ let (ilfps, "--" : fps) = span (/= "--") args+ tbl <- concat <$> mapM readFile ilfps+ items <- mapM (fmap parse . readFile) fps+-- cnt1 <- readFile "test.schd"+-- cnt2 <- readFile "test2.schd"+-- putStr $ showOutputs $ fromItem2 (read "2014-04-22") (parse cnt1) (parse cnt2)+ putStr $ showOutputs $ map (convertOutput tbl) $+ fromItemN (read "2014-04-17") items
+ src/prog_graph/mkGraph.hs view
@@ -0,0 +1,76 @@+import WatchEVR+import Graphics.X11.Turtle+import Data.List+import Data.Time+import Data.Maybe+import Control.Arrow+import Control.Applicative+import System.Environment+import System.FilePath+import Data.Char+import Data.Function+import ScheduleEVR+import System.Directory+import System.FilePath++evrItemsName, evrProgressName :: [FilePath]+evrItemsName = [+ "../test1/item_list",+ "../test2/item_list",+ "../test3/item_list" ]+evrProgressName = [+ "../test1/progress",+ "../test2/progress",+ "../test3/progress"]++schdFiles :: [FilePath]+schdFiles = [+ "../test1/test.schd",+ "../test2/test2.schd",+ "../test3/test3.schd" ]++getSchdFile :: FilePath -> IO [FilePath]+getSchdFile dir = do+ ls <- filter ((== ".schd") . takeExtension) <$> getDirectoryContents dir+ return $ map (dir </>) ls++getItemFiles, getProgressFiles :: [FilePath] -> [FilePath]+getItemFiles = map (</> "item_list")+getProgressFiles = map (</> "progress")++getSchdFiles :: [FilePath] -> IO [FilePath]+getSchdFiles = (concat <$>) . mapM getSchdFile++main :: IO ()+main = do+ "-s" : start : dirs <- getArgs+ eiCnt <- concat <$> mapM readFile (getItemFiles dirs)+ es <- dayItemFile (read start) =<< getSchdFiles dirs+ espCnt <- concat <$> mapM readFile (getProgressFiles dirs)+ let+ ei = map idPoint' $ lines eiCnt+ esp = sortBy (on compare fst) $ map dayId $ lines espCnt+ di = accumSecond (+) 0 $ dayPoint ei es+ dip = accumSecond (+) 0 $ dayPoint ei esp+ cnv = getConverter (50, 100) (400, 200) di+ pc = progPercent dip di+ f <- openField+ topleft f+ t <- newTurtle f+ speed t "fastest"+ flushoff t+ waku t (50, 100) (400, 200) di+ goto t 50 300+ flushon t+ speed t "slowest"+ chart t "grey" cnv (50, 100) (400, 200) di+ speed t "slow"+ goto t 50 300+ speed t "slowest"+ chart t "black" cnv (50, 100) (400, 200) dip+ speed t "fastest"+ goto t 200 100+ write t "Kochi Gothic" fontsize $ take 4 (show pc) ++ "%"+ hideturtle t+ onkeypress f $ return . (/= 'q')+ waitField f