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