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 >   RIFF ( 'GOBL'         /* RIFF form header    */
                      [<org-ck>]      /* Origin chunk        */
                                         (default (0,0,0))   */
                       <obj-list>)    /* Series of graphical
                                         objects             */

<org-ck>        org(    <origin:3D_POINT> )
                                      /* Object-list origin  */

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

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

<circ-ck>      circ(   <center:3D_POINT>      /* Center of circle */
                        <circumPt:3D_POINT> )  /* Point on circumference */

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

<3D_POINT>     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:

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 INFO List Chunk.

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 file name and copyright */
              INAM("A House"Z)
              ICOP("(C) Copyright Encyclopedia International 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                              */


[Back: Extended Notation for Representing RIFF Form Definitions]
[Next: Storing Strings in RIFF Chunks]