Class RTS_UTIL
java.lang.Object
simula.runtime.RTS_UTIL
Utility class containing a lot of common stuff.
Link to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static RTS_ConsolePanel
The runtime console.(package private) static String
The current module ident.(package private) static int
The current simula source line number.static final RTS_TXT
Utility constant NOTEXT(package private) static int
Number of edit overflows.(package private) static String
The program ident. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RTS_TXT
Text value assignment from String.static RTS_TXT
Text value assignment.static int
_IADD
(int x, int y) Integer Addition: x + ystatic int
_IMUL
(int x, int y) Integer Multiplication: x * ystatic int
_IPOW
(int b, int x) Integer Power: b ** xstatic boolean
Object relation: IS.static int
_ISUB
(int x, int y) Integer Subtraction: x - ystatic void
Utility: Set current modid and Simula source line number.static void
Debug utility method to print a snapshot in the generated code.static void
Debug utility method to print a snapshot in the generated code.static boolean
_TXTREL_EQ
(RTS_TXT left, RTS_TXT right) Text value relation - EQstatic boolean
_TXTREL_GE
(RTS_TXT left, RTS_TXT right) Text value relation - GEstatic boolean
_TXTREL_GT
(RTS_TXT left, RTS_TXT right) Text value relation - GTstatic boolean
_TXTREL_LE
(RTS_TXT left, RTS_TXT right) Text value relation - LEstatic boolean
_TXTREL_LT
(RTS_TXT left, RTS_TXT right) Text value relation - LTstatic boolean
_TXTREL_NE
(RTS_TXT left, RTS_TXT right) Text value relation - NEstatic void
The begin program routine (BPRG) is the runtime system initialization routine.private static void
Utility: Treat Runtime errorstatic double
dsign
(double e) Standard Procedure sign.(package private) static void
endProgram
(int exitValue) End of Simula program execution.(package private) static void
Open Simula Runtime Console.static float
fsign
(float e) Standard Procedure sign.static String
Utility to convert a Throwable message to Simula message.(package private) static String
Returns System property "java.vm.specification.version"private static void
help()
Print synopsis of standard options(package private) static void
Utility: Internal error.static int
isign
(int e) Standard Procedure sign.(package private) static void
List runtime options.(package private) static int
optionDialog
(Object msg, String title, int optionType, int messageType, String... option) Brings up an option dialog.(package private) static void
popUpError
(String msg) Popup an error message box.(package private) static void
printError
(String msg) Print an error on the runtime console if present, otherwise on System.out(package private) static void
Print a line on the runtime console if present, otherwise on System.outprivate static boolean
printSimulaLineInfo
(StackTraceElement elt, String lead) Utility: Print SimulaLineInfo(package private) static void
printSimulaStackTrace
(int start) Utility: Print Simula stack trace.private static void
printSimulaStackTrace
(StackTraceElement[] stackTraceElement, int start) Utility: Print Simula StackTrace.(package private) static void
printSimulaStackTrace
(Throwable e, int start) Utility: Print Simula stack trace.(package private) static void
Print static chain starting with the current instance.(package private) static void
Print static chain starting with 'ins'(package private) static void
Print Thread list.(package private) static void
printThreadList
(boolean withStackTrace) Print Thread list.(package private) static void
printWarning
(String msg) Print a warning message on the runtime console if present, otherwise on System.outstatic void
RUN_STM
(RTS_RTObject usr) Run users statementsstatic void
setRuntimeOptions
(String[] args) Set runtime options.(package private) static void
TRACE Utility.static void
treatException
(Throwable e, RTS_RTObject obj) Treat Exceptionstatic boolean
Text reference equal relationstatic boolean
Text reference not equal relationprivate static boolean
Text value relation
-
Field Details
-
console
The runtime console. May be null -
progamIdent
The program ident. -
currentModid
The current module ident. -
currentSimLine
static int currentSimLineThe current simula source line number. -
numberOfEditOverflows
static int numberOfEditOverflowsNumber of edit overflows. -
NOTEXT
Utility constant NOTEXT
-
-
Constructor Details
-
RTS_UTIL
private RTS_UTIL()Default constructor.
-
-
Method Details
-
_ASGTXT
-
_ASGSTR
-
_TXTREL_LT
-
_TXTREL_EQ
-
_TXTREL_LE
-
_TXTREL_GT
-
_TXTREL_NE
-
_TXTREL_GE
-
TXTREL
-
TRF_EQ
-
TRF_NE
-
_IADD
public static int _IADD(int x, int y) Integer Addition: x + y- Parameters:
x
- argument xy
- argument y- Returns:
- x + y
-
_ISUB
public static int _ISUB(int x, int y) Integer Subtraction: x - y- Parameters:
x
- argument xy
- argument y- Returns:
- x - y
-
_IMUL
public static int _IMUL(int x, int y) Integer Multiplication: x * y- Parameters:
x
- argument xy
- argument y- Returns:
- x * y
-
_IPOW
public static int _IPOW(int b, int x) Integer Power: b ** x- Parameters:
b
- argument bx
- argument x- Returns:
- b ** x
-
_IS
-
isign
public static int isign(int e) Standard Procedure sign.
integer procedure sign(e); e; sign := if e > 0 then 1 else if e < 0 then -1 else 0;
The result is zero if the parameter is zero, one if the parameter is positive, and minus one otherwise.
- Parameters:
e
- the argument e- Returns:
- resulting sign code
-
fsign
public static float fsign(float e) Standard Procedure sign.- Parameters:
e
- the argument e- Returns:
- resulting sign code
-
dsign
public static double dsign(double e) Standard Procedure sign.- Parameters:
e
- the argument e- Returns:
- resulting sign code
-
treatException
Treat Exception- Parameters:
e
- the Throwable Objectobj
- the RTObject which object that received the exception
-
callExceptionHandler
Utility: Treat Runtime error- Parameters:
msg
- the message
-
getErrorMessage
-
endProgram
static void endProgram(int exitValue) End of Simula program execution.- Parameters:
exitValue
- the exit value
-
BPRG
-
RUN_STM
-
help
private static void help()Print synopsis of standard options -
setRuntimeOptions
Set runtime options.- Parameters:
args
- argument array
-
popUpError
-
optionDialog
static int optionDialog(Object msg, String title, int optionType, int messageType, String... option) Brings up an option dialog.- Parameters:
msg
- the message to displaytitle
- the title string for the dialogoptionType
- an integer designating the options available on the dialogmessageType
- an integer designating the kind of message this isoption
- an array of objects indicating the possible choices the user can make- Returns:
- an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the dialog
-
listRuntimeOptions
static void listRuntimeOptions()List runtime options. -
println
Print a line on the runtime console if present, otherwise on System.out- Parameters:
msg
- the message to print
-
printError
Print an error on the runtime console if present, otherwise on System.out- Parameters:
msg
- the message to print
-
printWarning
Print a warning message on the runtime console if present, otherwise on System.out- Parameters:
msg
- the message to print
-
ensureOpenRuntimeConsole
static void ensureOpenRuntimeConsole()Open Simula Runtime Console. -
TRACE
-
IERR
-
getJavaID
Returns System property "java.vm.specification.version"- Returns:
- System property "java.vm.specification.version"
-
_SNAPSHOT
Debug utility method to print a snapshot in the generated code.- Parameters:
sequ
- a sequence numbermsg
- a message
-
_SNAPSHOT
-
printStaticChain
static void printStaticChain()Print static chain starting with the current instance. -
printStaticChain
Print static chain starting with 'ins'- Parameters:
ins
- argument
-
printSimulaStackTrace
static void printSimulaStackTrace(int start) Utility: Print Simula stack trace.- Parameters:
start
- start index in Java stackTrace
-
printSimulaStackTrace
Utility: Print Simula stack trace.- Parameters:
e
- a Throwablestart
- start index in Java stackTrace
-
printSimulaStackTrace
Utility: Print Simula StackTrace.- Parameters:
stackTraceElement
- Java stackTracestart
- start index in Java stackTrace
-
printSimulaLineInfo
Utility: Print SimulaLineInfo- Parameters:
elt
- a StackTraceElementlead
- the keading string- Returns:
- the resulting line info
-
printThreadList
static void printThreadList()Print Thread list. -
printThreadList
static void printThreadList(boolean withStackTrace) Print Thread list.- Parameters:
withStackTrace
- argument
-
_LINE
Utility: Set current modid and Simula source line number.- Parameters:
modid
- new current modidsimLine
- new Simula source line number
-