Class SysFile

java.lang.Object
svm.env.SysFile

public abstract class SysFile extends Object

File Handling.

Link to GitHub: Source File.

Author:
Simula Standard, S-Port: The Environment Interface, Øystein Myhre Andersen
  • Field Details

    • datasetSpecs

      private static Vector<Dataset> datasetSpecs
      The set of DatasetSpecs
  • Constructor Details

    • SysFile

      public SysFile()
      Default Constructor
  • Method Details

    • addRTFile

      private static int addRTFile(Dataset spec)
      Add a DatasetSpec to the set of DatasetSpec
      Parameters:
      spec - the DatasetSpec to add
      Returns:
      key suitable to lookup the Dataset
    • lookup

      private static Dataset lookup(int key)
      Lookup a DatasetSpec by its 'key'
      Parameters:
      key - the DatasetSpec key to use
      Returns:
      a DatasetSpec by its 'key'
    • gdspec

      public static void gdspec()

      Get data set specification of system files

      Visible sysroutine("GDSPEC") GDSPEC;
      import range(1:3) code; infix(string) spec;
      export integer filled  end;
      
      Runtime Stack
         ..., code, spec'addr, spec'ofst, specnchr →
         ..., filled
      

      Depending on 'code', the DatasetSpec String is returned in the given 'spec' and the length 'filled' is pushed onto the Runtime stack.

      Code Dsetspec
        1  What is the data set specification for SYSIN, the file will be opened as infile.
        2  What is the data set specification for SYSOUT, the file will be opened as printfile.
        3  What is the data set specification for SYSTRACE, the file will be opened as printfile.
      
    • getlpp

      public static void getlpp()

      Get lines per page

      Visible sysroutine("GETLPP") GETLPP;
      import range(1:MAX_KEY) key; export integer lpp end;
      
      Runtime Stack
         ..., key →
         ..., lpp
      

      Pop off the argument 'key' and
      push the 'lpp' onto the Runtime stack

    • opfile

      public static void opfile()

      Open data set

      Visible sysroutine("OPFILE") OPFILE;
      import infix(string)    spec;   -- dsetspec;
             range(0:MAX_FIL) type;   -- dsettype;
             infix(string)    action;
             integer          imglng; -- img_lng;
      export range(0:MAX_KEY) key;    -- filekey;
      end;
      
      Runtime Stack
         ..., spec, type, action, imglng →
         ..., key
      

      A new DatasetSpec is created based upon the arguments. That spec is added and the lookup 'key' is returned.

      	spec:	Identification of a data set.
      	type:	The type code of the corresponding file.
      	action:	A copy of the second parameter to the Simula open procedure, see below.
      	imglng:	The length of the images in the file.
      	Key:	The key associated with the data set, or zero.
      
    • clfile

      public static void clfile()

      Close data set

      Visible sysroutine("CLFILE") OPFILE;
      import range(0:MAX_KEY) key;    -- filekey;
             infix(string) action;
      end;
      
      Runtime Stack
         ..., key, action →
         ...
      

      The data set associated with 'key' is closed using the given 'action'.

    • printo

      public static void printo()

      Printoutimage

      Visible sysroutine("PRINTO") PRINTO;
      import range(1:MAX_KEY) key; infix(string) image; integer spc;  end;
      
      Runtime Stack
         ..., key, image'oaddr, image'ofst, image'nchr, spc →
         ...
      

      The image is printed from the current line position.

      key:	The key associated with the data set.
      image:	The image to be printed.
      spc:	Vertical spacing.
      

      Note: Key is ignored. 'key == 2' SYSOUT is always used.

      Note: Negative Vertical spacing is not implemented. Only spc >= 1 is accepted, otherwise error.

    • INIMAG

      public static void INIMAG()

      Inimage

      Visible sysroutine("INIMAG") fINIMA;
      import range(1:MAX_KEY) key; infix(string) image;
      export integer filled  end;
      
      Runtime Stack
         ..., key, image'oaddr, image'ofst, image'nchr →
         ..., filled
      
      Key:    The key associated with the data set.
      Image:  Input buffer.
      Filled: The number of characters placed in image.
      

      A record is read from the current position of the data set into the image. If the number of characters in the record exceeds the image length, the action taken is system dependent:

      • If the system permits partial record read, image.length characters are read, filled := image.length, and status 34 is returned. In this case the next inimage (on this data set) should continue reading from the next position in the partially read record.

      • If partial record reading is not possible, status error 12 is set and filled is set to zero; the remainder of the record is in this case skipped.

      Except for the case of partial record reading the data set will be positioned at the sequentially next record.

      Inimage is legal on infiles and directfiles only.

      This routine may change the value of the global variable status to one of the values given in app. C. If the status returned is non-zero, filled must be zero, except for the partial read case discussed above (status 12).

    • OUTIMA

      public static void OUTIMA()

      Outimage

      Visible sysroutine("OUTIMA")  fUTIMA;
      import range(1:MAX_KEY) key; infix(string) img  end;
      
      Runtime Stack
         ..., key, img'oaddr, img'ofst, img'nchr →
         ...
      
      
      Key: The key associated with the data set.
      img: A string to be output.
      

      If the file is of type 2 or 4, image is copied into the record at the current position of the data set, and the data set is positioned at the sequentially next record. On printfiles the image is printed from the current print position, without vertical spacing (i.e. the next print position is the next position on the same line); this is utilised by the Simula breakoutimage procedure.

      Outimage is legal on outfiles, printfiles and directfiles only. This routine may change the value of the global variable status to one of the values given in app. C.

    • BREAKO

      public static void BREAKO()

      Breakoutimage

      Visible sysroutine("BREAKO") BREAKO;
      import range(1:MAX_KEY) key; infix(string) img  end;
      
      Runtime Stack
         ..., key, img'oaddr, img'ofst, img'nchr →
         ...
      
      
      Key: The key associated with the data set.
      img: A string to be output
      

      The routine Breako will output the string img to the current record of the data set, beginning at the current position. The record should not be "closed" i.e. the next Breako (or Outima) will output to the same record, beginning at the new position. If this is not possible, Breako shall perform as Outima.

      On display terminals, Breako will output the string from the current cursor position, and leave the cursor positioned after the last charcter of img. Note that trailing blanks (of img) shall be output.

      On other external data sets, it may be necessary for the environment to buffer the output internally.

      The routine is legal for outfiles and printfiles only.

    • INBYTE

      public static void INBYTE()

      Inbyte

      Visible sysroutine("INBYTE") fINBYT;
      import range(1:MAX_KEY) key; export range(0:MAX_BYT) byte  end;
      
      Runtime Stack
         ..., key →
         ..., byte
      

      One byte is input from the current position of the data set, and the data set is positioned at the following byte.

      Key: The key associated with the data set.
      Byte: Value input.
      
    • OUTBYT

      public static void OUTBYT()

      Outbyte

      Visible sysroutine("OUTBYT") fUTBYT;
      import range(1:MAX_KEY) key; range(0:MAX_BYT) byte  end;
      
      Runtime Stack
         ..., key, byte →
         ...
      

      One byte is output to the current position of the data set, and the data set is positioned at the following byte.

      Key: The key associated with the data set.
      Byte: Value output.
      
    • newpag

      public static void newpag()

      New page

      Visible sysroutine("NEWPAG") NEWPAG;
      import range(1:MAX_KEY) key; end;
      
      Runtime Stack
         ..., key →
         ...
      

      The top-of-form action is performed on the data set, so that the next image will be printed on the first printable line of the following page.

      This is legal on printfiles only.

    • LOCATE

      public static void LOCATE()

      Locate record

      Visible sysroutine("LOCATE") fLOCAT;
      import range(1:MAX_KEY) key; integer loc  end;
      
      Runtime Stack
         ..., key, loc →
         ...
      

      key: The key associated with the data set.
      loc: Indicates the next record (directfile) or byte (directbytefile) position to be accessed.

      The position of the data set is changed so that the next record read or written will be record number loc of the data set (the first record is numbered 1).

      Locate is legal on directfiles and directbytefiles only

    • MXLOC

      public static void MXLOC()

      Maxloc

      Visible sysroutine("MAXLOC") MXLOC;
      import range(1:MAX_KEY) key; export integer res  end;
      
      Runtime Stack
         ..., key →
         ..., res
      

      key: The key associated with the data set.
      res: The result

      The routine Maxloc will give acces to the maximum value that can be used as parameter to Locate on the file referenced by key.

      Maxloc is legal on directfiles and directbytefiles only.

    • LSTLOC

      public static void LSTLOC()

      Last location

      Visible sysroutine("LSTLOC") LSTLOC;
      import range(1:MAX_KEY) key; export integer res  end;
      
      Runtime Stack
         ..., key →
         ..., res
      

      key: The key associated with the data set.
      res: The result

      The routine Lstloc will give access to the largest location of any written image in the file referenced by key.

      Lstloc is legal on directfiles and directbytefiles only.