- 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 simula.runtime.RTS_File
RTS_File._CreateAction
Nested classes/interfaces inherited from class simula.runtime.RTS_RTObject
RTS_RTObject.ForElt, RTS_RTObject.ForList, RTS_RTObject.ForListIterator, RTS_RTObject.OperationalState, RTS_RTObject.RTS_BOOLEAN_ARRAY, RTS_RTObject.RTS_BOUNDS, RTS_RTObject.RTS_CHARACTER_ARRAY, RTS_RTObject.RTS_INTEGER_ARRAY, RTS_RTObject.RTS_LABEL, RTS_RTObject.RTS_LONG_REAL_ARRAY, RTS_RTObject.RTS_NAME<T>, RTS_RTObject.RTS_REAL_ARRAY, RTS_RTObject.RTS_REALTYPE_ARRAY, RTS_RTObject.RTS_REF_ARRAY<T>, RTS_RTObject.RTS_TEXT_ARRAY, RTS_RTObject.SingleElt<T>, RTS_RTObject.SingleTValElt, RTS_RTObject.StepUntil, RTS_RTObject.UncaughtExceptionHandler, RTS_RTObject.WhileElt<T>, RTS_RTObject.WhileTValElt
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
The variable ENDFILE.private InputStream
The InputStream used.Fields inherited from class simula.runtime.RTS_Bytefile
_BYTESIZE, _MAXBYTE
Fields inherited from class simula.runtime.RTS_File
_APPEND, _ASK_PAPER, _BOT_MARGIN, _CANREAD, _CANWRITE, _CHARSET, _CREATE, _DEFAULT_BYTESIZE, _FONT, _LEFT_MARGIN, _OPEN, _ORIENTATION, _PURGE, _RIGHT_MARGIN, _SYNCHRONOUS, _TOP_MARGIN, FILE_NAME
Fields inherited from class simula.runtime.RTS_ENVIRONMENT
_STARTTIME, CURRENTDECIMALMARK, CURRENTLOWTEN, EXCEPTION_HANDLER, maxint, maxlongreal, maxreal, minint, minlongreal, minreal, simulaReleaseID
Fields inherited from class simula.runtime.RTS_RTObject
_CORUT, _CTX, _CUR, _DL, _INPUT_LINELENGTH, _JTX, _OUTPUT_LINELENGTH, _SL, _STATE, _SYSIN, _SYSOUT, NOTEXT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_STM()
Method representing the Statements in this Block
This method is virtual and must be redefined in blocks.boolean
close()
Procedure close.boolean
endfile()
Procedure endfile.int
in2byte()
Procedure in2byte.int
inbyte()
Procedure inbyteProcedure intext.boolean
open()
Procedure open.Methods inherited from class simula.runtime.RTS_Bytefile
bytesize
Methods inherited from class simula.runtime.RTS_File
doCreateAction, doPurgeAction, filename, isopen, setaccess, setCharset, setFont, setMargins, TRACE_OPEN, trySelectFile
Methods inherited from class simula.runtime.RTS_BASICIO
toString
Methods inherited from class simula.runtime.RTS_ENVIRONMENT
_char, _IPOW, _IS, abs, abs, abs, addepsilon, addepsilon, arccos, arcsin, arctan, arctan2, Char, clocktime, cos, cosh, cotan, cputime, datetime, decimalmark, DEFEXCEPTION, digit, discrete, draw, edfix, edit, edit, edit, edit, edit, edtime, entier, Erlang, error, exp, getIntInfo, getTextInfo, giveIntInfo, giveTextInfo, hash, histd, histo, isochar, isorank, letter, linear, ln, loadChar, log10, lowcase, lowerbound, lowten, max, max, max, max, max, min, min, min, min, min, mod, negexp, normal, Poisson, printStaticChain, printThreadList, randint, rank, rem, rts_utility, sign, simulaid, sin, sinh, sqrt, storeChar, subepsilon, subepsilon, tan, tanh, uniform, upcase, upperbound, waitSomeTime
Methods inherited from class simula.runtime.RTS_RTObject
_ASGSTR, _ASGTXT, _GOTO, _JUMPTABLE, _JUMPTABLE, _LABEL, _PRE_LABEL, _PRE_TABLE, _SIM_LABEL, _TXTREL_EQ, _TXTREL_GE, _TXTREL_GT, _TXTREL_LE, _TXTREL_LT, _TXTREL_NE, _VALUE, arrayValue, BBLK, blanks, BPRG, call, call, CONC, copy, detach, detach, detach, doubleValue, EBLK, edObjectAttributes, edObjectIdent, floatValue, getErrorMessage, intValue, isDetachUsed, isQPSystemBlock, objectTraceIdentifier, objectTraceIdentifier, objectValue, procValue, resume, resume, resume, swapCoroutines, sysin, sysout, terminate_program, TRACE_GOTO, TRF_EQ, TRF_NE
-
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_RTObject
Method representing the Statements in this Block
This method is virtual and must be redefined in blocks.- Overrides:
_STM
in 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 inbyteshort 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
-