Class Util
java.lang.Object
simula.compiler.utilities.Util
A set of all static Utility Methods
Link to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Utility method: ASSERTstatic void
buildLineNumber
(CodeBuilder codeBuilder, int lineNumber) Build line number method call.static void
buildSimulaRuntimeError
(String mss, CodeBuilder codeBuilder) Build invoke Simula Runtime Error.static void
doListClassFile
(String classFileName) Print a .class file listing.private static String
Edit a line with source line number etc.static boolean
Returns true if the two specified strings are equal to one another.static void
Print a error message.static int
Execute an OS commandstatic int
Execute OS Commandprivate static void
Perform FORCED EXIT.static String
getBaseName
(String fileName) Return the base name part of a File Namestatic void
IERR()
Print the internal error message: IMPOSSIBLE.static void
Print a internal error message.static void
Print a internal error message.static int
IPOW
(long base, long x) Utility: Integer Power: b ** xstatic boolean
isJavaIdentifier
(String ident) Check if 'ident' is a legal Java Identifier.static String
makeJavaIdentifier
(String ident) Make 'ident' a legal Java Identifier.static int
optionDialog
(Object msg, String title, int optionType, int messageType, String... option) Brings up an option dialog.static void
popUpError
(String msg) Pop up an error message box.static void
popUpMessage
(Object msg) Pop up a message box.static void
printError
(String s) Print a error message.static void
Print a string.static void
Print a warning message.static void
Utility method: TRACEstatic void
TRACE_INPUT
(String msg) Utility method: TRACE_INPUTstatic void
TRACE_OUTPUT
(String msg) Utility method: TRACE_OUTPUTstatic void
Print a warning message.
-
Field Details
-
nError
public static int nErrorNumber of error messages.
-
-
Constructor Details
-
Util
Util()Default constructor.
-
-
Method Details
-
popUpMessage
-
popUpError
Pop up an error message box.- Parameters:
msg
- the error message
-
optionDialog
public 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
-
error
-
IERR
public static void IERR()Print the internal error message: IMPOSSIBLE. -
IERR
-
FORCED_EXIT
private static void FORCED_EXIT()Perform FORCED EXIT. -
IERR
-
warning
-
edLINE
-
getBaseName
-
TRACE
-
TRACE_OUTPUT
Utility method: TRACE_OUTPUT- Parameters:
msg
- the message to print
-
TRACE_INPUT
Utility method: TRACE_INPUT- Parameters:
msg
- the message to print
-
ASSERT
Utility method: ASSERT- Parameters:
test
- this test must be truemsg
- the message when test = false
-
println
-
printError
-
printWarning
-
isJavaIdentifier
Check if 'ident' is a legal Java Identifier.- Parameters:
ident
- the given identifier- Returns:
- true if 'ident' is a legal Java Identifier otherwise false
-
makeJavaIdentifier
-
equals
-
IPOW
public static int IPOW(long base, long x) Utility: Integer Power: b ** x- Parameters:
base
- argument basex
- argument x- Returns:
- Returns the value of 'base' raised to the power of 'x'
-
doListClassFile
Print a .class file listing.- Parameters:
classFileName
- the .class file name
-
execute
-
execute
Execute an OS command- Parameters:
cmdarray
- command array- Returns:
- exit value
-
buildSimulaRuntimeError
Build invoke Simula Runtime Error.- Parameters:
mss
- the error message.codeBuilder
- the codeBuilder to use.
-
buildLineNumber
Build line number method call.- Parameters:
codeBuilder
- the codeBuilder to use.lineNumber
- the line number
-