| SPIM.java |
1 // Copyright 2012- Bill Campbell, Swami Iyer and Bahar Akbal-Delibas
2
3 package jminusminus;
4
5 /**
6 * This is a Java wrapper class for the SPIM runtime file SPIM.s. Any j-- program that's
7 * compiled for the SPIM target must import this class for console IO operations. Note that the
8 * functions have no implementations here which means that if the programs using this class are
9 * compiled using j--, they will compile fine but won't function as desired when run against the
10 * JVM. Such programs must be compiled using the j-- compiler for the SPIM target and must be run
11 * against the SPIM simulator.
12 */
13 public class SPIM {
14 /**
15 * Prints an integer to the console.
16 *
17 * @param value the integer.
18 */
19 public static void printInt(int value) {
20 }
21
22 /**
23 * Prints a float to the console.
24 *
25 * @param value the float.
26 */
27 public static void printFloat(float value) {
28 }
29
30 /**
31 * Prints a double to the console.
32 *
33 * @param value the double.
34 */
35 public static void printDouble(double value) {
36 }
37
38 /**
39 * Prints a string to the console.
40 *
41 * @param value the string.
42 */
43 public static void printString(String value) {
44 }
45
46 /**
47 * Prints a char to the console.
48 *
49 * @param value the char.
50 */
51 public static void printChar(char value) {
52 }
53
54 /**
55 * Reads and returns an integer from the console.
56 *
57 * @return an integer from the console.
58 */
59 public static int readInt() {
60 return 0;
61 }
62
63 /**
64 * Reads and returns a float from the console.
65 *
66 * @return a float from the console.
67 */
68 public static float readFloat() {
69 return 0;
70 }
71
72 /**
73 * Reads and returns a double from the console.
74 *
75 * @return a double from the console.
76 */
77 public static double readDouble() {
78 return 0;
79 }
80
81 /**
82 * Reads and returns a string from the console.
83 *
84 * @return a string from the console.
85 */
86 public static String readString(int length) {
87 return null;
88 }
89
90 /**
91 * Reads and returns a char from the console.
92 *
93 * @return a char from the console.
94 */
95 public static char readChar() {
96 return ' ';
97 }
98
99 /**
100 * Exits SPIM.
101 */
102 public static void exit() {
103 }
104
105 /**
106 * Exits SPIM with the given code.
107 *
108 * @param code the exit code.
109 */
110 public static void exit2(int code) {
111 }
112 }
113