Changeset 14341 for src/Pugs/Prim.hs
- Timestamp:
- 10/17/06 08:25:46 (2 years ago)
- svk:copy_cache_prev:
- 21206
- Files:
-
- 1 modified
-
src/Pugs/Prim.hs (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Prim.hs
r14337 r14341 54 54 import GHC.Exts (unsafeCoerce#) 55 55 import GHC.Unicode 56 import qualified UTF8 as Str57 56 import qualified Data.HashTable as H 58 57 … … 359 358 op1 "IO::next" = \v -> do 360 359 fh <- fromVal v 361 guardIO $ fmap (VStr . (++ "\n") . Str.unpack) (Str.hGetLine fh)360 guardIO $ fmap (VStr . (++ "\n") . decodeUTF8) (hGetLine fh) 362 361 op1 "Pugs::Safe::safe_print" = \v -> do 363 362 str <- fromVal v 364 guardIO . Str.hPut stdout $ Str.packstr363 guardIO . putStr $ encodeUTF8 str 365 364 return $ VBool True 366 365 op1 "die" = \v -> do … … 438 437 (do h <- fromVal v 439 438 ifListContext (strictify $! op1 "=" v) $ do 440 content <- guardIO $ Str.hGetContents h441 return . VStr $ Str.unpackcontent)439 content <- guardIO $ hGetContents h 440 return . VStr $ decodeUTF8 content) 442 441 (do 443 442 fileName <- fromVal v … … 451 450 slurpList file = strictify $! op1 "=" (VList [VStr file]) 452 451 slurpScalar file = do 453 content <- guardIO $ Str.readFile file454 return . VStr $ Str.unpackcontent452 content <- guardIO $ readFile file 453 return . VStr $ decodeUTF8 content 455 454 op1 "opendir" = \v -> do 456 455 str <- fromVal v
