Basic Notation for Representing RIFF Files

The following table summarizes the elements of the RIFF notation required for representing sample RIFF files:

Notation   Description  

<ckID> (<ckData>)      
    The chunk with ID <ckID> and data <ckData>. The <ckID> field is a four-character code that may be enclosed by single quotes for emphasis.  
    For example, the following notation describes a “RIFF” chunk with a form type of “QRST.” The data portion of this chunk contains a “FOO” subchunk.  
    RIFF('QRST' FOO(17 23))  
    The following example describes an “ICOP” chunk containing the string “Copyright Encyclopedia International.”:  
    'ICOP' ("Copyright Encyclopedia International."Z)  
<number>[<modifier>]      
    A number consisting of an optional sign (+ or -) followed by one or more digits and modified by the optional <modifier>. Valid <modifier> values follow:  
    <modifier> Meaning
    none 16-bit number in decimal format
    H 16-bit number in hexadecimal format
    C 8-bit number in decimal format
    CH 8-bit number in hexadecimal format
    L 32-bit number in decimal format
    LH 32-bit number in hexadecimal format

    Several examples follow:  
    0 65535 -1 0L 4a3c89HL -1C 21HC  
    Note that -1 and 65535 represent the same value. The application reading this file must know whether to interpret the number as signed or unsigned.  
'<chars>'      
    A four-character code (32-bit quantity) consisting of a sequence of zero to four ASCII characters (<chars>) in the given order. If <chars> is less than four characters long, it is implicitly padded on the right with blanks. Two single quotes is equivalent to four blanks. Examples follow.  
    'RIFF' 'xyz' ''  
    <chars> can include escape sequences, which are combinations of characters introduced by a backslash (\) used to represent other characters. Escape sequences are listed in the following section.  
"<string>"[<modifier>]      
    The sequence of ASCII characters contained in <string> and modified by the optional modifier <modifier>. The quoted text can include any of the escape sequences listed in the following section. Valid <modifier> values follow:  
    <modifier> Meaning
    none No NULL terminator or size prefix.
    Z String is NULL-terminated
    B String has an 8-bit (byte) size prefix
    W String has a 16-bit (word) size prefix
    BZ String has a byte-size prefix and is NULL-terminated
    WZ String has a word-size prefix and is NULL-terminated

    NULL-terminated means that the string is followed by a character with ASCII value 0. A size prefix is an unsigned integer, stored as a byte or a word in Intel format preceding the string characters, that specifies the length of the string. In the case of strings with BZ or WZ modifiers, the size prefix specifies the size of the string without the terminating NULL.  
    The various string formats are described in “Storing Strings in RIFF Chunks,” later in this chapter.  
    Examples follow:  
    "No prefix, no NULL terminator" "No prefix, NULL terminator"Z "Byte prefix, NULL terminator"BZ