Name
InitSerializer -- create new serializer (V9.0)
Synopsis
APTR handle = InitSerializer(
                     int (*readfunc)(APTR buf, int len, APTR userdata),
                     int (*writefunc)(APTR data, int len, APTR userdata),
                     APTR userdata, struct hwTagList *tags);
Function
This function must create a new serializer, either for serializing or for deserializing data. If Hollywood passes the function pointer readfunc to you, InitSerializer() must initialize for deserializing data. If Hollywood passes the function pointer writefunc to you, InitSerializer() must prepare for serializing data. You must store the pointer to the I/O function because you will need it later to pass data to Hollywood or get data from Hollywood. You also have to store the userdata pointer because you need to pass it to readfunc() and writefunc().

To serialize or deserialize items, Hollywood will repeatedly call your SerializeItem() and DeserializeItem() implementations. SerializeItem() needs to call writefunc() to send the serialized data to Hollywood and DeserializeItem() needs to call readfunc() to get new data from Hollywood to deserialize.

See SerializeItem for details.

See DeserializeItem for details.

The tag list that is passed in tags may contain the following tags:

HWISZTAG_SRCENCODING:
The charset used by the source data. Typically this will be HWOS_ENCODING_UTF8 but it also could be a different charset. See hw_GetEncoding for a list of supported charsets.

HWISZTAG_DSTENCODING:
The charset that should be used by your serializer on output. Typically this will be HWOS_ENCODING_UTF8 but it also could be a different charset. See hw_GetEncoding for a list of supported charsets.

Note that if one of the tags above is not specified, your serializer should use Hollywood's default string charset. You can get this by calling hw_GetEncoding() using the HWGENCTAG_STRING tag. See hw_GetEncoding for details.

Inputs
readfunc
function to call to get data to deserialize from Hollywood or NULL
writefunc
function to call to send serialized data to Hollywood or NULL
userdata
user data that needs to be passed to readfunc() and writefunc()
tags
tag list containing optional arguments or NULL
Results
handle
handle to the serializer or NULL in case of an error

Show TOC