## Memory Connection

After an image is connected, a part of it should be brought into virtual memory. The access type for this virtual memory area (ReadOnly or ReadWrite) depends on the type of image connection.

            SUBROUTINE GDF_GEMS (MS, IS, BLC, TRC, ADDR, FORM, ERROR)
      ----------------------------------------------------------------------
       GDF  Get Memory Slot
            MS      I       Memory Slot number              Output
            IS      I       Image Slot number               Input
            BLC     I(4)    Bottom Left Corner              Input
            TRC     I(4)    Top Right Corner                Input
            ADDR    I       Virtual memory address          Output
            FORM    I       Type of data                    Input
            ERROR   L       Logical error flag              Output
      ----------------------------------------------------------------------

GDF_GEMS reads a subset of the image connected to slot IS into a memory area (memory slot MS) located at address ADDR. The image subset is "incarnated" into the specified data type FORM, which may be different from the image data type. When BLC(i) and TRC(i) are set to zero, they default to the current image dimension (i.e BLC(i)=1 and TRC(i)=Dim(i)). After this routine, virtual memory address ADDR is the start of an array of type FORM containing an incarnation of the image subset that can be used for further processing.

            SUBROUTINE GDF_FRMS (MS,ERROR)
      ----------------------------------------------------------------------
       GDF  FRee Memory Slot
      ----------------------------------------------------------------------

GDF_FRMS Frees the memory slot MS. If the connected image was connected with write access, the image is updated. The memory slot is no longer available after this operation.

            SUBROUTINE GDF_UPMS (MS,ERROR)
      ----------------------------------------------------------------------
       GDF  UPdate Memory Slot
      ----------------------------------------------------------------------

GDF_UPMS Updates the image connected to the memory slot MS. The memory slot is left unmodified. This routine is provided for safety measures.

The I/O (or mapping) are thus only done in the GDF_something routines, in a system dependent way. All data format translation (incarnation in a different type, or machine dependent data types) are done at this level. This allows a transparent operation in an heterogeneous environment.