APTR handle = InitSerializer( int (*readfunc)(APTR buf, int len, APTR userdata), int (*writefunc)(APTR data, int len, APTR userdata), APTR userdata, struct hwTagList *tags);
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:
HWOS_ENCODING_UTF8
but
it also could be a different charset. See hw_GetEncoding for a list of supported charsets.
HWISZTAG_DSTENCODING:
HWOS_ENCODING_UTF8
but
it also could be a different charset. See hw_GetEncoding for a list of supported charsets.
HWISZTAG_USERTAGS:
pData
will point to a struct hwUserTagList
containing
a list of user tags passed by the Hollywood script. User tags are a way of
passing additional information from Hollywood scripts to plugin functions.
See User tags for details. (V10.0)
HWISZTAG_SERIALIZEMODE:
iData
member of this tag contains the serialization mode requested by the
Hollywood script. The following serialization modes are currently defined:
HWSERIALIZEMODE_HOLLYWOOD:
HWSERIALIZEMODE_NAMED:
HWSERIALIZEMODE_LIST:
How you interpret the different serialization modes is up to your plugin. (V10.0)
HWISZTAG_SERIALIZEOPTS:
iData
member of this tag contains the serialization options requested by the
Hollywood script. The following options are currently defined:
HWSERIALIZEOPTS_NOLOWERCASE:
How you interpret the individual serialization options is up to your plugin. (V10.0)
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.
NULL
NULL
readfunc()
and writefunc()
NULL
NULL
in case of an error