diff options
author | Jed Barber <jjbarber@y7mail.com> | 2014-08-31 21:30:11 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2014-08-31 21:30:11 +1000 |
commit | 4b5442992c624b239602346da177718d8b8832fb (patch) | |
tree | 23a90a5f86f210946c1e00497fa2bc392781d4ba /src | |
parent | d1f6d16fd84e0d65b3f24624666bf575e4586401 (diff) |
Removed arbitrary file handling from getc/putc until more monads are in place
Diffstat (limited to 'src')
-rw-r--r-- | src/Grasp/Interpreter.hs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Grasp/Interpreter.hs b/src/Grasp/Interpreter.hs index d719527..a8ce18a 100644 --- a/src/Grasp/Interpreter.hs +++ b/src/Grasp/Interpreter.hs @@ -418,16 +418,16 @@ getcI g node = do fhL = targetLabels g (getByLabel "fh" edges) c <- case fhL of - x | length x == 0 -> getChar >>= + x | length x == 0 || length x == 1 -> getChar >>= (\x -> if (x == '\EOT') then return (-1) else return (ord x)) - x | length x == 1 -> do - h <- openFile (head fhL) ReadMode - input <- try (hGetChar h) - hClose h - case input of - Left e -> if (isEOFError e) then return (-1) else ioError e - Right inpChr -> return (ord inpChr) + --x | length x == 1 -> do + -- h <- openFile (head fhL) ReadMode + -- input <- try (hGetChar h) + -- hClose h + -- case input of + -- Left e -> if (isEOFError e) then return (-1) else ioError e + -- Right inpChr -> return (ord inpChr) x -> error ("Instruction " ++ (show node) ++ " may only have one file handle") @@ -457,9 +457,9 @@ putcI g node = do x -> return . chr . read $ inL!!r fh <- case fhL of - x | length x == 0 -> return stdout + x | length x == 0 || length x == 1 -> return stdout - x | length x == 1 -> openFile (head fhL) AppendMode + --x | length x == 1 -> openFile (head fhL) AppendMode x -> error ("Instruction " ++ (show node) ++ " may only have one file handle") |