dhry_2.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. ****************************************************************************
  3. *
  4. * "DHRYSTONE" Benchmark Program
  5. * -----------------------------
  6. *
  7. * Version: C, Version 2.1
  8. *
  9. * File: dhry_2.c (part 3 of 3)
  10. *
  11. * Date: May 25, 1988
  12. *
  13. * Author: Reinhold P. Weicker
  14. * converted to ANSI C by Jeremy Johnson. 1/20/00
  15. *
  16. ****************************************************************************
  17. */
  18. #include "dhry.h"
  19. #ifndef REG
  20. #define REG
  21. /* REG becomes defined as empty */
  22. /* i.e. no register variables */
  23. #endif
  24. extern int Int_Glob;
  25. extern char Ch_1_Glob;
  26. void Proc_6 (Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par)
  27. /* Converted to ANSI style declaration. JRJ */
  28. /*********************************/
  29. /* executed once */
  30. /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
  31. /*
  32. Enumeration Enum_Val_Par;
  33. Enumeration *Enum_Ref_Par;
  34. */
  35. {
  36. *Enum_Ref_Par = Enum_Val_Par;
  37. if (! Func_3 (Enum_Val_Par))
  38. /* then, not executed */
  39. *Enum_Ref_Par = Ident_4;
  40. switch (Enum_Val_Par)
  41. {
  42. case Ident_1:
  43. *Enum_Ref_Par = Ident_1;
  44. break;
  45. case Ident_2:
  46. if (Int_Glob > 100)
  47. /* then */
  48. *Enum_Ref_Par = Ident_1;
  49. else *Enum_Ref_Par = Ident_4;
  50. break;
  51. case Ident_3: /* executed */
  52. *Enum_Ref_Par = Ident_2;
  53. break;
  54. case Ident_4: break;
  55. case Ident_5:
  56. *Enum_Ref_Par = Ident_3;
  57. break;
  58. } /* switch */
  59. } /* Proc_6 */
  60. void Proc_7 (One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val, One_Fifty *Int_Par_Ref)
  61. /* Converted to ANSI style declaration. JRJ */
  62. /**********************************************/
  63. /* executed three times */
  64. /* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */
  65. /* Int_Par_Ref becomes 7 */
  66. /* second call: Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
  67. /* Int_Par_Ref becomes 17 */
  68. /* third call: Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
  69. /* Int_Par_Ref becomes 18 */
  70. /*
  71. One_Fifty Int_1_Par_Val;
  72. One_Fifty Int_2_Par_Val;
  73. One_Fifty *Int_Par_Ref;
  74. */
  75. {
  76. One_Fifty Int_Loc;
  77. Int_Loc = Int_1_Par_Val + 2;
  78. *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
  79. } /* Proc_7 */
  80. void Proc_8 (Arr_1_Dim Arr_1_Par_Ref, Arr_2_Dim Arr_2_Par_Ref, int Int_1_Par_Val, int Int_2_Par_Val)
  81. /* Converted to ANSI style declaration. JRJ */
  82. /*********************************************************************/
  83. /* executed once */
  84. /* Int_Par_Val_1 == 3 */
  85. /* Int_Par_Val_2 == 7 */
  86. /*
  87. Arr_1_Dim Arr_1_Par_Ref;
  88. Arr_2_Dim Arr_2_Par_Ref;
  89. int Int_1_Par_Val;
  90. int Int_2_Par_Val;
  91. */
  92. {
  93. REG One_Fifty Int_Index;
  94. REG One_Fifty Int_Loc;
  95. Int_Loc = Int_1_Par_Val + 5;
  96. Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
  97. Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
  98. Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
  99. for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
  100. Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc;
  101. Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1;
  102. Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc];
  103. Int_Glob = 5;
  104. } /* Proc_8 */
  105. Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val)
  106. /* Converted to ANSI style declaration. JRJ */
  107. /*************************************************/
  108. /* executed three times */
  109. /* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */
  110. /* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */
  111. /* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */
  112. /*
  113. Capital_Letter Ch_1_Par_Val;
  114. Capital_Letter Ch_2_Par_Val;
  115. */
  116. {
  117. Capital_Letter Ch_1_Loc;
  118. Capital_Letter Ch_2_Loc;
  119. Ch_1_Loc = Ch_1_Par_Val;
  120. Ch_2_Loc = Ch_1_Loc;
  121. if (Ch_2_Loc != Ch_2_Par_Val)
  122. /* then, executed */
  123. return (Ident_1);
  124. else /* not executed */
  125. {
  126. Ch_1_Glob = Ch_1_Loc;
  127. return (Ident_2);
  128. }
  129. } /* Func_1 */
  130. Boolean Func_2 (Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref)
  131. /* Converted to ANSI style declaration. JRJ */
  132. /*************************************************/
  133. /* executed once */
  134. /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
  135. /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
  136. /*
  137. Str_30 Str_1_Par_Ref;
  138. Str_30 Str_2_Par_Ref;
  139. */
  140. {
  141. REG One_Thirty Int_Loc;
  142. Capital_Letter Ch_Loc;
  143. Int_Loc = 2;
  144. while (Int_Loc <= 2) /* loop body executed once */
  145. if (Func_1 (Str_1_Par_Ref[Int_Loc],
  146. Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
  147. /* then, executed */
  148. {
  149. Ch_Loc = 'A';
  150. Int_Loc += 1;
  151. } /* if, while */
  152. if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
  153. /* then, not executed */
  154. Int_Loc = 7;
  155. if (Ch_Loc == 'R')
  156. /* then, not executed */
  157. return (true);
  158. else /* executed */
  159. {
  160. if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
  161. /* then, not executed */
  162. {
  163. Int_Loc += 7;
  164. Int_Glob = Int_Loc;
  165. return (true);
  166. }
  167. else /* executed */
  168. return (false);
  169. } /* if Ch_Loc */
  170. } /* Func_2 */
  171. Boolean Func_3 (Enumeration Enum_Par_Val)
  172. /* Converted to ANSI style declaration. JRJ */
  173. /***************************/
  174. /* executed once */
  175. /* Enum_Par_Val == Ident_3 */
  176. /* Enumeration Enum_Par_Val; */
  177. {
  178. Enumeration Enum_Loc;
  179. Enum_Loc = Enum_Par_Val;
  180. if (Enum_Loc == Ident_3)
  181. /* then, executed */
  182. return (true);
  183. else /* not executed */
  184. return (false);
  185. } /* Func_3 */