Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Types for interfacing with an embedded Perl interpreter.
- newtype Interpreter = Interpreter {}
- newtype SV = SV {}
- newtype AV = AV {}
- newtype CV = CV {}
- type Callback = Ptr SV -> CInt -> IO (Ptr SV)
- type IV = Int64
- type NV = Double
- data Context
- numContext :: (Eq p, Num p) => Context -> p
- asSVList :: Ptr SV -> IO [SV]
- svTail :: Ptr a -> IO [SV]
- svEither :: Ptr SV -> IO (Either [SV] [SV])
- mkSVList :: [SV] -> IO (Ptr SV)
- withSVArray :: [SV] -> (Ptr SV -> IO b) -> IO b
main types
newtype Interpreter Source #
(pointer to a) Perl interpreter instance.
(pointer to a) scalar value.
Underlying C types
Perl calling context
Perl's calling context.
numContext :: (Eq p, Num p) => Context -> p Source #
Convert a Context
to an integral
value that can be passed to the C API.
Used by the various "call_..." and "eval_..." Perl functions (which then pass it on to whatever code is being called).
ptr-to-ptr utility functions
the downside of the "newtype X = X (Ptr X)" approach is that working with arrays of ptrs-to-X becomes more fiddly.
So we define a few helper functions for working with arrays-of-ptrs-to-SVs.
asSVList :: Ptr SV -> IO [SV] Source #
convert a NULL terminated "array of pointers" (ptr-to-ptr-to-SV) to a list of SVs.
wrapper around "peekArray nullPtr
"
svTail :: Ptr a -> IO [SV] Source #
advance one el, and get the "tail" of an "array of pointers".
wrapper around advancePtr 1 fed into peekArray0 nullPtr
svEither :: Ptr SV -> IO (Either [SV] [SV]) Source #
return either the error list, or the result list from an array of pointers.