### Directories

GREG incorporates a fairly sophisticated plot architecture, which allows the user to organize its plot in logical elements. The organisation is like a directory tree, with graphic segments attached to a “directory”. Directories as a whole (and all their subdirectories) can be manipulated as single entities. While this organisation is mostly transparent for simple plots, it can help organize more complex drawings, specially when the user uses the capability to save subtrees and reincorporate them later in a plot.

One or more graphic segments are created for each GREG command. The graphic segment is the smallest entity recognized in the plot. The directory architecture is under user-control, although some applications layered on GREG may automatically create their own plot organisation. Directories can be created using command CREATE DIRECTORY. The top directory is named '<', and cannot be accessed by the user (you cannot type CD <). Directories attached to the top directory are named “main directories”. To create a main directory, use the following syntax:

    CREATE DIRECTORY <MAIN

where MAIN is the name of the directory to be created. The command

    CREATE DIRECTORY SUB

creates a subdirectory from the current working directory, for example <MAIN<SUB.

The user can move across the directory structure using command CHANGE DIRECTORY (abbreviation CD), print his current working directory using command DISPLAY DIRECTORY (abbreviation PWD). Newly created graphic segments are attached to the current working directory. A whole directory can be erased using command CLEAR DIRECTORY, saved on a metacode file for later use by command EXPORT.

Directories and segments have attributes (pen colour and thickness, transfer function for images, visibility and depth) which can be edited using command CHANGE. Directories and segment can be made invisible by the CHANGE VISIBILITY command; this is a reversible action until the COMPRESS command has been used to effectively destroy all invisible segments and directories.

Each directory may have its own coordinate system attached. When created, subdirectories inherit the coordinate system from their parent directory. The coordinate system is automatically modified by the SET BOX and LIMITS commands typed within the directory. This feature allows to maintain several coordinate systems in a plot. However, the user must then realize that user coordinates may change when changing from one directory to another, as for example:

    LIMIT 0 1 0 1
    CREATE DIRECTORY NEW
    CHANGE DIRECTORY NEW
    LIMIT 0 2 0 2
    DRAW RELOCATE 0.5 0.5 /USER
    CHANGE DIRECTORY ..
    DRAW      ! User coordinates are now (0.25, 0.25)