Interp: implement freadcontents
This commit is contained in:
parent
f4c3747b19
commit
7f16ca95e3
|
@ -128,6 +128,9 @@ _fgetline (StreamV handle) = do
|
||||||
_freadbytes (TupleV [StreamV handle, IntV n]) = do
|
_freadbytes (TupleV [StreamV handle, IntV n]) = do
|
||||||
liftIO $ StrV . T.take (fromIntegral n) <$> TIO.hGetContents handle
|
liftIO $ StrV . T.take (fromIntegral n) <$> TIO.hGetContents handle
|
||||||
|
|
||||||
|
_freadcontents (StreamV handle) = do
|
||||||
|
liftIO $ StrV <$> TIO.hGetContents handle
|
||||||
|
|
||||||
_fopen (TupleV [StrV path, StrV mode]) = do
|
_fopen (TupleV [StrV path, StrV mode]) = do
|
||||||
let mode' = case T.unpack mode of
|
let mode' = case T.unpack mode of
|
||||||
"r" -> ReadMode
|
"r" -> ReadMode
|
||||||
|
@ -251,6 +254,7 @@ initialState = [M.fromList $ map (\(k,v) -> (T.pack k, v)) $ [
|
||||||
("fputbytes", bif _fputstr),
|
("fputbytes", bif _fputstr),
|
||||||
("fputstr", bif _fputstr),
|
("fputstr", bif _fputstr),
|
||||||
("freadbytes", bif _freadbytes),
|
("freadbytes", bif _freadbytes),
|
||||||
|
("freadcontents", bif _freadcontents),
|
||||||
("feof", bif _feof),
|
("feof", bif _feof),
|
||||||
("fclose", bif _fclose),
|
("fclose", bif _fclose),
|
||||||
("fopen", bif _fopen),
|
("fopen", bif _fopen),
|
||||||
|
|
Loading…
Reference in New Issue