    ! Fortran interface to EDWIN.

    from Edwin include Specs
    from Edwin include Types
    from Edwin include Shapes

    external routine INIT FOR (integer name DEVICE TYPE)
       on 14 start
           Terminate Edwin
           Print string ("EDWIN error - ".Edwin error(event_sub))
           newline
           stop
       finish
       INITIALISE FOR (DEVICE TYPE)
    end

    external routine MOVE A (integer name X, Y)
       MOVE ABS (X, Y)
    end

    external routine MOVE R (integer name DX, DY)
       MOVE REL (DX, DY)
    end

    external routine LINE A (integer name X, Y)
       LINE ABS (X, Y)
    end

    external routine LINE R (integer name DX, DY)
       LINE REL (DX, DY)
    end

    external routine MARK A (integer name N, X, Y)
       MARKER ABS (N, X, Y)
    end

    external routine MARK R (integer name N, DX, DY)
       MARKER REL (N, DX, DY)
    end

    external routine CHAR (integer name SYM)
       CHARACTER (SYM)
    end

    external routine STR ON (integer name STREAM)
       STORE ON (STREAM)
    end

    external routine V ON (integer name STREAM)
       VIEW ON (STREAM)
    end

    external routine ASPECT RAT (integer name MODE)
       ASPECT RATIOING (MODE)
    end

    external routine F WINDOW (integer name XL, XR, YB, YT)
       WINDOW (XL, XR, YB, YT)
    end

    external routine F VIEWPORT (integer name XL, XR, YB, YT)
       VIEWPORT (XL, XR, YB, YT)
    end

    external routine S COLOUR (integer name COLOUR)
       SET COLOUR (COLOUR)
    end

    external routine S COLOUR MODE (integer name MODE)
       SET COLOUR MODE (MODE)
    end

    external routine S LINE STYLE (integer name STYLE)
       SET LINE STYLE (STYLE)
    end

    external routine S CHAR SIZE (integer name SIZE)
       SET CHAR SIZE (SIZE)
    end

    external routine S MARKER SIZE (integer name S)
       SET MARKER SIZE (S)
    end

    external routine S CHAR ROT (integer name ROT)
       SET CHAR ROT (ROT)
    end

    external routine S CHAR QUALITY (integer name WHICH)
       SET CHAR QUALITY (WHICH)
    end

    external routine S CHAR FONT (integer name WHICH)
       SET CHAR FONT (WHICH)
    end

    external routine S CHAR SLANT (integer name ANGLE)
       SET CHAR SLANT (ANGLE)
    end

    external routine S CHORD STEP (integer TO)
       SET CHORD STEP (TO)
    end

    external routine S SHADE MODE (integer TO)
       SET SHADE MODE (TO)
    end

    external routine F DRIVE DEVICE (integer name COM, X, Y)
       DRIVE DEVICE (COM, X, Y)
    end

    external routine S COLOUR MAP (integer name A, B, C, D)
       SET COLOUR MAP (A, B, C, D)
    end

    external routine spec edwin text alias "EDWIN_TEXT" (string (255) STR)

    !! A Fortan interface for the routine TEXT on EMAS
    !
    !%external %routine F TEXT %alias "TEXT" (%integer %name S, N)
    !   %integer L, M
    !   %string (255) ST
    !   L = N&255
    !   %if L=0 %then ST="" %else %start
    !      LENGTH(ST) = L
    !      %begin
    !         %byte %integer %array %name SBYTE
    !         %byte %integer %array %format F(1:L)
    !         SBYTE == ARRAY(ADDR(S),F)
    !         CHARNO(ST,M) = SBYTE(M) %FOR M=L,-1,1
    !      %end
    !   %finish
    !   EDWIN TEXT (ST)
    !%end

    ! A Fortran interface for the routine TEXT on VMS

    record format strgf (short len, thing, integer adr)

    external routine ftext alias "TEXT" (record (strgf) name str)
       string (255) ds
       byte name b
       integer I
       b == byte integer (str_adr)
       ds = ""
       ds = ds.to string (b) and b == b[1] for I = 1, 1, str_len
       edwin text (ds)
    end

    end of file