Class RTS_Inbytefile
- All Implemented Interfaces:
Runnable
System class Inbytefile.
bytefile class inbytefile; begin
Boolean ENDFILE;
Boolean procedure endfile; endfile:= ENDFILE;
Boolean procedure open;
Boolean procedure close;
short integer procedure inbyte;
text procedure intext(t); text t;
ENDFILE:= true;
...
end inbytefile;
An object of the class "inbytefile" is used to represent a byte-oriented sequential input file.
Variable "ENDFILE" is true if there are no more bytes to read. The procedure "endfile" returns the value of ENDFILE.
Link to GitHub: Source File.
- Author:
- SIMULA Standards Group, Øystein Myhre Andersen
-
Nested Class Summary
Nested classes/interfaces inherited from class RTS_File
RTS_File._CreateAction -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanThe variable ENDFILE.private InputStreamThe InputStream used.Fields inherited from class RTS_Bytefile
_BYTESIZE, _MAXBYTEFields inherited from class RTS_File
_APPEND, _CANREAD, _CANWRITE, _CHARSET, _CREATE, _DEFAULT_BYTESIZE, _OPEN, _PURGE, _SYNCHRONOUS, FILE_NAMEFields inherited from class RTS_ENVIRONMENT
_STARTTIME, CURRENTDECIMALMARK, CURRENTLOWTEN, EXCEPTION_HANDLER, maxint, maxlongreal, maxreal, minint, minlongreal, minreal, simulaReleaseIDFields inherited from class RTS_RTObject
_CORUT, _CTX, _CUR, _DL, _INPUT_LINELENGTH, _JTX, _OUTPUT_LINELENGTH, _SL, _STATE, _SYSIN, _SYSOUT, _USR, startTimeMs -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription_STM()Method representing the Statements in this Block
This method is virtual and must be redefined in blocks.booleanclose()Procedure close.booleanendfile()Procedure endfile.intin2byte()Procedure in2byte.intinbyte()Procedure inbyte.Procedure intext.booleanopen()Procedure open.Methods inherited from class RTS_Bytefile
bytesizeMethods inherited from class RTS_File
doCreateAction, doPurgeAction, filename, isopen, setaccess, setCharset, TRACE_OPEN, trySelectFileMethods inherited from class RTS_BASICIO
terminate_program, toStringMethods inherited from class RTS_ENVIRONMENT
_char, abs, abs, abs, addepsilon, addepsilon, arccos, arcsin, arctan, arctan2, argv, blanks, Char, clocktime, confirmDialog, copy, cos, cosh, cotan, cputime, datetime, decimalmark, DEFEXCEPTION, digit, discrete, draw, edfix, edfix, edit, edit, edit, edit, edit, edit, edtime, edtime, entier, Erlang, error, exit, exp, fileChooser, hash, histd, histo, isochar, isorank, letter, linear, ln, loadChar, log10, lowcase, lowerbound, lowten, max, max, max, max, max, max, max, max, max, max, max, min, min, min, min, min, min, min, min, min, min, min, mod, negexp, normal, Poisson, printStaticChain, printThreadList, prompt, randint, rank, rem, sign, simulaid, sin, sinh, sqrt, storeChar, subepsilon, subepsilon, tan, tanh, uniform, upcase, upperbound, waitSomeTimeMethods inherited from class RTS_RTObject
_GOTO, _JUMPTABLE, _SIM_LABEL, _TREAT_GOTO_CATCH_BLOCK, _VALUE, arrayValue, BBLK, booleanValue, call, call, charValue, CONC, detach, detach, detach, doubleValue, EBLK, edObjectAttributes, edObjectIdent, floatValue, intValue, isDetachUsed, isQPSystemBlock, objectTraceIdentifier, objectTraceIdentifier, objectValue, procValue, resume, resume, resume, swapCoroutines, sysin, sysout, TRACE_GOTO
-
Field Details
-
inputStream
The InputStream used. -
_ENDFILE
protected boolean _ENDFILEThe variable ENDFILE.
-
-
Constructor Details
-
RTS_Inbytefile
Create a new _Inbytefile.- Parameters:
SL- staticLinkFN- file name
-
-
Method Details
-
_STM
Description copied from class:RTS_RTObjectMethod representing the Statements in this Block
This method is virtual and must be redefined in blocks.- Overrides:
_STMin classRTS_Bytefile- Returns:
- a pointer to this _RTObject
-
endfile
public boolean endfile()Procedure endfile.
Boolean procedure endfile; endfile:= ENDFILE;
- Returns:
- true if there are no more bytes to read.
-
open
public boolean open()Procedure open.
Boolean procedure open; if ... then begin ... ENDFILE := false; BYTESIZE := ... ! value of access mode BYTESIZE; open := OPEN := true; end open;- Returns:
- true if the file was successfully opened, otherwise false
-
close
public boolean close()Procedure close.
Boolean procedure close; if OPEN then begin ... ! see 10.1.2; ... ; OPEN := false; close := ENDFILE := true; end close;- Returns:
- false if the file is not open.
-
inbyte
public int inbyte()Procedure inbyte.
short integer procedure inbyte; if ENDFILE then error("..." ! End of file ;) else if ... ! no more bytes to read; then ENDFILE := true ! inbyte returns zero; else inbyte := ...! next byte of size BYTESIZE;The procedure "inbyte" returns the short integer value corresponding to the input byte. If there are no more bytes to read, a zero result is returned. If prior to an "inbyte" call ENDFILE is true, a run-time error occurs.
- Returns:
- the resulting integer value
- Throws:
RTS_SimulaRuntimeError- if inbyte fail
-
in2byte
public int in2byte()Procedure in2byte.- Returns:
- the resulting integer value
- Throws:
RTS_SimulaRuntimeError- if intext fail
-
intext
Procedure intext.
text procedure intext(t); text t; begin t.setpos(1); while t.more and not ENDFILE do t.putchar(char(inbyte)); if ENDFILE then t.setpos(t.pos-1); intext:- t.sub(1,t.pos-1) end intext;The procedure "intext" fills the frame of the parameter "t" with successive input bytes.
- Parameters:
t- the text frame to fill- Returns:
- the text frame
-