bedb31700ce375c9675f30a4198d8d616b849db9
[IRC.git] / Robust / src / ClassLibrary / MGC / System.java
1 public class System {
2   public static PrintStream out = new PrintStream("System.out");
3   public static PrintStream err = new PrintStream("System.err");
4   public static InputStream in = new InputStream();
5   
6   public System() {
7   }
8   
9   public static void printInt(int x) {
10     String s=String.valueOf(x);
11     printString(s);
12   }
13   
14   public static native void setgcprofileflag();
15   
16   public static native void resetgcprofileflag();
17
18   public static native long currentTimeMillis();
19   
20   public static native long nanoTime();
21   
22   public static native long microTimes();
23
24   public static native long getticks();
25
26   public static native void printString(String s);
27   
28   public static native void gc();
29
30   public static void println(String s) {
31     System.printString(s+"\n");
32   }
33
34   public static void println(Object o) {
35     System.printString(""+o+"\n");
36   }
37
38   public static void println(int o) {
39     System.printString(""+o+"\n");
40   }
41
42   public static void println(double o) {
43     System.printString(""+o+"\n");
44   }
45
46   public static void println(long o) {
47     System.printString(""+o+"\n");
48   }
49   
50   public static void println() {
51     System.printString("\n");
52   }
53
54   public static void print(String s) {
55     System.printString(s);
56   }
57
58   public static void print(Object o) {
59     System.printString(""+o);
60   }
61
62   public static void print(int o) {
63     System.printString(""+o);
64   }
65
66   public static void print(double o) {
67     System.printString(""+o);
68   }
69
70   public static void print(long o) {
71     System.printString(""+o);
72   }
73
74   public static void error() {
75     System.printString("Error (Use Breakpoint on ___System______error method for more information!)\n");
76   }
77
78   public static native void exit(int status);
79
80   public static native void printI(int status);
81
82   public static native void clearPrefetchCache();
83
84   public static native void rangePrefetch(Object o, short[] offsets);
85
86   public static native void deepArrayCopy(Object dst, Object src);
87
88   public static native void Assert(boolean status);
89
90   /* Only used for microbenchmark testing of SingleTM version */
91   public static native void logevent(int event);
92   public static native void logevent();
93
94   /* Only used for microbenchmark testing of SingleTM version */
95   public static native void initLog();
96
97   public static native void flushToFile(int threadid);
98   /* Only used for microbenchmark testing of SingleTM version */
99
100   public static native void arraycopy(Object src, int srcPos, Object dst, int destPos, int length);
101
102   // for disjoint reachability analysis
103   public static void genReach();
104   
105   private static Properties props;
106   
107   static {
108     setProperty("line.separator", "\n");
109   }
110   
111   public static Properties getProperties() {
112     return props;
113   }
114   
115   public static String getProperty(String key) {
116     if(props != null) {
117       return (String)props.getProperty(key);
118     }
119     return "";
120   }
121   
122   public static String setProperty(String key, String value) {
123     if(props == null) {
124       props = new Properties();
125     }
126     return (String)props.setProperty(key, value);
127   }
128   
129   public static void setOut(PrintStream out) {
130     out = out;
131   }
132
133   public static void setErr(PrintStream err) {
134     err = err;
135   }
136 }