neko-lib-0.0.1.0: Neko VM code generation and disassembly library

Copyright(c) Petr Penzin 2015
LicenseBSD2
Maintainerpenzin.dev@gmail.com
Stabilityexperimental
Portabilitycross-platform
Safe HaskellSafe
LanguageHaskell98

Binary.Neko.Globals

Description

Emit and parse global values for a Binary.Neko module.

Synopsis

Documentation

data Global Source #

Global value type

Constructors

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

Instances

readGlobals Source #

Arguments

:: 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

readGlobal Source #

Arguments

:: 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

getGlobals Source #

Arguments

:: Word32

number of globals

-> Get [Global]

decode a list

Get a list of globals from a bytestring

getGlobal :: Get Global Source #

Read a global from a bytestring

getGlobalVar :: Get Global Source #

Decode a global variable

getGlobalString :: Get Global Source #

Decode a global string

putGlobal :: Global -> Put Source #

Write a global to a bytestring

putGlobals :: [Global] -> Put Source #

Write a list of globals to a bytestring