1 /*****************************************************************************
2 * The BYTE UNIX Benchmarks - Release 3
3 * Module: dhry_2.c SID: 3.4 5/15/91 19:30:22
5 *****************************************************************************
6 * Bug reports, patches, comments, suggestions should be sent to:
8 * Ben Smith, Rick Grehan or Tom Yager
9 * ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
11 *****************************************************************************
13 * 10/22/97 - code cleanup to remove ANSI C compiler warnings
14 * Andy Kahn <kahn@zk3.dec.com>
18 * "DHRYSTONE" Benchmark Program
19 * -----------------------------
21 * **** WARNING **** See warning in n.dhry_1.c
23 * Version: C, Version 2.1
25 * File: dhry_2.c (part 3 of 3)
29 * Author: Reinhold P. Weicker
31 ****************************************************************************/
32 /* SCCSid is defined in dhry_1.c */
39 /* REG becomes defined as empty */
40 /* i.e. no register variables */
44 extern char Ch_1_Glob
;
46 void Proc_6(Enumeration
, Enumeration
*);
47 void Proc_7(One_Fifty
, One_Fifty
, One_Fifty
*);
48 void Proc_8(Arr_1_Dim
, Arr_2_Dim
, int, int);
49 Enumeration
Func_1(Capital_Letter
, Capital_Letter
);
50 Boolean
Func_2(Str_30
, Str_30
);
51 Boolean
Func_3(Enumeration
);
53 void Proc_6 (Enumeration Enum_Val_Par
, Enumeration
*Enum_Ref_Par
)
55 /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
57 *Enum_Ref_Par
= Enum_Val_Par
;
58 if (! Func_3 (Enum_Val_Par
))
59 /* then, not executed */
60 *Enum_Ref_Par
= Ident_4
;
64 *Enum_Ref_Par
= Ident_1
;
69 *Enum_Ref_Par
= Ident_1
;
70 else *Enum_Ref_Par
= Ident_4
;
72 case Ident_3
: /* executed */
73 *Enum_Ref_Par
= Ident_2
;
77 *Enum_Ref_Par
= Ident_3
;
82 void Proc_7 (Int_1_Par_Val
, Int_2_Par_Val
, Int_Par_Ref
)
83 One_Fifty Int_1_Par_Val
;
84 One_Fifty Int_2_Par_Val
;
85 One_Fifty
*Int_Par_Ref
;
86 /**********************************************/
87 /* executed three times */
88 /* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */
89 /* Int_Par_Ref becomes 7 */
90 /* second call: Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
91 /* Int_Par_Ref becomes 17 */
92 /* third call: Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
93 /* Int_Par_Ref becomes 18 */
97 Int_Loc
= Int_1_Par_Val
+ 2;
98 *Int_Par_Ref
= Int_2_Par_Val
+ Int_Loc
;
102 void Proc_8 (Arr_1_Par_Ref
, Arr_2_Par_Ref
, Int_1_Par_Val
, Int_2_Par_Val
)
103 /*********************************************************************/
105 /* Int_Par_Val_1 == 3 */
106 /* Int_Par_Val_2 == 7 */
107 Arr_1_Dim Arr_1_Par_Ref
;
108 Arr_2_Dim Arr_2_Par_Ref
;
112 REG One_Fifty Int_Index
;
113 REG One_Fifty Int_Loc
;
115 Int_Loc
= Int_1_Par_Val
+ 5;
116 Arr_1_Par_Ref
[Int_Loc
] = Int_2_Par_Val
;
117 Arr_1_Par_Ref
[Int_Loc
+1] = Arr_1_Par_Ref
[Int_Loc
];
118 Arr_1_Par_Ref
[Int_Loc
+30] = Int_Loc
;
119 for (Int_Index
= Int_Loc
; Int_Index
<= Int_Loc
+1; ++Int_Index
)
120 Arr_2_Par_Ref
[Int_Loc
] [Int_Index
] = Int_Loc
;
121 Arr_2_Par_Ref
[Int_Loc
] [Int_Loc
-1] += 1;
122 Arr_2_Par_Ref
[Int_Loc
+20] [Int_Loc
] = Arr_1_Par_Ref
[Int_Loc
];
127 Enumeration
Func_1 (Capital_Letter Ch_1_Par_Val
, Capital_Letter Ch_2_Par_Val
)
128 /*************************************************/
129 /* executed three times */
130 /* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */
131 /* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */
132 /* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */
134 Capital_Letter Ch_1_Loc
;
135 Capital_Letter Ch_2_Loc
;
137 Ch_1_Loc
= Ch_1_Par_Val
;
139 if (Ch_2_Loc
!= Ch_2_Par_Val
)
142 else /* not executed */
144 Ch_1_Glob
= Ch_1_Loc
;
151 Boolean
Func_2 (Str_1_Par_Ref
, Str_2_Par_Ref
)
152 /*************************************************/
154 /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
155 /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
157 Str_30 Str_1_Par_Ref
;
158 Str_30 Str_2_Par_Ref
;
160 REG One_Thirty Int_Loc
;
161 Capital_Letter Ch_Loc
;
165 while (Int_Loc
<= 2) /* loop body executed once */
166 if (Func_1 (Str_1_Par_Ref
[Int_Loc
],
167 Str_2_Par_Ref
[Int_Loc
+1]) == Ident_1
)
173 if (Ch_Loc
>= 'W' && Ch_Loc
< 'Z')
174 /* then, not executed */
177 /* then, not executed */
181 if (strcmp (Str_1_Par_Ref
, Str_2_Par_Ref
) > 0)
182 /* then, not executed */
194 Boolean
Func_3 (Enum_Par_Val
)
195 /***************************/
197 /* Enum_Par_Val == Ident_3 */
198 Enumeration Enum_Par_Val
;
200 Enumeration Enum_Loc
;
202 Enum_Loc
= Enum_Par_Val
;
203 if (Enum_Loc
== Ident_3
)
206 else /* not executed */