/Users/lyon/j4p/src/dhry/Main.java

1    package dhry; 
2     
3    import gui.JInfoFrame; 
4     
5    class Record { 
6        Record nextRecord; 
7        int Discr; 
8        int Enum_Comp; 
9        int Int_Comp; 
10       String String_Comp; 
11       int Enum_Comp_2; 
12       String String_Comp_2; 
13       char Char_Comp_1; 
14       char Char_Comp_2; 
15   } 
16    
17   public class Main { 
18    
19       private static final int Ident_1 = 0; 
20       private static final int Ident_2 = 1; 
21       private static final int Ident_3 = 2; 
22       private static final int Ident_4 = 3; 
23       private static final int Ident_5 = 4; 
24       private static Record recordGlob; 
25       private static Record nextRecordGlob; 
26       private static int intGlob; 
27       private static boolean blooleanGlob; 
28       private static char charGlob1; 
29       private static char charGlob2; 
30       private static int[] arrayGlob1 = new int[128]; 
31       private static int[][] arrayGlob2 = new int[128][128]; 
32       private static Record record1 = new Record(), 
33       record2 = new Record(); 
34       private static long Number_Of_Runs = 1000000; 
35    
36       private static int intLoc1; 
37       private static int intLoc2; 
38       private static int intLoc3; 
39       private static int[] intLoc3Ref = new int[1]; 
40       private static int[] intLoc1Ref = new int[1]; 
41       private static char charIndex; 
42       private static int[] enumLoc = new int[1]; 
43       private static String stringLoc1; 
44       private static String stringLoc2; 
45    
46       private static long beginTime; 
47       private static long endTime; 
48       private static long totalTime; 
49    
50       private static int i; 
51    
52       private static JInfoFrame jif = new JInfoFrame(); 
53    
54    
55       public static void execute() { 
56    
57    
58           nextRecordGlob = record2; 
59           recordGlob = record1; 
60           recordGlob.nextRecord = nextRecordGlob; 
61           recordGlob.Discr = Ident_1; 
62           recordGlob.Enum_Comp = Ident_3; 
63           recordGlob.Int_Comp = 40; 
64           recordGlob.String_Comp = "DHRYSTONE PROGRAM, SOME STRING"; 
65    
66           stringLoc1 = "DHRYSTONE PROGRAM, 1'ST STRING"; 
67    
68    
69           beginTime = System.currentTimeMillis(); 
70    
71           for (i = 1; i <= Number_Of_Runs; ++i) { 
72    
73               proc5(); 
74               proc4(); 
75    
76               intLoc1 = 2; 
77               intLoc2 = 3; 
78    
79               stringLoc2 = "DHRYSTONE PROGRAM, 2'ND STRING"; 
80    
81               enumLoc[0] = Ident_2; 
82               blooleanGlob = !func2(stringLoc1, stringLoc2); 
83    
84               while (intLoc1 < intLoc2) { 
85                   intLoc3Ref[0] = 5 * intLoc1 - intLoc2; 
86                   proc7(intLoc1, intLoc2, intLoc3Ref); 
87                   intLoc1 += 1; 
88               } 
89    
90               intLoc3 = intLoc3Ref[0]; 
91               proc8(arrayGlob1, arrayGlob2, intLoc1, intLoc3); 
92               proc1(recordGlob); 
93    
94               for (charIndex = 'A'; charIndex <= charGlob2; ++charIndex) { 
95                   if (enumLoc[0] == func1(charIndex, 'C')) 
96                       proc6(Ident_1, enumLoc); 
97               } 
98    
99               intLoc3 = intLoc2 * intLoc1; 
100              intLoc2 = intLoc3 / intLoc1; 
101              intLoc2 = 7 * (intLoc3 - intLoc2) - intLoc1; 
102   
103              intLoc1Ref[0] = intLoc1; 
104              proc2(intLoc1Ref); 
105              intLoc1 = intLoc1Ref[0]; 
106   
107          } 
108   
109          endTime = System.currentTimeMillis(); 
110          totalTime = endTime - beginTime; 
111   
112          jif.println("total time: " + totalTime + "ms"); 
113          if (totalTime == 0) { 
114              System.out.println("ran in zero time!!"); 
115              return; 
116          } 
117          jif.println("Result: " + Number_Of_Runs * 1000 / totalTime 
118                  + " dhrystone/sec."); 
119   
120      } 
121   
122      private static void proc1(Record Pointer_Par_Val) { 
123   
124          Record Next_Record = Pointer_Par_Val.nextRecord; 
125   
126          Pointer_Par_Val.nextRecord = recordGlob; 
127   
128          Pointer_Par_Val.Int_Comp = 5; 
129   
130          Next_Record.Int_Comp = Pointer_Par_Val.Int_Comp; 
131          Next_Record.nextRecord = Pointer_Par_Val.nextRecord; 
132          proc3(Next_Record.nextRecord); 
133   
134          int[] Int_Ref = new int[1]; 
135   
136          if (Next_Record.Discr == Ident_1) { 
137              Next_Record.Int_Comp = 6; 
138              Int_Ref[0] = Next_Record.Enum_Comp; 
139              proc6(Pointer_Par_Val.Enum_Comp, Int_Ref); 
140              Next_Record.Enum_Comp = Int_Ref[0]; 
141              Next_Record.nextRecord = recordGlob.nextRecord; 
142              Int_Ref[0] = Next_Record.Int_Comp; 
143              proc7(Next_Record.Int_Comp, 10, Int_Ref); 
144              Next_Record.Int_Comp = Int_Ref[0]; 
145          } else 
146              Pointer_Par_Val = Pointer_Par_Val.nextRecord; 
147   
148      } 
149   
150      private static void proc2(int Int_Par_Ref[]) { 
151   
152          int Int_Loc; 
153          int Enum_Loc; 
154   
155          Int_Loc = Int_Par_Ref[0] + 10; 
156          Enum_Loc = 0; 
157   
158          do 
159              if (charGlob1 == 'A') { 
160                  Int_Loc -= 1; 
161                  Int_Par_Ref[0] = Int_Loc - intGlob; 
162                  Enum_Loc = Ident_1; 
163              } 
164          while (Enum_Loc != Ident_1); 
165   
166      } 
167   
168      private static void proc3(Record Pointer_Par_Ref) { 
169   
170          if (recordGlob != null) 
171              Pointer_Par_Ref = recordGlob.nextRecord; 
172          else 
173              intGlob = 100; 
174   
175          int[] Int_Comp_Ref = new int[1]; 
176          Int_Comp_Ref[0] = recordGlob.Int_Comp; 
177          proc7(10, intGlob, Int_Comp_Ref); 
178          recordGlob.Int_Comp = Int_Comp_Ref[0]; 
179   
180      } 
181   
182      private static void proc4() { 
183   
184          boolean Bool_Loc; 
185   
186          Bool_Loc = charGlob1 == 'A'; 
187          Bool_Loc = Bool_Loc || blooleanGlob; 
188          charGlob2 = 'B'; 
189   
190      } 
191   
192      private static void proc5() { 
193   
194          charGlob1 = 'A'; 
195          blooleanGlob = false; 
196   
197      } 
198   
199      private static void proc6(int Enum_Par_Val, int Enum_Par_Ref[]) { 
200   
201          Enum_Par_Ref[0] = Enum_Par_Val; 
202   
203          if (!func3(Enum_Par_Val)) 
204              Enum_Par_Ref[0] = Ident_4; 
205   
206          switch (Enum_Par_Val) { 
207   
208              case Ident_1: 
209                  Enum_Par_Ref[0] = Ident_1; 
210                  break; 
211   
212              case Ident_2: 
213                  if (intGlob > 100) 
214                      Enum_Par_Ref[0] = Ident_1; 
215                  else 
216                      Enum_Par_Ref[0] = Ident_4; 
217                  break; 
218   
219              case Ident_3: 
220                  Enum_Par_Ref[0] = Ident_2; 
221                  break; 
222   
223              case Ident_4: 
224                  break; 
225   
226              case Ident_5: 
227                  Enum_Par_Ref[0] = Ident_3; 
228                  break; 
229   
230          } 
231   
232      } 
233   
234      private static void proc7(int Int_Par_Val1, int Int_Par_Val2, int Int_Par_Ref[]) { 
235   
236          int Int_Loc; 
237   
238          Int_Loc = Int_Par_Val1 + 2; 
239          Int_Par_Ref[0] = Int_Par_Val2 + Int_Loc; 
240   
241      } 
242   
243      private static void proc8(int[] Array_Par_1_Ref, int[][] Array_Par_2_Ref, int Int_Par_Val_1, int Int_Par_Val_2) { 
244   
245          int Int_Index, 
246                  Int_Loc; 
247   
248          Int_Loc = Int_Par_Val_1 + 5; 
249          Array_Par_1_Ref[Int_Loc] = Int_Par_Val_2; 
250          Array_Par_1_Ref[Int_Loc + 1] = Array_Par_1_Ref[Int_Loc]; 
251          Array_Par_1_Ref[Int_Loc + 30] = Int_Loc; 
252          for (Int_Index = Int_Loc; Int_Index <= Int_Loc + 1; ++Int_Index) 
253              Array_Par_2_Ref[Int_Loc][Int_Index] = Int_Loc; 
254          Array_Par_2_Ref[Int_Loc][Int_Loc - 1] += 1; 
255          Array_Par_2_Ref[Int_Loc + 20][Int_Loc] = Array_Par_1_Ref[Int_Loc]; 
256          intGlob = 5; 
257   
258      } 
259   
260      private static int func1(char Char_Par_1_Val, char Char_Par_2_Val) { 
261   
262          char Char_Loc_1, 
263                  Char_Loc_2; 
264   
265          Char_Loc_1 = Char_Par_1_Val; 
266          Char_Loc_2 = Char_Loc_1; 
267          if (Char_Loc_2 != Char_Par_2_Val) 
268              return Ident_1; 
269          else 
270              return Ident_2; 
271   
272      } 
273   
274      private static boolean func2(String String_Par_1_Ref, String String_Par_2_Ref) { 
275   
276          int Int_Loc; 
277          char Char_Loc = '\0'; 
278   
279          Int_Loc = 2; 
280          while (Int_Loc <= 2) 
281              if (func1(String_Par_1_Ref.charAt(Int_Loc), String_Par_2_Ref.charAt(Int_Loc + 1)) == Ident_1) { 
282                  Char_Loc = 'A'; 
283                  Int_Loc += 1; 
284              } 
285          if (Char_Loc >= 'W' && Char_Loc < 'Z') 
286              Int_Loc = 7; 
287          if (Char_Loc == 'X') 
288              return true; 
289          else { 
290              if (String_Par_1_Ref.compareTo(String_Par_2_Ref) > 0) { 
291                  Int_Loc += 7; 
292                  return true; 
293              } else 
294                  return false; 
295          } 
296   
297      } 
298   
299      private static boolean func3(int Enum_Par_Val) { 
300   
301          int Enum_Loc; 
302   
303          Enum_Loc = Enum_Par_Val; 
304          if (Enum_Loc == Ident_3) 
305              return true; 
306          else 
307              return false; 
308   
309      } 
310   
311      public static void main(String args[]) { 
312          String s="800 mhz g4,878k ds/sec¬"; 
313          Main.execute(); 
314          jif.print(s); 
315          jif.setSize(300,300); 
316          jif.show(); 
317   
318      } 
319   
320   
321  } 
322