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

You can instruct the parser to stop when it encounters a specific IFF
chunk by using the function StopChunk():

    error = StopChunk (iff, ID_ILBM, ID_BODY);

When the parser encounters the requested chunk, parsing will stop, and
ParseIFF() will return the value zero.  The stream will be positioned
ready to read the first data byte in the chunk.  You may then call
ReadChunkBytes() or ReadChunkRecords() to pull the data out of the chunk.

You may call StopChunk() any number of times for any number of different
chunk types.  If you wish to identify the chunk on which you've stopped,
you may call CurrentChunk() to get a pointer to the current ContextNode,
and examine the cn_Type and cn_ID fields.

Using StopChunk() for every chunk, you can parse IFF files in a manner
very similar to the way you're probably doing it now, using a state
machine.  However, this would be a terrible underuse of IFFParse.