[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2 ^$DEVICE

FreeM implements several important pieces of functionality in the ^$DEVICE SSV.

The first subscript of ^$DEVICE represents the I/O channel of an OPENed device.

The following values for the second subscript are supported:

EOF +R -U -D

Returns 1 if the I/O channel has encountered an end-of-file condition; 0 otherwise. Only valid if the I/O channel is connected to a sequential file.

LENGTH +R -U -D

Returns the length of the file connected to the I/O channel. Only valid if the I/O channel is connected to a sequential file.

MNEMONICSPACE +R -U -D

Returns the current mnemonic-space in use for the referenced I/O channel. Always X364 for terminals and blank for sequential files.

DSW +R +U -D

Sets or returns the current Device Status Word controlling terminal characteristics. Only valid for I/O channel 0.

TERMINATOR +R +U -D

Sets or returns the READ terminator for the specified I/O channel. Must be either $C(13,10) or $C(10). Currently only supported for socket devices (those having an I/O channel of 100-255).

Example

The following example M code opens /etc/freem.conf and reads its contents line-by-line until the end of the file is reached.

 
 SET ^$JOB($JOB,"IOPATH")="/etc"   ; set I/O path to /etc
 OPEN 1:"freem.conf/r" ; open freem.conf for reading
 ;
 ; read until we run out of lines
 ;
 FOR  USE 1 READ LINE USE 0 QUIT:^$DEVICE(1,"EOF")  D
 . WRITE LINE,!
 ;
 CLOSE 1
 QUIT

[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by root on October 14, 2020 using texi2html 1.82.