A Sample RIFF Form Definition and RIFF Form

The following example defines <GOBL-form>, the hypothetical RIFF form of type “GOBL.” To fully document a new RIFF form definition, a developer would also provide detailed descriptions of each file element, including the semantics of each chunk and sample files documented using the standard notation.

<GOBL-form> <189>        RIFF( 'GOBL'                                         // RIFF form header
                                       [<org-ck>]                                // Origin chunk (default (0,0,0))
                                       <obj-list> )                                // Series of graphical objects

<org-ck> <189>                 org( <origin:3D_POINT> )                // Origin of object list

<obj-list> <189>         LIST('obj' { <sqr-ck>  |                // An object is: a square
                                                        <circ-ck> |                //  or a circle
                                                        <poly-ck>  } . . .  )        //  or a polygon

<sqr-ck> <189>                 sqr( <pt1:3D_POINT>                                // one vertex
                                         <pt2:3D_POINT>                                // another vertex
                                     <pt3:3D_POINT> )                        // a third vertex

<circ-ck> <189>         circ( <center:3D_POINT>                 // center of circle
                                      <circumPt:3D_POINT> )         // a point on the circumference

<poly-ck> <189>                poly( <pt:3D_POINT> . . .  )               // list of points in a polygon

<3D_POINT> <189>        struct                               // defined in "gobl.h"
                                {
                                        INT x;                          // x-coordinate
                                        INT y;                          // y-coordinate
                                        INT z;                          // z-coordinate
                                } 3D_POINT

Sample RIFF Form

The following sample RIFF form adheres to the form definition for form type GOBL. The file contains three subchunks:

An “INFO” list

An “org” chunk

An “obj” chunk

The “INFO” list and “org” chunk each have two subchunks. The “INFO” list is a registered global chunk that can be used within any RIFF file. The “INFO” list is described in the “The INFO List Chunk,” later in this chapter.

Since the definition of the GOBL form does not refer to the INFO chunk, software that expects only “org” and “obj” chunks in a GOBL form would ignore the unknown “INFO” chunk.

RIFF( 'GOBL'
            LIST('INFO'                        // INFO list containing filename and copyright
                            INAM("A House"Z)
                            ICOP("(C) Copyright Joe Inc. 1991"Z)
                        )

                org (2, 0, 0)                // Origin of object list

                LIST('obj'                         // Object list containing two polygons
                                poly(0,0,0  2,0,0  2,2,0, 1,3,0, 0,2,0)
                                poly(0,0,5  2,0,5  2,2,5, 1,3,5, 0,2,5)
                        )
)                                                        // End of form