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_ConsolePanelThe runtime console.(package private) static StringThe current module ident.(package private) static intThe current simula source line number.static final RTS_TXTUtility constant NOTEXT(package private) static intNumber of edit overflows.(package private) static StringThe program ident. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RTS_TXTText value assignment from String.static RTS_TXTText 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 booleanObject relation: IS.static int_ISUB(int x, int y) Integer Subtraction: x - ystatic voidUtility: Set current modid and Simula source line number.static voidDebug utility method to print a snapshot in the generated code.static voidDebug 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 voidThe begin program routine (BPRG) is the runtime system initialization routine.private static voidUtility: Treat Runtime errorstatic doubledsign(double e) Standard Procedure sign.(package private) static voidendProgram(int exitValue) End of Simula program execution.(package private) static voidOpen Simula Runtime Console.static floatfsign(float e) Standard Procedure sign.static StringUtility to convert a Throwable message to Simula message.(package private) static StringReturns System property "java.vm.specification.version"private static voidhelp()Print synopsis of standard options(package private) static voidUtility: Internal error.static intisign(int e) Standard Procedure sign.(package private) static voidList runtime options.(package private) static intoptionDialog(Object msg, String title, int optionType, int messageType, String... option) Brings up an option dialog.(package private) static voidpopUpError(String msg) Popup an error message box.(package private) static voidprintError(String msg) Print an error on the runtime console if present, otherwise on System.out(package private) static voidPrint a line on the runtime console if present, otherwise on System.outprivate static booleanprintSimulaLineInfo(StackTraceElement elt, String lead) Utility: Print SimulaLineInfo(package private) static voidprintSimulaStackTrace(int start) Utility: Print Simula stack trace.private static voidprintSimulaStackTrace(StackTraceElement[] stackTraceElement, int start) Utility: Print Simula StackTrace.(package private) static voidprintSimulaStackTrace(Throwable e, int start) Utility: Print Simula stack trace.(package private) static voidPrint static chain starting with the current instance.(package private) static voidPrint static chain starting with 'ins'(package private) static voidPrint Thread list.(package private) static voidprintThreadList(boolean withStackTrace) Print Thread list.(package private) static voidprintWarning(String msg) Print a warning message on the runtime console if present, otherwise on System.outstatic voidRUN_STM(RTS_RTObject usr) Run users statementsstatic voidsetRuntimeOptions(String[] args) Set runtime options.(package private) static voidTRACE Utility.static voidtreatException(Throwable e, RTS_RTObject obj) Treat Exceptionstatic booleanText reference equal relationstatic booleanText reference not equal relationprivate static booleanText 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
-