Import directive

An import directive inserts another CFDG file into the input stream right after the directive. Context Free/CFDG can handle imported files importing other files in turn with no real limit on import depth. An import directive looks like the keyword import followed by the name of the CFDG file to import. This name can either be one of the items in the Examples menu or a file on your hard disk. For files on your hard disk you supply the relative path from the directory where the importing CFDG file resides. This means that if a new CFDG file imports another CFDG file (not an example) then you need to save it to disk first so that Context Free/CFDG knows where to base the relative path.

If the file to import is in a different directory or has spaces in its relative path then you must put the relative path in quotes. Quotes are optional if the import file is in the same directory, has no spaces in its name, and ends in .cfdg

Importing into a Namespace
The shapes, paths, global variables, and functions imported via an import directive are imported into the same namespace as the importing cfdg file. The file can be imported into a namespace under the current namespace using the import@ feature. The EITHER shape in this cfdg file is distinct from the EITHER shape in mtree.cfdg. import@foo imports mtree.cfdg into the foo namespace and the only way to invoke its shapes is to prepend foo:: to its shape names.