meta_unpack [function]
meta_unpack( string bytecode_buffer )
parse a bytecode buffer
- returns a dict containing root function or false/warning on failure
The structure of a function:
array consts
-- contains a list of parsed constants for the functionarray code
-- contains a list of parsed instructions for the functionarray lines
-- contains a list of line numbers for the instructions, array size should be equal to that of instruction arraybool gotthis
-- whetherthis
is required (should be false for root function)int numargs
-- number of input arguments (should be 0 for root function)int numtmp
-- number of temporary variables in functionint numclsr
-- number of closures required in functionint inclsr
-- number of incoming closures (not generated by the function)string name
-- name of the function ("<main>" for root function)int line
-- first line number of function definition (0 for root function)
The structure of a constant:
int type
-- base type ID of constant, should be one of SVT_[NULL|BOOL|INT|REAL|STRING|FUNC]var data
-- variable in the previously specified type or a parsed function in the case of SVT_FUNC
The structure of an instruction:
int op
-- operation code (ID), one of SI_ constants, name can be retrieved with meta_opnameint a
-- the "A" argument, 0 - 255int b
-- the "B" argument, -256 - 255int c
-- the "C" argument, -256 - 255int e
-- the "E" (extended) argument, -65536 - 65535 (occupies same memory space as A/B)