Structure
An IFF file is built up from chunks. Each chunk begins with what the specification calls a "Type ID" (what the Macintosh called an OSType and Windows developers might call a FourCC). This is followed by a 32-bit unsigned integer (all integers in IFF files' structure are big-endian) specifying the size of the following data (the chunk content) in bytes. Because the specification includes explicit lengths for each chunk, it is possible for a parser to skip over chunks which it either can't or doesn't care to process.
This structure is closely related to the type-length-value (TLV) representation.
There are predefined group chunks, with type IDs ‘FORM’, ‘LIST’ and ‘CAT ’. A FORM chunk is like a record structure, containing a type ID (indicating the record type) followed by nested chunks specifying the record fields. A LIST is a factoring structure containing a series of ‘PROP’ (property) chunks plus nested group chunks to which those properties apply. A CAT is just a collection of nested chunks with no special semantics. Group chunks can contain other group chunks, depending on the needs of the application. Group chunks, like their simpler counterparts, contain a length element. Skipping over a group can thus be done with a simple Unix-style relative seek operation.
Chunks must begin on even file offsets, as befits the origins of IFF on the Motorola 68000 processor, which couldn't address quantities larger than a byte on odd addresses. Thus chunks with odd lengths will be "padded" to an even byte boundary by adding a so-called "pad byte" after their regular end.
The top-level structure of an IFF file consists of exactly one of the group chunks: FORM, LIST or CAT, where FORM is by far the most common one.
Each type of chunk typically has a different internal structure, that could be numerical data, text, or raw data. It is also possible to include other IFF files as if they are chunks (note that they have the same structure: four letters followed with length) and some formats use this. There are standard chunks that could be present in any IFF file, such as ‘AUTH’ (containing text with information about author of the file), ‘ANNO’ (containing text with annotation, usually name of the program that created the file), ‘NAME’ (containing text with name of the work in the file), ‘VERS’ (containing file version), ‘(c) ’ (containing text with copyright information). There are also chunks that are common among a number of formats, such as ‘CMAP’ which holds color palette in ILBM, ANIM and DR2D files (pictures, animations and vector pictures). There are chunks that have a common name but hold different data such as ‘BODY’ which could store an image in an ILBM file and sound in an 8SVX file. And finally, there are chunks unique to their file type. Some programs that create IFF files add chunks to them with their internal data; these same files can later be read by other programs without any disruption (because their parsers could skip uninteresting chunks) which is a great advantage of IFF and similar formats.
Read more about this topic: Interchange File Format
Famous quotes containing the word structure:
“Man is more disposed to domination than freedom; and a structure of dominion not only gladdens the eye of the master who rears and protects it, but even its servants are uplifted by the thought that they are members of a whole, which rises high above the life and strength of single generations.”
—Karl Wilhelm Von Humboldt (17671835)
“... the structure of our public morality crashed to earth. Above its grave a tombstone read, Be toleranteven of evil. Logically the next step would be to say to our commonwealths criminals, I disagree that its all right to rob and murder, but naturally I respect your opinion. Tolerance is only complacence when it makes no distinction between right and wrong.”
—Sarah Patton Boyle, U.S. civil rights activist and author. The Desegregated Heart, part 2, ch. 2 (1962)
“There is no such thing as a language, not if a language is anything like what many philosophers and linguists have supposed. There is therefore no such thing to be learned, mastered, or born with. We must give up the idea of a clearly defined shared structure which language-users acquire and then apply to cases.”
—Donald Davidson (b. 1917)