The functions in this sections are intended to support blobs
to define save() and load() functions so they can be part of a saved
state or .qlf
file. The matching pair of functions is
guaranteed to give the same result, regardless of byte ordering (big or
little endian). The user must not make any assumptions on the exact data
format used for storing the data. The atom read/write functions can only
be used from the blob callback functions.
For saving an uninterpreted array of bytes, it is suggested that the
length is output as a size_t
value using PL_qlf_put_uint32()
followed by the bytes using Sfwrite();
and for loading, the length is read using PL_qlf_get_uint32(),
a buffer is allocated, and the bytes are read using Sfread().
- int PL_qlf_put_int64(int64_t
i, IOSTREAM *s)
- int PL_qlf_put_int32(int32_t
i, IOSTREAM *s)
- int PL_qlf_put_uint32(uint32
i, IOSTREAM *s)
- Write integers of several sizes. Signed integers are written in
zigzag encoding. For unsigned integers we only write the
non-zero bytes. The result is compact and the same for big or little
endian.
- int PL_qlf_put_double(double
f, IOSTREAM *s)
- Write double as 8 byte big endian.
- int PL_qlf_put_atom(atom_t
a, IOSTREAM *s)
- Write an atom. The atom may be a blob. Note that this function
may only be used from a blob save() function. Calling from
another context results in a fatal error.
- int PL_qlf_get_int64(IOSTREAM
*s, int64_t *ip)
- int PL_qlf_get_int32(IOSTREAM
*s, int32_t *ip)
- int PL_qlf_get_uint32(IOSTREAM
*s, uint32_t *ip)
- int PL_qlf_get_double(IOSTREAM
*s, double *fp)
- Counterparts of corresponding PL_qlf_put_*() functions.
- int PL_qlf_get_atom(IOSTREAM
*s, atom_t *ap)
- Counterpart of PL_qlf_put_atom().
Again, this may only be used in the context of a blob load()
function.