Module Simula

Class RTS_BASICIO

Direct Known Subclasses:
RTS_CLASS, RTS_PROCEDURE

public class RTS_BASICIO extends RTS_ENVIRONMENT
System class BASICIO.

The standard I/O facilities are contained by the class "BASICIO". They are available to the program through block prefixing as described below.

Note: The use of upper case letters indicates that this identifier is inaccessible to the user program (cf 1.10).

The user's main program acts as if it were embedded as follows:

             BASICIO (inlength, outlength) begin  ! prefixed block;
                   inspect SYSIN do
                   inspect SYSOUT do
                   begin  <external-head> <program>  end
             end prefixed block
 
In any program execution the unique instance of this prefixed block constitutes the system head of the outermost quasi-parallel system (see 7.2).

The values of inlength and outlength are implementation-defined; they normally depend upon the actual device(s) associated with SYSIN and SYSOUT (the standard input and output files).

SYSIN and SYSOUT may represent the input and output features of an interactive terminal, in which case inlength and outlength are probably equal. In other cases, for example batch runs, SYSIN may represent record-oriented input and SYSOUT may represent line printer oriented output. Typical values of inlength and outlength would then be 80 and 132, resp.

A program may refer to the corresponding file objects through sysin and sysout respectively. Most attributes of these file objects are directly available as the result of the connection blocks enclosing the program.

Note: Within this chapter the term "file object" refers to an instance of one of the classes "in(byte)file", "out(byte)file" and "direct(byte)file" or of a subclass of one of these.

The overall organization of "BASICIO" is as follows:

  ENVIRONMENT class BASICIO (INPUT_LINELENGTH, OUTPUT_LINELENGTH);
                     integer INPUT_LINELENGTH, OUTPUT_LINELENGTH;
              begin ref (infile) SYSIN; ref (printfile) SYSOUT;
                 ref (infile)    procedure sysin;   sysin  :- SYSIN;
                 ref (printfile) procedure sysout;  sysout :- SYSOUT;
 
                 procedure terminate_program;
                 begin ... ;  goto STOP  end terminate_program;
 
                      class file ............................ 10.1 ;
                 file class imagefile ....................... 10.3 ;
                 file class bytefile ........................ 10.8 ;
            imagefile class infile .......................... 10.4 ;
            imagefile class outfile ......................... 10.5 ;
            imagefile class directfile ...................... 10.6 ;
              outfile class printfile ....................... 10.7 ;
             bytefile class inbytefile ...................... 10.9 ;
             bytefile class outbytefile ..................... 10.10 ;
             bytefile class directbytefile .................. 10.11 ;
 
                 SYSIN  :- new infile("...");    ! Implementation-defined
                 SYSOUT :- new printfile("..."); ! files names;
                 SYSIN.open(blanks(INPUT_LINELENGTH));
                 SYSOUT.open(blanks(OUTPUT_LINELENGTH));
                 inner;
           STOP: SYSIN.close;
                 SYSOUT.close
           end BASICIO;
 

Note: The files SYSIN and SYSOUT are opened and (if not done explicitly prior to program termination) closed within "BASICIO", i.e. outside the program itself.

The class file and its predefined subclasses are available at any block level of a program (but see (2) of 5.5.1). An implementation may restrict, in any way, the use of these classes for class or block prefixing. An implementation may provide additional subclasses of class file.

Within a program, an object of a subclass of file may represent an external file. The effect of several such file objects representing the same external file is implementation-defined.

The procedure "terminate_program" terminates program execution. It closes SYSIN and SYSOUT. It is implementation-dependent with respect to whether or not other open files are also closed.

Link to GitHub: Source File.

Author:
SIMULA Standards Group, Øystein Myhre Andersen
  • Constructor Details

    • RTS_BASICIO

      public RTS_BASICIO(RTS_RTObject staticLink)
      Constructor
      Parameters:
      staticLink - pointer to enclosing block
  • Method Details