Changeset 16625
- Timestamp:
- 06/03/07 21:24:28 (18 months ago)
- Location:
- src/Pugs
- Files:
-
- 2 modified
-
Prim.hs (modified) (2 diffs)
-
Prim/Eval.hs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Prim.hs
r16597 r16625 303 303 Perl5ErrorString str -> fail str 304 304 Perl5ErrorObject err -> throwError (PerlSV err) 305 op1 "Pugs::Internals::eval_p6y" = op1EvalP6Y 305 op1 "Pugs::Internals::evalfile_p6y" = op1EvalFileP6Y 306 op1 "Pugs::Internals::eval_p6y" = op1EvalP6Y 306 307 op1 "Pugs::Internals::eval_haskell" = op1EvalHaskell 307 308 op1 "Pugs::Internals::eval_yaml" = evalYaml … … 1944 1945 \\n Any pre Pugs::Internals::eval_haskell unsafe (Str)\ 1945 1946 \\n Any pre Pugs::Internals::eval_p6y unsafe (Str)\ 1947 \\n Any pre Pugs::Internals::evalfile_p6y unsafe (Str)\ 1946 1948 \\n Any pre Pugs::Internals::eval_yaml safe (Str)\ 1947 1949 \\n Any pre Pugs::Internals::emit_yaml unsafe (rw!Any)\ -
src/Pugs/Prim/Eval.hs
r16373 r16625 2 2 module Pugs.Prim.Eval ( 3 3 -- used by Pugs.Prim 4 op1EvalHaskell, op1EvalP6Y, 4 op1EvalHaskell, op1EvalP6Y, op1EvalFileP6Y, 5 5 opEval, opEvalFile, 6 6 opRequire, requireInc, … … 20 20 import DrIFT.YAML 21 21 import Data.Yaml.Syck 22 import qualified Data.ByteString.Char8 as Bytes 23 24 type Bytes = Bytes.ByteString 22 25 23 26 data EvalError = EvalErrorFatal … … 123 126 , evalResult=EvalResultLastValue} 124 127 125 op1EvalP6Y :: Val -> Eval Val 126 op1EvalP6Y fileName = do 128 129 op1EvalP6Y, op1EvalFileP6Y :: Val -> Eval Val 130 131 op1EvalFileP6Y fileName = do 127 132 fileName' <- fromVal fileName 133 file <- io $ Bytes.readFile fileName' 134 op1EvalP6Y' file 135 136 op1EvalP6Y bytecode = do 137 bytecode' <- fromVal bytecode 138 op1EvalP6Y' $ Bytes.pack bytecode' -- XXX: is this the right pack function? 139 140 op1EvalP6Y' :: Bytes -> Eval Val 141 op1EvalP6Y' bytecode = do 128 142 yml <- io $ (`catchIO` (return . Left . show)) $ 129 fmap Right (parseYaml File fileName')143 fmap Right (parseYamlBytes bytecode) 130 144 case yml of 131 145 Right MkNode{ n_elem=ESeq (v:_) } 132 146 | MkNode{ n_elem=EStr vnum } <- v 133 147 , vnum /= (packBuf $ show compUnitVersion) -> do 134 err "incompatible version number for compilation unit" 148 err $ "incompatible version number for compilation unit: found " ++ 149 unpackBuf vnum ++ ", expecting " ++ (show compUnitVersion) 135 150 Right yml' -> do 136 151 globTVar <- asks envGlobal
