-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Library for loading Lua bytecode. -- -- You can use this library to load LUA bytecode into its logical -- structure. Currently LUA 5.1 is supported. -- --
-- import System.Environment -- import Lua.Bytecode5_1.Chunk -- import Lua.Bytecode5_1.Types -- import Lua.Bytecode5_1.Header -- import qualified Data.ByteString as BS -- import Text.Show.Pretty -- -- main = do -- args <- getArgs -- b <- BS.readFile $ args !! 0 -- let f = runLuaGet b :: Either String Function -- putStrLn $ ppShow f --@package lua-bytecode @version 0.1.0.0 module Lua.Bytecode5_1.Types class LuaGet a luaGet :: LuaGet a => Get a runLuaGet :: LuaGet a => ByteString -> Either String a getList32 :: LuaGet a => Get [a] getByteString32 :: Get ByteString type Table = Map Constant Constant data Constant NIL :: Constant BOOLEAN :: Bool -> Constant NUMBER :: Double -> Constant STRING :: ByteString -> Constant TABLE :: Table -> Constant CLOSURE :: Closure -> Constant getConstant :: Get Constant data Local Local :: ByteString -> Word32 -> Word32 -> Local name :: Local -> ByteString startPc :: Local -> Word32 endPc :: Local -> Word32 getLocal :: Get Local data LuaTypes None :: LuaTypes Nil :: LuaTypes LBool :: LuaTypes LightUser :: LuaTypes Number :: LuaTypes LString :: LuaTypes Table :: LuaTypes Function :: LuaTypes UserData :: LuaTypes Thread :: LuaTypes NumTags :: LuaTypes luaIBitsInt :: Integer sizeC :: Int sizeB :: Int sizeBx :: Int sizeA :: Int sizeOp :: Int posOp :: Int posA :: Int posC :: Int posB :: Int posBx :: Int maxArgBx :: Word32 maxArgSBx :: Word32 maxArgA :: Word32 maxArgB :: Word32 maxArgC :: Word32 mask1 :: (Num a, Bits a) => Int -> Int -> a mask0 :: (Num a, Bits a) => Int -> Int -> a getOpcode :: Word32 -> Word32 setOpcode :: (Num a, Bits a) => a -> a -> a getArg :: (Num a, Bits a) => a -> Int -> Int -> a setArg :: (Num a, Bits a) => a -> a -> Int -> Int -> a getArgA :: (Num a, Bits a) => a -> a setArgA :: (Num a, Bits a) => a -> a -> a getArgB :: (Num a, Bits a) => a -> a setArgB :: (Num a, Bits a) => a -> a -> a getArgC :: (Num a, Bits a) => a -> a setArgC :: (Num a, Bits a) => a -> a -> a getArgBx :: Word32 -> Word32 setArgBx :: (Num a, Bits a) => a -> a -> a getArgSBx :: Word32 -> Word32 setArgSBx :: Word32 -> Word32 -> Word32 createABC :: Bits a => a -> a -> a -> a -> a createABx :: Bits a => a -> a -> a -> a bitRK :: Word32 isK :: Word32 -> Bool k :: Word32 -> Either Word32 Word32 data Opcode OP_MOVE :: Opcode OP_LOADK :: Opcode OP_LOADBOOL :: Opcode OP_LOADNIL :: Opcode OP_GETUPVAL :: Opcode OP_GETGLOBAL :: Opcode OP_GETTABLE :: Opcode OP_SETGLOBAL :: Opcode OP_SETUPVAL :: Opcode OP_SETTABLE :: Opcode OP_NEWTABLE :: Opcode OP_SELF :: Opcode OP_ADD :: Opcode OP_SUB :: Opcode OP_MUL :: Opcode OP_DIV :: Opcode OP_MOD :: Opcode OP_POW :: Opcode OP_UNM :: Opcode OP_NOT :: Opcode OP_LEN :: Opcode OP_CONCAT :: Opcode OP_JMP :: Opcode OP_EQ :: Opcode OP_LT :: Opcode OP_LE :: Opcode OP_TEST :: Opcode OP_TESTSET :: Opcode OP_CALL :: Opcode OP_TAILCALL :: Opcode OP_RETURN :: Opcode OP_FORLOOP :: Opcode OP_FORPREP :: Opcode OP_TFORLOOP :: Opcode OP_SETLIST :: Opcode OP_CLOSE :: Opcode OP_CLOSURE :: Opcode OP_VARARG :: Opcode numOpcodes :: Int data OpMode ABC :: OpMode ABx :: OpMode AsBx :: OpMode data OpArgMask N :: OpArgMask U :: OpArgMask R :: OpArgMask K :: OpArgMask data OpcodeFields OpcodeFields :: Word32 -> Word32 -> Word32 -> Word32 -> Word32 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> OpcodeFields a :: OpcodeFields -> Word32 b :: OpcodeFields -> Word32 bx :: OpcodeFields -> Word32 sBx :: OpcodeFields -> Word32 c :: OpcodeFields -> Word32 opMode :: OpcodeFields -> Word8 bMode :: OpcodeFields -> Word8 cMode :: OpcodeFields -> Word8 testAMode :: OpcodeFields -> Word8 testTMode :: OpcodeFields -> Word8 toOpcodeFields :: Word32 -> OpcodeFields data Operation Operation :: Opcode -> OpcodeFields -> Operation operator :: Operation -> Opcode fields :: Operation -> OpcodeFields type Operations = Vector Operation opModes :: Array Opcode Word8 type Stack = Vector Constant data GlobalState GlobalState :: GlobalState type StackId = Int data State State :: StackId -> StackId -> GlobalState -> CallInfo -> Operations -> StackId -> StackId -> Int -> Table -> State top :: State -> StackId baseS :: State -> StackId global :: State -> GlobalState ci :: State -> CallInfo instructions :: State -> Operations stackLast :: State -> StackId stack :: State -> StackId stackSize :: State -> Int globalTable :: State -> Table g :: State -> Table data Closure Closure :: Stack -> Bool -> Prototype -> Closure upVals :: Closure -> Stack isC :: Closure -> Bool proto :: Closure -> Prototype data Prototype Prototype :: Stack -> Operations -> Prototypes -> Stack -> Vector String -> Word8 -> Bool -> Word8 -> Prototype constants :: Prototype -> Stack code :: Prototype -> Operations prototypes :: Prototype -> Prototypes localVariables :: Prototype -> Stack upValues :: Prototype -> Vector String numParams :: Prototype -> Word8 isVarArg :: Prototype -> Bool maxStackSize :: Prototype -> Word8 type Prototypes = Vector Prototype data CallInfo CallInfo :: StackId -> StackId -> Int -> Word8 -> CallInfo baseCI :: CallInfo -> StackId function :: CallInfo -> StackId savedPc :: CallInfo -> Int nResults :: CallInfo -> Word8 instance Show Local instance Show Opcode instance Enum Opcode instance Bounded Opcode instance Ord Opcode instance Eq Opcode instance Ix Opcode instance Show OpMode instance Enum OpMode instance Bounded OpMode instance Ord OpMode instance Eq OpMode instance Ix OpMode instance Show OpArgMask instance Enum OpArgMask instance Bounded OpArgMask instance Ord OpArgMask instance Eq OpArgMask instance Ix OpArgMask instance Eq OpcodeFields instance Ord OpcodeFields instance Show OpcodeFields instance Eq Operation instance Ord Operation instance Show Operation instance Ord Prototype instance Eq Prototype instance Show Prototype instance Eq Constant instance Ord Constant instance Show Constant instance Ord Closure instance Eq Closure instance Show Closure instance LuaGet Operation instance LuaGet Opcode instance Bounded LuaTypes instance Enum LuaTypes instance LuaGet Local instance LuaGet Constant instance Hashable Constant instance LuaGet a => LuaGet (Vector a) instance LuaGet a => LuaGet [a] instance LuaGet Double instance LuaGet ByteString instance LuaGet Word32 instance LuaGet Int32 instance LuaGet Word8 module Lua.Bytecode5_1.Header data Header Header :: Word8 -> Word8 -> Word8 -> Bool -> Word8 -> Word8 -> Word8 -> Word8 -> Bool -> Header versionMajor :: Header -> Word8 versionMinor :: Header -> Word8 formatVersion :: Header -> Word8 bigEndian :: Header -> Bool intBytes :: Header -> Word8 size_tBytes :: Header -> Word8 instructionBytes :: Header -> Word8 lua_NumberBytes :: Header -> Word8 floatNums :: Header -> Bool headerAssert :: Get () getHeader :: Get Header instance Show Header instance LuaGet Header module Lua.Bytecode5_1.Chunk hasArg :: Chunk -> Bool isVarArg :: Chunk -> Bool needsArg :: Chunk -> Bool data Chunk Chunk :: ByteString -> Int32 -> Int32 -> Word8 -> Word8 -> Word8 -> Word8 -> Vector Operation -> Vector Constant -> Vector Chunk -> Vector Int32 -> Vector Local -> Vector ByteString -> Chunk source :: Chunk -> ByteString line :: Chunk -> Int32 lastLine :: Chunk -> Int32 upValueCount :: Chunk -> Word8 parameters :: Chunk -> Word8 varArg :: Chunk -> Word8 maxStackSize :: Chunk -> Word8 instructions :: Chunk -> Vector Operation constants :: Chunk -> Vector Constant prototypes :: Chunk -> Vector Chunk sourcePositions :: Chunk -> Vector Int32 locals :: Chunk -> Vector Local upValues :: Chunk -> Vector ByteString getChunk :: Get Chunk data Function Function :: Header -> Chunk -> Function header :: Function -> Header chunk :: Function -> Chunk instance Show Chunk instance Show Function instance LuaGet Function instance LuaGet Chunk