dhry_2.c 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. *
  15. *************************************************************************
  16. */
  17. #include "dhry.h"
  18. #ifndef REG
  19. #define REG
  20. /* REG becomes defined as empty */
  21. /* i.e. no register variables */
  22. #else
  23. #define REG register
  24. #endif
  25. extern int Int_Glob;
  26. extern char Ch_1_Glob;
  27. Boolean
  28. Func_3(Enumeration Enum_Par_Val);
  29. void
  30. Proc_6(Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par)
  31. /*********************************/
  32. /* executed once */
  33. /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
  34. {
  35. *Enum_Ref_Par = Enum_Val_Par;
  36. if (!Func_3(Enum_Val_Par))
  37. /* then, not executed */
  38. *Enum_Ref_Par = Ident_4;
  39. switch (Enum_Val_Par) {
  40. case Ident_1:
  41. *Enum_Ref_Par = Ident_1;
  42. break;
  43. case Ident_2:
  44. if (Int_Glob > 100)
  45. /* then */
  46. *Enum_Ref_Par = Ident_1;
  47. else
  48. *Enum_Ref_Par = Ident_4;
  49. break;
  50. case Ident_3: /* executed */
  51. *Enum_Ref_Par = Ident_2;
  52. break;
  53. case Ident_4:
  54. break;
  55. case Ident_5:
  56. *Enum_Ref_Par = Ident_3;
  57. break;
  58. } /* switch */
  59. } /* Proc_6 */
  60. void
  61. Proc_7(One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val, One_Fifty *Int_Par_Ref)
  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_Loc;
  72. Int_Loc = Int_1_Par_Val + 2;
  73. *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
  74. } /* Proc_7 */
  75. void
  76. Proc_8(Arr_1_Dim Arr_1_Par_Ref, Arr_2_Dim Arr_2_Par_Ref, int Int_1_Par_Val,
  77. int Int_2_Par_Val)
  78. /*********************************************************************/
  79. /* executed once */
  80. /* Int_Par_Val_1 == 3 */
  81. /* Int_Par_Val_2 == 7 */
  82. {
  83. REG One_Fifty Int_Index;
  84. REG One_Fifty Int_Loc;
  85. Int_Loc = Int_1_Par_Val + 5;
  86. Arr_1_Par_Ref[Int_Loc] = Int_2_Par_Val;
  87. Arr_1_Par_Ref[Int_Loc + 1] = Arr_1_Par_Ref[Int_Loc];
  88. Arr_1_Par_Ref[Int_Loc + 30] = Int_Loc;
  89. for (Int_Index = Int_Loc; Int_Index <= Int_Loc + 1; ++Int_Index)
  90. Arr_2_Par_Ref[Int_Loc][Int_Index] = Int_Loc;
  91. Arr_2_Par_Ref[Int_Loc][Int_Loc - 1] += 1;
  92. Arr_2_Par_Ref[Int_Loc + 20][Int_Loc] = Arr_1_Par_Ref[Int_Loc];
  93. Int_Glob = 5;
  94. } /* Proc_8 */
  95. Enumeration
  96. Func_1(Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val)
  97. /*************************************************/
  98. /* executed three times */
  99. /* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */
  100. /* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */
  101. /* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */
  102. {
  103. Capital_Letter Ch_1_Loc;
  104. Capital_Letter Ch_2_Loc;
  105. Ch_1_Loc = Ch_1_Par_Val;
  106. Ch_2_Loc = Ch_1_Loc;
  107. if (Ch_2_Loc != Ch_2_Par_Val)
  108. /* then, executed */
  109. return (Ident_1);
  110. else /* not executed */
  111. {
  112. Ch_1_Glob = Ch_1_Loc;
  113. return (Ident_2);
  114. }
  115. } /* Func_1 */
  116. Boolean
  117. Func_2(Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref)
  118. /*************************************************/
  119. /* executed once */
  120. /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
  121. /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
  122. {
  123. REG One_Thirty Int_Loc;
  124. Capital_Letter Ch_Loc;
  125. Int_Loc = 2;
  126. while (Int_Loc <= 2) /* loop body executed once */
  127. if (Func_1(Str_1_Par_Ref[Int_Loc], Str_2_Par_Ref[Int_Loc + 1])
  128. == Ident_1)
  129. /* then, executed */
  130. {
  131. Ch_Loc = 'A';
  132. Int_Loc += 1;
  133. } /* if, while */
  134. if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
  135. /* then, not executed */
  136. Int_Loc = 7;
  137. if (Ch_Loc == 'R')
  138. /* then, not executed */
  139. return (true);
  140. else /* executed */
  141. {
  142. if (strcmp(Str_1_Par_Ref, Str_2_Par_Ref) > 0)
  143. /* then, not executed */
  144. {
  145. Int_Loc += 7;
  146. Int_Glob = Int_Loc;
  147. return (true);
  148. }
  149. else /* executed */
  150. return (false);
  151. } /* if Ch_Loc */
  152. } /* Func_2 */
  153. Boolean
  154. Func_3(Enumeration Enum_Par_Val)
  155. /***************************/
  156. /* executed once */
  157. /* Enum_Par_Val == Ident_3 */
  158. {
  159. Enumeration Enum_Loc;
  160. Enum_Loc = Enum_Par_Val;
  161. if (Enum_Loc == Ident_3)
  162. /* then, executed */
  163. return (true);
  164. else /* not executed */
  165. return (false);
  166. } /* Func_3 */