    ! Utilites for Graphpack on VAX under VMS.

    external routine spec ARRAY (name N, integer ADDR, LB, UB)
    record format STRING FM (short LENGTH, THING, integer ADDRESS)

    from Imp include Lognames
    external string (127) fn spec UINFS alias "EDWIN_UINFS" (integer I)
    external string (63) fn spec ITOSTR alias "ITOS" (integer I,M)
    external string (127) fn spec RTOSTR alias "RTOS" (long real R, integer FP, AP)
    external routine spec read record (integer name len, integer adr)
    external routine spec print record (integer len, integer adr)

    routine JOBINF (string (*) name MACHINE, JOBNAME, integer M,
                     string (*) name DELIVERY, integer N)
       MACHINE = "(".UINFS(10).")   "
       JOB NAME <- UINFS (1)
       JOB NAME = JOB NAME." " while LENGTH(JOB NAME)<M
       DELIVERY <- UINFS(2)
    end

    routine FILEINF (integer N, string (*) name FILE, integer name FLAG)
       external string (127) fn spec out file name
       integer S = outputstream
       on 9 start
           FLAG = event_extra
       finish
       FLAG = 0
       select output (n)
       FILE = out file name
       select output (s)
    end

    ! The source of GRAFIO for VAX VMS (IO in fixed 80 byte records)
    external routine GRAFIO alias "EDWIN_GRAFIO" (integername F, integer IO, AD)

    ! F < 0 => End of file
    ! IO = 0 => read, IO = 1 => write
    ! AD = address of buffer, unless in range 0 - 99 when -
    ! 0 => close current I/O, 1 - 99 => open on appropriate channel

       const integer IN = 0, OUT = 1
       own integer in stm = 0
       own integer out stm = 0
       own string (80) TEMP, JCL
       integer STATE, STM

       routine CLOSE IN
          integer S = input stream
          select input (in stm)
          close input
          select input (s)
          in stm = 0
       end

       routine CLOSE OUT
          integer S = output stream
          select output (out stm)
          close output
          select output (s)
          out stm = 0
       end

       if IO = IN start
           if 0<=AD<=99 start
               if AD=0 then CLOSE IN else in stm = ad
               return
           finish
           stm = input stream
           select input (in stm)
           read record (f, AD)
           select input (stm)
       finish else start
           if 0<=AD<=99 start
               if AD=0 then CLOSE OUT else out stm = ad
               return
           finish
           stm = output stream
           select output (out stm)
           print record (80, ad)
           select output (stm)
       finish
       F = 0
    end

    external string (1) fn PLU TITLE
       result = ""
    end

    end of file