NAME ^

src/packfile/pf_items.c - Fetch/store packfile data

DESCRIPTION ^

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.

Functions ^

PF_fetch_opcode

Fetch an opcode_t from the stream, converting byteorder if needed.

PF_store_opcode

Store an opcode_t to stream as is.

PF_size_opcode

Return size of an item in opcode_t units, which is 1 per definitionem.

PF_fetch_integer

Fetch an INTVAL from the stream, converting byteorder if needed.

XXX assumes sizeof (INTVAL) == sizeof (opcode_t) - we don't have INTVAL size in the PackFile header.

PF_store_integer

Store an INTVAL to stream as is.

PF_size_integer

Return store size of INTVAL in opcode_t units.

PF_fetch_number

Fetch a FLOATVAL from the stream, converting byteorder if needed. Then advance stream pointer by amount of packfile float size.

PF_store_number

Write a FLOATVAL to the opcode stream as is.

PF_size_number

Return store size of FLOATVAL in opcode_t units.

PF_fetch_string

Fetch a STRING from bytecode and return a new STRING.

Opcode format is:

    opcode_t flags
    opcode_t encoding
    opcode_t type
    opcode_t size
    * data
PF_store_string

Write a STRING to the opcode stream.

PF_size_string

Report store size of STRING in opcode_t units.

PF_fetch_cstring

Fetch a cstring from bytecode and return an allocated copy

PF_store_cstring

Write a 0-terminated string to the stream.

PF_size_cstring

Return store size of a C-string in opcode_t units.

PackFile_assign_transforms

Assign transform functions to vtable.

HISTORY ^

Initial review by leo 2003.11.21

Most routines moved from src/packfile.c.

Renamed PackFile_* to PF_*

TODO ^

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


parrot