- Direct Known Subclasses:
RTS_ENVIRONMENT
,RTS_TEXTOBJ
Link to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Abstract class representing a for-statement element, all of which are Iterator's.final class
The Implementation of the for-statement is a bit tricky.final class
Simula for-statement for-list iteratorstatic enum
Simula object Operational Statesfinal class
This class represent a Simula boolean array.final class
This class is used to hold bound pairs in RTS_ARRAY objects.final class
This class represent a Simula character array.final class
This class represent a Simula integer array.final class
This class represent a Simula Label quantityfinal class
This class represent a Simula long real array.class
The Abstract Class RTS_NAME<T> are supporting Simula's Name-Parameters in Java Coding.final class
This class represent a Simula real array.class
This class is the common superclass for real type arrays.final class
This class represent a Simula ref(T) array.final class
This class represent a Simula text array.final class
For-statement single value element, not text.final class
For-statement single text value element.final class
For-statement step until element.class
UncaughtExceptionHandlerfinal class
For-statement While element, not textfinal class
For-statement While-element with Text Value Assignment. -
Field Summary
Modifier and TypeFieldDescriptionThis is a pointer to the Coroutine in which this block instance is running.static final RTS_BASICIO
Outmost Block Instancestatic RTS_RTObject
Current Block Instance(package private) RTS_RTObject
If this block instance is attached this is a pointer to the object of the block instance to which the instance is attached (also called dynamic link), i.e. it points to the block instance which called this one.(package private) static final int
The default input line length.int
Jump Table Index used by _STM()(package private) static final int
The default output line length.This is a pointer to the object of the nearest textually enclosing block instance, also called 'static link'.This object's Operational State.(package private) static RTS_Infile
The variable SYSIN.static RTS_Printfile
The intenal pointer to sysout.static final RTS_TXT
Utility constant NOTEXTprivate static long
Execution stat time in millis -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionText value assignment from String.static RTS_TXT
Text value assignment.void
Utility method to avoid Java-error: "Unreachable code" after GOTOstatic void
_JUMPTABLE
(int labelIndex) Method meant for Byte-Code Engineering.static void
_JUMPTABLE
(int labelIndex, int tableSize) Method meant for Byte-Code Engineering.static void
Method meant for Byte-Code Engineering.static void
Method meant for Byte-Code Engineering.static void
Method meant for Byte-Code Engineering.static void
_SIM_LABEL
(int labelIndex) Method meant for Byte-Code Engineering._STM()
Method representing the Statements in this Block
This method is virtual and must be redefined in blocks.boolean
_TXTREL_EQ
(RTS_TXT left, RTS_TXT right) Text value relation - EQboolean
_TXTREL_GE
(RTS_TXT left, RTS_TXT right) Text value relation - GEboolean
_TXTREL_GT
(RTS_TXT left, RTS_TXT right) Text value relation - GTboolean
_TXTREL_LE
(RTS_TXT left, RTS_TXT right) Text value relation - LEstatic boolean
_TXTREL_LT
(RTS_TXT left, RTS_TXT right) Text value relation - LTboolean
_TXTREL_NE
(RTS_TXT left, RTS_TXT right) Text value relation - NEboolean
_VALUE
(boolean cond) Used in Conditional Statement to prevent 'dead code removal'.arrayValue
(Object par) Utility method to support Parameter Transmission in case of Formal/Virtual Procedure Call.void
BBLK()
This routine is used to initiate a block instance.static RTS_TXT
blanks
(int n) text procedure blanks(n); integer n; if n < 0 then error("..." !void
The begin program routine (BPRG) is the runtime system initialization routine.void
call
(RTS_RTObject ins) Standard procedure 'call'.void
call
(RTS_RTObject ins, int sourceLine) The operator & permits text concatenation.static RTS_TXT
text procedure copy(T); text T; if T =/= notext then begin text U; U.OBJ :- new TEXTOBJ(T.LENGTH,false); U.START := 1; U.LENGTH := T.LENGTH; U.POS := 1; U := T; copy :- U end copy;void
detach()
Standard procedure 'detach'.void
detach
(int sourceLine) Seedetach()
static void
detach
(RTS_RTObject SL) Seedetach()
double
doubleValue
(Object par) Utility method to support Parameter Transmission in case of Formal/Virtual Procedure Call.void
EBLK()
End Block.Utility to support trace and debugging.Utility to support trace and debugging.private static void
endProgram
(int exitValue) End of Simula program execution.float
floatValue
(Object par) Utility method to support Parameter Transmission in case of Formal/Virtual Procedure Call.static String
Utility to convert a Throwable message to Simula message.int
Utility method to support Parameter Transmission in case of Formal/Virtual Procedure Call.boolean
This is a static property generated by the compiler.boolean
This is a static property generated by the compiler.Utility to support trace and debugging.static RTS_TXT
objectTraceIdentifier
(RTS_RTObject staticLink) Utility to support trace and debugging.objectValue
(Object par) Utility method to support Parameter Transmission in case of Formal/Virtual Procedure Call.Utility method to support Parameter Transmission in case of Formal/Virtual Procedure Call.void
resume
(RTS_RTObject ins) "resume" is formally a procedure with one object reference parameter qualified by a fictitious class 'CLASS' including all classes.void
resume
(RTS_RTObject ins, boolean doSwap) void
resume
(RTS_RTObject ins, int sourceLine) (package private) static void
Utility: Swap Coroutines.static RTS_Infile
sysin()
Implementation of Simula's Procedure sysin.static RTS_Printfile
sysout()
Implementation of Simula's Procedure sysout.static void
Implementation of Simula's Procedure terminate_program.toString()
Returns a string representation of the object.static void
TRACE_GOTO
(String msg, RTS_RTObject.RTS_LABEL label) Utility method to trace GOTO Statementsboolean
Text reference equal relationboolean
Text reference not equal relationprivate static boolean
Text value relation
-
Field Details
-
_INPUT_LINELENGTH
static final int _INPUT_LINELENGTHThe default input line length. I.e. BASICIO'INPUT_LINELENGTH- See Also:
-
_OUTPUT_LINELENGTH
static final int _OUTPUT_LINELENGTHThe default output line length. I.e. BASICIO'OUTPUT_LINELENGTH- See Also:
-
_SYSIN
The variable SYSIN. -
_SYSOUT
The intenal pointer to sysout. -
startTimeMs
private static long startTimeMsExecution stat time in millis -
_STATE
This object's Operational State.- See Also:
-
_CORUT
This is a pointer to the Coroutine in which this block instance is running.
If this block instance is detached it is used to save the complete reactivation point (call stack and the continuation point). -
_CTX
Outmost Block Instance -
_CUR
Current Block Instance -
_JTX
public int _JTXJump Table Index used by _STM() -
_SL
This is a pointer to the object of the nearest textually enclosing block instance, also called 'static link'. -
_DL
RTS_RTObject _DLIf this block instance is attached this is a pointer to the object of the block instance to which the instance is attached (also called dynamic link), i.e. it points to the block instance which called this one. -
NOTEXT
Utility constant NOTEXT
-
-
Constructor Details
-
RTS_RTObject
Constructor- Parameters:
SL
- Static Link, may be null when creating CONTEXT, TEXTOBJ and TXTREF
-
-
Method Details
-
sysin
Implementation of Simula's Procedure sysin.- Returns:
- a pointer to _SYSIN
-
sysout
Implementation of Simula's Procedure sysout.- Returns:
- a pointer to _SYSOUT
-
isQPSystemBlock
public boolean isQPSystemBlock()This is a static property generated by the compiler.
It will return true for Block or Prefixed Block with local classes.
This method is redefined in every subclass which represent a Simula Block.- Returns:
- true: this object is a QPS System block
-
isDetachUsed
public boolean isDetachUsed()This is a static property generated by the compiler.
It will return true for Blocks in which 'detach' is used.
This method is redefined in every subclass which represent a Simula Block.- Returns:
- true: this object is a QPS System block
-
arrayValue
Utility method to support Parameter Transmission in case of Formal/Virtual Procedure Call.If the parameter is 'by name' the parameter is evaluated.
See
simula.compiler.declaration.ProcedureDeclaration#doCodePrepareFormal
- Parameters:
par
- an Object- Returns:
- a RTS_ARRAY value
-
procValue
Utility method to support Parameter Transmission in case of Formal/Virtual Procedure Call.If the parameter is 'by name' the parameter is evaluated.
See
simula.compiler.declaration.ProcedureDeclaration#doCodePrepareFormal
- Parameters:
par
- an Object- Returns:
- a RTS_PRCQNT value
-
objectValue
Utility method to support Parameter Transmission in case of Formal/Virtual Procedure Call.If the parameter is 'by name' the parameter is evaluated.
If the parameter is a RTS_PRCQNT that procedure is called
See
simula.compiler.declaration.ProcedureDeclaration#doCodePrepareFormal
- Parameters:
par
- an Object- Returns:
- a Object value
-
intValue
Utility method to support Parameter Transmission in case of Formal/Virtual Procedure Call.If the parameter is 'by name' the parameter is evaluated.
If the parameter is a _PRCQNT that procedure is called
If the parameter is a Float or Double they are casted to Integer
See
simula.compiler.declaration.ProcedureDeclaration#doCodePrepareFormal
- Parameters:
par
- an Object- Returns:
- an Integer value
-
floatValue
Utility method to support Parameter Transmission in case of Formal/Virtual Procedure Call.If the parameter is 'by name' the parameter is evaluated.
If the parameter is a _PRCQNT that procedure is called
If the parameter is a Integer or Double they are casted to Float
See
simula.compiler.declaration.ProcedureDeclaration#doCodePrepareFormal
- Parameters:
par
- an Object- Returns:
- a Float value
-
doubleValue
Utility method to support Parameter Transmission in case of Formal/Virtual Procedure Call.If the parameter is 'by name' the parameter is evaluated.
If the parameter is a _PRCQNT that procedure is called
If the parameter is an Integer or Float they are casted to Double
See
simula.compiler.declaration.ProcedureDeclaration#doCodePrepareFormal
- Parameters:
par
- an Object- Returns:
- a Double value
-
copy
text procedure copy(T); text T; if T =/= notext then begin text U; U.OBJ :- new TEXTOBJ(T.LENGTH,false); U.START := 1; U.LENGTH := T.LENGTH; U.POS := 1; U := T; copy :- U end copy;
"copy(T)", with T =/= notext, references a new alterable main frame which contains a text value identical to that of T.- Parameters:
T
- the text object to be copied- Returns:
- a copy of T
-
CONC
The operator & permits text concatenation.- Parameters:
T1
- the first text to be concatenatedT2
- the second text to be concatenated- Returns:
- the concatenated text
-
blanks
text procedure blanks(n); integer n; if n < 0 then error("..." ! Parm. to blanks < 0;) else if n > 0 then begin text T; T.OBJ :- new TEXTOBJ(n,false); T.START := 1; T.LENGTH := n; T.POS := 1; T := notext; ! blank-fill, see 4.1.2; blanks :- T end blanks;
"blanks(n)", with n > 0, references a new alterable main frame of length n, containing only blank characters. "blanks(0)" references notext.- Parameters:
n
- the number of space characters- Returns:
- a text object conraining n space characters
-
_ASGTXT
Text value assignment.- Parameters:
T
- the from textU
- the target text- Returns:
- the resulting text
-
_ASGSTR
Text value assignment from String.- Parameters:
T
- the from texts
- the target text- Returns:
- the resulting text
-
_TXTREL_LT
Text value relation - LT- Parameters:
left
- left hand sideright
- right hand side- Returns:
- true if relation holds
-
_TXTREL_EQ
Text value relation - EQ- Parameters:
left
- left hand sideright
- right hand side- Returns:
- true if relation holds
-
_TXTREL_LE
Text value relation - LE- Parameters:
left
- left hand sideright
- right hand side- Returns:
- true if relation holds
-
_TXTREL_GT
Text value relation - GT- Parameters:
left
- left hand sideright
- right hand side- Returns:
- true if relation holds
-
_TXTREL_NE
Text value relation - NE- Parameters:
left
- left hand sideright
- right hand side- Returns:
- true if relation holds
-
_TXTREL_GE
Text value relation - GE- Parameters:
left
- left hand sideright
- right hand side- Returns:
- true if relation holds
-
TXTREL
Text value relation- Parameters:
left
- left hand sideright
- right hand sidecode
- relational code- Returns:
- true if relation holds
-
TRF_EQ
Text reference equal relation- Parameters:
left
- left hand sideright
- right hand side- Returns:
- true if relation holds
-
TRF_NE
Text reference not equal relation- Parameters:
left
- left hand sideright
- right hand side- Returns:
- true if relation holds
-
_VALUE
public boolean _VALUE(boolean cond) Used in Conditional Statement to prevent 'dead code removal'.- Parameters:
cond
- a boolean condition- Returns:
- the same conditional
-
_PRE_LABEL
public static void _PRE_LABEL()Method meant for Byte-Code Engineering.
During Byte-Code Engineering this method-call is used to signal the occurrence of a Simula Label. -
_LABEL
Method meant for Byte-Code Engineering.
During Byte-Code Engineering this method-call is used to signal the occurrence of a Simula Label. The bytecode address is collected and some instruction are removed. The parameter 'labelIndex' is the label's ordinal number.deprecated This method will be removed when java.lang.classfile becomes available.
- Parameters:
labelIndex
- the label's ordinal number.ident
- the label's identifier
-
_SIM_LABEL
public static void _SIM_LABEL(int labelIndex) Method meant for Byte-Code Engineering.
During Byte-Code Engineering this method-call is used to signal the occurrence of a Simula Label. A pseudo label instruction is added some instruction are removed. The parameter 'labelIndex' is the label's ordinal number.- Parameters:
labelIndex
- the label's ordinal number.
-
_PRE_TABLE
public static void _PRE_TABLE()Method meant for Byte-Code Engineering.
This method-call is a placeholder for where to put in a Jump-Table.
See Mapping Simula to Java (runtime design) Sect. 6.1.2 Byte Code Engineering. -
_JUMPTABLE
public static void _JUMPTABLE(int labelIndex, int tableSize) Method meant for Byte-Code Engineering.
This method-call is a placeholder for where to put in a Jump-Table.
See Mapping Simula to Java (runtime design) Sect. 6.1.2 Byte Code Engineering.- Parameters:
labelIndex
- the label indextableSize
- the jumptable size
-
_JUMPTABLE
public static void _JUMPTABLE(int labelIndex) Method meant for Byte-Code Engineering.deprecated This method will be removed when java.lang.classfile becomes available.
- Parameters:
labelIndex
- the label index
-
_GOTO
Utility method to avoid Java-error: "Unreachable code" after GOTO- Parameters:
q
- the RTS_LABEL
-
TRACE_GOTO
Utility method to trace GOTO Statements- Parameters:
msg
- a descriptive messagelabel
- the label quant
-
getErrorMessage
Utility to convert a Throwable message to Simula message.- Parameters:
e
- a Throwable- Returns:
- converted message
-
terminate_program
public static void terminate_program()Implementation of Simula's Procedure terminate_program. -
BPRG
The begin program routine (BPRG) is the runtime system initialization routine. It will initiate the global data in the runtime system.- Parameters:
ident
- the program identifier
-
BBLK
public void BBLK()This routine is used to initiate a block instance. Its functions are:- Attach the block to its dynamic environment.
- Update the current instance pointer(_CUR).
-
EBLK
public void EBLK()End Block.This routine is used to terminate a block instance when control passes through the final end (of the outermost prefix for class and prefixed block).
According to the different categories of block instances, we have the following cases:
- Terminate prefixed block instance.
Update the '_CUR' pointer and return to Compiler generated code.
- Terminate class instance.
The object is marked 'terminated' and the '_CUR' pointer is updated.
Finally; Yield continuation and return to Compiler generated code.
However; If the program passes through its final end sysout.outimage is called. The the entire program is terminated.
- Terminate prefixed block instance.
-
detach
public void detach()Standard procedure 'detach'.Consider a call of the detach attribute of a block instance X.
If X is an instance of a prefixed block the detach statement has no effect. Assume that X is a class object. The following cases arise:
- X is an attached object.
If X is not operating the detach statement constitutes an error. Assume X is operating. The effect of the detach statement is:- X becomes detached and thereby (the head of) a new non-operative object component, its reactivation point positioned immediately after the detach statement. As a consequence, that part of the operating chain which is dynamically enclosed by X becomes the (non-operating) reactivation chain of X.
- The PSC returns to the block instance to which X was attached and execution continues immediately after the associated object generator or call statement (see 7.3.2).
- X is a detached object.
The detach statement then constitutes an error. - X is a resumed object.
X is then (the head of) an operative system component. Let S be the associated system. It is a consequence of the language definition that X must be operating. The effect of the detach statement is:- X enters the detached state and becomes non-operative, its reactivation point positioned immediately after the detach statement. As a consequence, that part of the operating chain which is dynamically enclosed by X becomes the (non-operating) reactivation chain of X.
- The PSC is moved to the current reactivation point of the main component of S, whereby this main component becomes operative and operating. As a consequence, all block instances on the reactivation chain of the main component also become operating.
- X is a terminated object.
The detach statement then constitutes an error.
- X is an attached object.
-
detach
Seedetach()
- Parameters:
SL
- The object to be Detached
-
detach
public void detach(int sourceLine) Seedetach()
- Parameters:
sourceLine
- the sourceline of the call
-
call
Standard procedure 'call'."call" is formally a procedure with one object reference parameter qualified by a fictitious class 'CLASS' including all classes. Let Y denote the object referenced by a call statement.
If Y is terminated, attached or resumed, or Y == none, the call statement constitutes an error.
Assume Y is a detached object. The effect of the call statement is:
- Y becomes attached to the block instance containing the call statement, whereby Y loses its status as a component head. As a consequence the system to which Y belongs (if any) loses the associated component.
- The PSC is moved to the (former) reactivation point of Y. As a consequence, all block instances on the reactivation chain of Y become operating.
- Parameters:
ins
- The object to be Called (Coroutine)
-
call
- Parameters:
ins
- The object to be Called (Coroutine)sourceLine
- the sourceline of the call
-
resume
"resume" is formally a procedure with one object reference parameter qualified by a fictitious class 'CLASS' including all classes. Let Y denote the object referenced by a resume statement.
If Y is not local to a system head, i.e. if Y is local to a class object or an instance of a procedure body, the resume statement constitutes an error.
If Y is terminated or attached, or Y==none, the resume statement constitutes an error.
If Y is a resumed object, the resume statement has no effect (it is a consequence of the language definition that Y must then be operating.)
Assume Y is a detached object being (the head of) a non-operative system component. Let S be the associated system and let X denote (the head of) the current operative component of S. It is a consequence of the language definition that X must be operating, and that X is either the main component of S or local to the head of S. The effect of the resume statement is:
- X becomes non-operative, its reactivation point positioned immediately after the resume statement. As a consequence, that part of the operating chain which is dynamically enclosed by X becomes the (non-operating) reactivation chain of X. If X is an object component its head enters the detached state.
- The PSC is moved to the reactivation point of Y, whereby Y enters the resumed state and becomes operative and operating. As a consequence, all block instances on the reactivation chain of Y also become operating.
- Parameters:
ins
- The object to be Resumed
-
resume
- Parameters:
ins
- The object to be ResumedsourceLine
- the sourceline of the call
-
resume
- Parameters:
ins
- The object to be ResumeddoSwap
- decides whether Coroutines should be swapped
-
_STM
Method representing the Statements in this Block
This method is virtual and must be redefined in blocks.- Returns:
- a pointer to this _RTObject
-
endProgram
private static void endProgram(int exitValue) End of Simula program execution.- Parameters:
exitValue
- the exit value
-
swapCoroutines
static void swapCoroutines()Utility: Swap Coroutines. -
objectTraceIdentifier
Utility to support trace and debugging.An edited string identifier of the static link object is formed.
- Parameters:
staticLink
- a reference to the static link object- Returns:
- an edited string
-
objectTraceIdentifier
Utility to support trace and debugging.An edited string identifier of this object is formed.
- Returns:
- an edited string
-
edObjectIdent
Utility to support trace and debugging.An edited string identifier of this object's class is formed.
- Returns:
- an edited string
-
edObjectAttributes
Utility to support trace and debugging.An edited string identifier of this object's main attributes is formed.
- Returns:
- an edited string
-
toString
Returns a string representation of the object.
-