Package jminusminus
Class SPIM
java.lang.Object
jminusminus.SPIM
This is a Java wrapper class for the SPIM runtime file SPIM.s. Any j-- program that's
 compiled for the SPIM target must import this class for console IO operations. Note that the
 functions have no implementations here which means that if the programs using this class are
 compiled using j--, they will compile fine but won't function as desired when run against the
 JVM. Such programs must be compiled using the j-- compiler for the SPIM target and must be run
 against the SPIM simulator.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidexit()Exits SPIM.static voidexit2(int code) Exits SPIM with the given code.static voidprintChar(char value) Prints a char to the console.static voidprintDouble(double value) Prints a double to the console.static voidprintFloat(float value) Prints a float to the console.static voidprintInt(int value) Prints an integer to the console.static voidprintString(String value) Prints a string to the console.static charreadChar()Reads and returns a char from the console.static doubleReads and returns a double from the console.static floatReads and returns a float from the console.static intreadInt()Reads and returns an integer from the console.static StringreadString(int length) Reads and returns a string from the console.
- 
Constructor Details- 
SPIMpublic SPIM()
 
- 
- 
Method Details- 
printIntpublic static void printInt(int value) Prints an integer to the console.- Parameters:
- value- the integer.
 
- 
printFloatpublic static void printFloat(float value) Prints a float to the console.- Parameters:
- value- the float.
 
- 
printDoublepublic static void printDouble(double value) Prints a double to the console.- Parameters:
- value- the double.
 
- 
printStringPrints a string to the console.- Parameters:
- value- the string.
 
- 
printCharpublic static void printChar(char value) Prints a char to the console.- Parameters:
- value- the char.
 
- 
readIntpublic static int readInt()Reads and returns an integer from the console.- Returns:
- an integer from the console.
 
- 
readFloatpublic static float readFloat()Reads and returns a float from the console.- Returns:
- a float from the console.
 
- 
readDoublepublic static double readDouble()Reads and returns a double from the console.- Returns:
- a double from the console.
 
- 
readStringReads and returns a string from the console.- Returns:
- a string from the console.
 
- 
readCharpublic static char readChar()Reads and returns a char from the console.- Returns:
- a char from the console.
 
- 
exitpublic static void exit()Exits SPIM.
- 
exit2public static void exit2(int code) Exits SPIM with the given code.- Parameters:
- code- the exit code.
 
 
-