parrotcode: Fetch/store packfile data | |
Contents | C |
src/packfile/pf_items.c - Fetch/store packfile data
Low level packfile functions to fetch and store Parrot data,
i.e.
INTVAL
,
FLOATVAL
,
STRING
...
PF_fetch_<item>()
functions retrieve the datatype item from the opcode stream and convert byteordering or binary format on the fly,
depending on the packfile header.
PF_store_<item>()
functions write the datatype item to the stream as is.
These functions don't check the available size.
PF_size_<item>()
functions return the store size of item in opcode_t
units.
BE
and be
are short for "Big-endian",
while LE
and le
are short for "little endian".
static void cvt_num12_num8
static void cvt_num12_num8_be
static void cvt_num12_num8_le
static opcode_t fetch_op_test
opcode_t
operation in little-endian format.static opcode_t fetch_op_mixed_le
static opcode_t fetch_op_mixed_be
OPCODE_T_SIZE
macro,
and proceeds accordingly.static opcode_t fetch_op_be_4
static opcode_t fetch_op_be_8
static opcode_t fetch_op_le_4
static opcode_t fetch_op_le_8
opcode_t PF_fetch_opcode
opcode_t
from the stream,
converting byteorder if needed.opcode_t *PF_store_opcode
opcode_t
to stream as-is.size_t PF_size_opcode
opcode_t
units.
The size of opcode_t
is 1 per definition.INTVAL PF_fetch_integer
INTVAL
from the stream,
converting byteorder if needed.sizeof (INTVAL) == sizeof (opcode_t)
- we don't have INTVAL
size in the PackFile header.opcode_t *PF_store_integer
INTVAL
to stream as is.size_t PF_size_integer
INTVAL
in opcode_t
units.FLOATVAL PF_fetch_number
FLOATVAL
from the stream,
converting byteorder if needed.
Then advances the stream pointer by the packfile float size.opcode_t *PF_store_number
FLOATVAL
to the opcode stream as-is.size_t PF_size_number
opcode_t
units.STRING *PF_fetch_string
STRING
from bytecode and return a new STRING
. opcode_t flags
opcode_t encoding
opcode_t type
opcode_t size
* data
opcode_t *PF_store_string
STRING
to the opcode stream.size_t PF_size_string
STRING
in opcode_t
units.char *PF_fetch_cstring
opcode_t *PF_store_cstring
NULL
-terminated string to the stream.size_t PF_size_cstring
opcode_t
units.void PackFile_assign_transforms
Initial review by leo 2003.11.21
Most routines moved from src/packfile.c.
Renamed PackFile_* to PF_*
<PF_store_<type
()>> - write an opcode_t stream to cursor in natural byte-ordering.
<PF_fetch_<type
()>> - read items and possibly convert the foreign format.
<PF_size_<type
()>> - return the needed size in opcode_t
units.
|