Basic Notation for Representing RIFF Files
The following information summarizes the elements of the RIFF notation required
for representing sample RIFF files:
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 in Intel format, where <number> is an optional sign
(+ or -) followed by one or more digits and modified by the optional <modifier>.
Valid <modifier> values follow:
Modifier
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 (\) and 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
none
No NULL terminator or size prefix.
Z
String is NULL-terminated
B
String has an 8-bit (byte) size prefix
US
String has a 16-bit (ushort) 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 referred to above are discussed in "Storing Strings
in RIFF Chunks," following later in this section.,
Examples follow:
"No prefix, no NULL terminator"
"No prefix, NULL terminator"Z
"Byte prefix, NULL terminator"BZ
[Back: Notation for Representing Sample RIFF Files]
[Next: Escape Sequences for Four-Character Codes and String Chunks]