# Programming

- Initialisation
  The GTVIRT library is initialized by a a call to
  SUBROUTINE INIT_GTVIRT
  followed by a call to SUBROUTINE GTINIT(LX,LY,LUNG,LUNH,NAME,USER_ROUTINE
  where
  - LX,LY are the page dimensions
  - LUNG,LUNH are logical unit numbers for graphic output and hardcopies, to be supplied by the caller
  - NAME is a character string giving the name of the top directory of the drawings. NAME should start with a sign.
  - USER_ROUTINE is a user-supplied subroutine called when moving from a sub-directory to the other. It must provide to the GTVIRT information about coordinate systems. The only suitable routine is available in the GREG program, and is named GREG_USER

- The GTVIEW subroutine

  The GTVIEW subroutine is one of the main control routine in the library. It is used to send drawing commands from the internal metacode to the graphic device, but also to performs other actions on the metacode.

  SUBROUTINE GTVIRT(Mode)

  where Action is a character string which can be

  - 'Append'
    Plot all metacode starting from last drawn vector
  - 'Rewind'
    Clear the screen, and plot the whole metacode from first vector
  - 'Update'
    Update the screen (all windows) if needed
  - 'Limits'
    Recompute the plot limits (Bounding Box)
  - 'Purge'
    Delete images associated to all windows
  - 'Delete'
    Delete images associated to the current window
  - 'Zap'
    Delete cache-bitmap associated to images
  - 'Sleep'
    Set screen update off
  - 'Wake'
    Set screen update on