- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
RTS_Printfile
file class outfile; begin Boolean procedure open(fileimage); text fileimage; Boolean procedure close; procedure outimage; procedure outrecord; procedure breakoutimage; Boolean procedure checkpoint; procedure outchar(c); character c; procedure outtext(t); text t; text procedure FIELD(w); integer w; procedure outint(i,w); integer i,w; procedure outfix(r,n,w); long real r; integer n,w; procedure outreal(r,n,w); long real r; integer n,w; procedure outfrac(i,n,w); integer i,n,w; ... ; end outfile;
An object of the class "outfile" is used to represent an image-oriented sequential output file.
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
Fields inherited from class simula.runtime.RTS_Imagefile
_ENDFILE, image
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.void
Procedure breakoutimage.boolean
Procedure checkpoint.boolean
close()
Procedure close.boolean
Procedure open.void
outimage()
Procedure outimage.void
Procedure outrecord.protected void
writeImage
(String ident, String img, boolean blank) Output utility: Used by outimage, outrecord and breakoutimage.Methods inherited from class simula.runtime.RTS_Imagefile
inchar, infrac, inimage, inint, inreal, intext, lastitem, length, more, outchar, outfix, outfrac, outint, outreal, outreal, outtext, outtext, pos, setpos
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
-
writer
The underlying Writer.
-
-
Constructor Details
-
RTS_Outfile
Create a new _Outfile.- Parameters:
SL
- staticLinkFN
- FILENAME
-
-
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_Imagefile
- Returns:
- a pointer to this _RTObject
-
open
Procedure open.Boolean procedure open(fileimage); text fileimage; if ... then begin ... image :- fileimage; setpos(1); open := OPEN := true; end open;
Procedure "open" establishes the association with an external file (as identified by FILENAME), checks the access modes and causes corresponding opening actions on the external file. If the external file is closed, it is opened.
- Parameters:
image
- the givent image- Returns:
- true if successful, otherwise false.
-
close
public boolean close()Procedure close.Boolean procedure close; if OPEN then begin ... ! if pos ne 1 then outimage; image :- notext; ... ; ! perform closing actions on external file; OPEN := false; close := true; end close;
Procedure "close" causes closing actions on the external file, as specified by the access modes. In addition, the association between the file object and the external file is dissolved. If possible, the external file is closed.
The procedure "close" calls "outimage" if the position indicator is not equal to 1.
If successful, "close" returns true. In addition, OPEN is false and "image" references notext.
- Returns:
- true if successful, otherwise false.
-
outimage
public void outimage()Procedure outimage.procedure outimage; if not OPEN then error("..." ! file closed; ) else begin ... ; ! transfer "image" to external image; image := notext; setpos(1) end outimage;
The transfer of an image from the text "image" to the file is performed by the procedure "outimage". The procedure reacts in an implementation-defined way if the "image" length is not appropriate for the external file. (Depending on file type and host system, the external file does not necessarily record trailing blanks from the "image".)
This implementation will strip the "image" before output operations.
After the transfer, "image" is cleared to blanks and the position indicator is set to 1.
- Overrides:
outimage
in classRTS_Imagefile
- Throws:
RTS_SimulaRuntimeError
- if the operation fail
-
writeImage
Output utility: Used by outimage, outrecord and breakoutimage.Redefined in PrintFile
- Parameters:
ident
- identifier used in error messageimg
- the image to outputblank
- true if the image should be blank-filled after the output operation
-
outrecord
public void outrecord()Procedure outrecord.procedure outrecord; if not OPEN then error("..." ! file closed; ) else begin ... ; ! transfer image.sub(1,pos-1); ! Note: no blanking of "image"; setpos(1) end outrecord;
The procedure "outrecord" transfers to the file only that part of "image" which precedes POS. The contents are not blanked after the transfer, although POS is set to one.
- Throws:
RTS_SimulaRuntimeError
- if the operation fail
-
breakoutimage
public void breakoutimage()Procedure breakoutimage.procedure breakoutimage; if not OPEN then error("..." ! file closed; ) else begin ... ; ! output image.sub(1,pos-1); image := notext; setpos(1) end breakoutimage;
The procedure "breakoutimage" outputs the part of "image" that precedes POS. The output is performed as a partial output of an external image, in the sense that implicit line terminators are suppressed. On some external files this operation is not possible. It then has an effect identical to "outrecord".
After transfer the "image" is blanked and POS is set to one.
One use of "breakoutimage" is to allow input from a terminal display on the same line as one on which output (e.g. a prompt) has already been written.
- Throws:
RTS_SimulaRuntimeError
- if the operation fail
-
checkpoint
public boolean checkpoint()Procedure checkpoint.All files producing output (sequential output or direct files) contain a Boolean procedure "checkpoint". The procedure causes the environment to attempt to secure the output produced so far. Depending on the nature of the associated external device, this causes completion of output transfer (i.e. intermediate buffer contents are transferred). If this is not possible or meaningful, "checkpoint" is a dummy operation in which case the value false is returned.
- Returns:
- true if successful, otherwise false.
-