Here are some notes on building programs that read IFF files. For list and prop work, you should also read up on recursive descent parsers. [see, for example, Compiler Construction, An Advanced Course.] o The standard is very flexible so many programs can exchange data. This implies a program has to scan the file and react to what's actually there in whatever order it appears. An IFF reader program is a parser. o For interchange to really work, programs must be willing to do some conversion during read-in. If the data isn't exactly what you expect, say, the raster is smaller than those created by your program, then adjust it. Similarly, your program could crop a large picture, add or drop bitplanes, or create/discard a mask plane. The program should give up gracefully on data that it can't convert. o If it doesn't start with "form", "list", or "cat ", it's not an iff-85 file. o For any chunk you encounter, you must recognize its type id to understand its contents. o For any form chunk you encounter, you must recognize its form type id to understand the contained "local chunks". Even if you don't recognize the FORM type, you can still scan it for nested FORMs, lists, and cat s of interest. o Don't forget to skip the implied pad byte after every odd-length chunk, this is not included in the chunk count! o chunk types list, form, prop, and cat are generic groups. they always contain a subtype ID followed by chunks. o Readers ought to handle a cat of forms in a file. you may treat the FORMs like document pages to sequence through, or just use the first FORM. o Many IFF readers completely skip lists. "fully iff-conforming" readers are those that handle LISTs, even if just to read the first form from a file. if you do look into a list, you must process shared properties (in prop chunks) properly. the idea is to get the correct data or none at all. o The nicest readers are willing to look into unrecognized forms for nested FORM types that they do recognize. For example, a musical score may contain nested instrument descriptions and animation or desktop publishing files may contain still pictures. This extra step is highly recommended. Note to programmers: Processing PROP chunks is not simple! you'll need some background in interpreters with stack frames. If this is foreign to you, build programs that read/write only one form per file. for the more intrepid programmers, the next paragraph summarizes how to process lists and props. Allocate a stack frame for every list and form you encounter and initialize it by copying the stack frame of the parent LIST or FORM. At the top level, you'll need a stack frame initialized to your program's global defaults. While reading each LIST or FORM, store all encountered properties into the current stack frame. In the example ShowILBM, each stack frame has a place for a bitmap header property ILBM.bmhd and a color map property ILBM.cmap. when you finally get to the ilbm's body chunk, use the property settings accumulated in the current stack frame. An alternate implementation would just remember props encountered, forgetting each on reaching the end of its scope (the end of the containing list). when a form xxxx is encountered, scan the chunks in all remembered props xxxx, in order, as if they appeared before the chunks actually in the FORM XXXX. This gets trickier if you read FORMs inside of FORMs.