[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

Ordinarily, the parser will automatically delete LCIs you have allocated
and installed.  However, you may have a case where simply FreeMem()ing
your LCI is not enough; you may need to free some ancillary memory, or
decrement a counter, or send a signal, or something.  This is where
SetLocalItemPurge() comes in.  It is called as follows:

    SetLocalItemPurge (lci, hookptr);

When the parser is ready to delete your LCI, your purge handler code will
be called through the Hook you supplied.  You can then perform all your
necessary operations.  One of these operations should be to free the LCI
itself.  This is done with FreeLocalItem():

    FreeLocalItem (lci);

This deallocates the memory used to store the LCI and the client buffer
allocated with it.  FreeLocalItem() is only called as part of a custom
purge handler.

As with custom chunk handlers, your purge handler executes in the same
environment as the mainline code that called ParseIFF().  It is
recommended that you keep purge handlers short and to the point; super
clever stuff should be reserved for custom chunk handlers, or for the
client's mainline code.  Custom purge handlers must always work; failures
will be ignored.