!$IF LATTICE
! The following are added to cope with the changes made to the imp language
! by Lattice Logic Ltd
! The next release of their compiler will allow the line
! %from imp %include archaisms
! which will %include a file (not present in this version) to allow
! 'instream' and 'outstream' to be used - so the following functions can go
externalintegerfunction instream
result = inputstream
end
externalintegerfn outstream
result = outputstream
end
!
! The next changes are because the ECS IMP Compiler has the intrinsic functions
! 'intype' and 'outtype' to describe what the current I/O channels are attached to
! (This "user contributed set of routines supplied by Ian Young of Lattice to
! bridge this gap - they are likely to be part of the run-time environment at
! the next release of the compiler)
! IOTYPE
!
! What type of thing is a stream connected to?
!
! 11-Feb-86 JF Created
!
! Answers returned are as follows:
!
! -2 = can't tell
! -1 = terminal
! 0 = null stream
! 1 = none of these - probably (always?) a file
!
from IMP include RMS, Formats
external predicate spec Prober alias "IMP_PROBER" (integer Len, Add)
const integer FAB DEV TRM = 16_00 00 00 02
externalinteger function IO Type (record (SCB Fm) name S)
integer Ad = S_NameB_Base
record (Fab Fm) name Fab == S_Fd_Fab
if Ad # 0 and String (Ad) = "<null stream>" start
result = 0
else
if Prober (FAB BLN, Addr(Fab)) and -
Fab_BID = FAB BID and Fab_BLN = FAB BLN start
if Fab_DEV & FAB DEV TRM # 0 start
result = -1
else
result = 1
finish
else
result = -2
finish
finish
end
externalinteger fn In Type
result = IO Type (In SCB)
end
externalinteger fn Out Type
result = IO Type (Out SCB)
end
! End of "user contributed routines" from Lattice
externalstring (127)fn sysmess(integer i)
external string (127) fn spec mess alias "IMP_GET_MESSAGE" (integer i)
result = mess(i)
end
endoffile