Copyright | (c) Petr Penzin 2015 |
---|---|
License | BSD2 |
Maintainer | penzin.dev@gmail.com |
Stability | experimental |
Portability | cross-platform |
Safe Haskell | Safe |
Language | Haskell98 |
Emit and parse global values for a Binary.Neko module.
- data Global
- = GlobalVar String
- | GlobalFunction (Int, Int)
- | GlobalString String
- | GlobalFloat String
- | GlobalDebug ([String], [(Int, Int)])
- | GlobalVersion Int
- readGlobals :: Word32 -> ByteString -> Maybe ([Global], ByteString)
- readGlobal :: ByteString -> Maybe (Global, ByteString)
- getGlobals :: Word32 -> Get [Global]
- getGlobal :: Get Global
- getGlobalVar :: Get Global
- getGlobalString :: Get Global
- putGlobal :: Global -> Put
- putGlobals :: [Global] -> Put
Documentation
Global value type
GlobalVar String | Global variable (name) |
GlobalFunction (Int, Int) | Function |
GlobalString String | String literal |
GlobalFloat String | Floating point constant |
GlobalDebug ([String], [(Int, Int)]) | Debug information |
GlobalVersion Int | Version record |
:: Word32 | Number of global values to read |
-> ByteString | Bytestring to read from |
-> Maybe ([Global], ByteString) | On success: list of global values read and unconsumed bytestring |
Read globals from a bytestring
:: ByteString | Bytes to read from |
-> Maybe (Global, ByteString) | Read value and the rest of bytes (if successfull) |
Read a single global value, if succesfull return a single global value and remaining bytestring
Get a list of globals from a bytestring
getGlobalVar :: Get Global Source #
Decode a global variable
getGlobalString :: Get Global Source #
Decode a global string
putGlobals :: [Global] -> Put Source #
Write a list of globals to a bytestring