Next: Appearances, Previous: Binary format, Up: Conventions

#### 4.1.9 Embedded objects and external-object references

Some object types (`LIST`, `INST`) allow references to other OOGL objects, which may appear literally in the data stream, be loaded from named disk files, or be communicated from elsewhere via named objects. GCL commands also accept geometry in these forms.

The general syntax is

          <oogl-object>  ::=
                 [ "{" ]
                     [ "define" symbolname ]
                     [ ["="] object-keyword ...
                          | "<" filename
                          | ":" symbolname ]
                 [ "}" ]

where "quoted" items are literal strings (which appear without the quotes), [bracketed] items are optional, and | denotes alternatives. Curly braces, when present, must match; the outermost set of curly braces is generally required when the object is in a larger context, e.g. when it is part of a larger object or embedded in a Geomview command stream.

For example, each of the following three lines:

                 { define fred   QUAD 1 0 0  0 0 1  0 1 0  1 0 0 }

                 { define fred = QUAD 1 0 0  0 0 1  0 1 0  1 0 0 }

                 { appearance { +edge } LIST { < "file1" } { : fred } }

                 VECT 1 2 0   2 0   0 0 0   1 1 2

is a valid OOGL object. The last example is only valid when it is delimited unambiguously by residing in its own disk file.

The ":" construct allows references to symbols, created with `define`. A symbol's initial value is a null object. When a symbol is (re)defined, all references to it are automatically changed.

The "`define` NAME" construct allows to define a global symbol for the given object. If "NAME" already references an object, then the old object is discarded and replaced by the new definition. See `(read ...)`. See `(hdefine ...)`.

The "<" construct causes a disk file to be read. Note that this isn't a general textual "include" mechanism; a complete OOGL object must appear in the referenced file.

Files read using "<" are sought first in the directory of the file which referred to them, if any; failing that, the normal search path (see `(load-path ...)`) is used. The default search looks first in the current directory, then in the Geomview data directories.

Again, white space and line breaks are insignificant, and "#" comments may appear anywhere.