1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * (C) Copyright 2015 Google, Inc
3*4882a593Smuzhiyun *
4*4882a593Smuzhiyun * SPDX-License-Identifier: GPL-2.0+
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * Dhrystone is widely available in the public domain. A GPL license is
7*4882a593Smuzhiyun * chosen for U-Boot.
8*4882a593Smuzhiyun */
9*4882a593Smuzhiyun
10*4882a593Smuzhiyun /*****************************************************************************
11*4882a593Smuzhiyun * The BYTE UNIX Benchmarks - Release 3
12*4882a593Smuzhiyun * Module: dhry_1.c SID: 3.4 5/15/91 19:30:21
13*4882a593Smuzhiyun *
14*4882a593Smuzhiyun *****************************************************************************
15*4882a593Smuzhiyun * Bug reports, patches, comments, suggestions should be sent to:
16*4882a593Smuzhiyun *
17*4882a593Smuzhiyun * Ben Smith, Rick Grehan or Tom Yager
18*4882a593Smuzhiyun * ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
19*4882a593Smuzhiyun *
20*4882a593Smuzhiyun *****************************************************************************
21*4882a593Smuzhiyun *
22*4882a593Smuzhiyun * *** WARNING **** With BYTE's modifications applied, results obtained with
23*4882a593Smuzhiyun * ******* this version of the Dhrystone program may not be applicable
24*4882a593Smuzhiyun * to other versions.
25*4882a593Smuzhiyun *
26*4882a593Smuzhiyun * Modification Log:
27*4882a593Smuzhiyun * 10/22/97 - code cleanup to remove ANSI C compiler warnings
28*4882a593Smuzhiyun * Andy Kahn <kahn@zk3.dec.com>
29*4882a593Smuzhiyun *
30*4882a593Smuzhiyun * Adapted from:
31*4882a593Smuzhiyun *
32*4882a593Smuzhiyun * "DHRYSTONE" Benchmark Program
33*4882a593Smuzhiyun * -----------------------------
34*4882a593Smuzhiyun *
35*4882a593Smuzhiyun * Version: C, Version 2.1
36*4882a593Smuzhiyun *
37*4882a593Smuzhiyun * File: dhry_1.c (part 2 of 3)
38*4882a593Smuzhiyun *
39*4882a593Smuzhiyun * Date: May 25, 1988
40*4882a593Smuzhiyun *
41*4882a593Smuzhiyun * Author: Reinhold P. Weicker
42*4882a593Smuzhiyun *
43*4882a593Smuzhiyun ***************************************************************************/
44*4882a593Smuzhiyun char SCCSid[] = "@(#) @(#)dhry_1.c:3.4 -- 5/15/91 19:30:21";
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun #include <common.h>
47*4882a593Smuzhiyun #include <malloc.h>
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun #include "dhry.h"
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun unsigned long Run_Index;
52*4882a593Smuzhiyun
report(void)53*4882a593Smuzhiyun void report(void)
54*4882a593Smuzhiyun {
55*4882a593Smuzhiyun printf("%ld loops\n", Run_Index);
56*4882a593Smuzhiyun }
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun /* Global Variables: */
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun Rec_Pointer Ptr_Glob,
61*4882a593Smuzhiyun Next_Ptr_Glob;
62*4882a593Smuzhiyun int Int_Glob;
63*4882a593Smuzhiyun Boolean Bool_Glob;
64*4882a593Smuzhiyun char Ch_1_Glob,
65*4882a593Smuzhiyun Ch_2_Glob;
66*4882a593Smuzhiyun int Arr_1_Glob [50];
67*4882a593Smuzhiyun int Arr_2_Glob [50] [50];
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val);
70*4882a593Smuzhiyun /* forward declaration necessary since Enumeration may not simply be int */
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun #ifndef REG
73*4882a593Smuzhiyun Boolean Reg = false;
74*4882a593Smuzhiyun #define REG
75*4882a593Smuzhiyun /* REG becomes defined as empty */
76*4882a593Smuzhiyun /* i.e. no register variables */
77*4882a593Smuzhiyun #else
78*4882a593Smuzhiyun Boolean Reg = true;
79*4882a593Smuzhiyun #endif
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun /* variables for time measurement: */
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun #ifdef TIMES
84*4882a593Smuzhiyun #define Too_Small_Time 120
85*4882a593Smuzhiyun /* Measurements should last at least about 2 seconds */
86*4882a593Smuzhiyun #endif
87*4882a593Smuzhiyun #ifdef TIME
88*4882a593Smuzhiyun extern long time();
89*4882a593Smuzhiyun /* see library function "time" */
90*4882a593Smuzhiyun #define Too_Small_Time 2
91*4882a593Smuzhiyun /* Measurements should last at least 2 seconds */
92*4882a593Smuzhiyun #endif
93*4882a593Smuzhiyun
94*4882a593Smuzhiyun long Begin_Time,
95*4882a593Smuzhiyun End_Time,
96*4882a593Smuzhiyun User_Time;
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun /* end of variables for time measurement */
99*4882a593Smuzhiyun
100*4882a593Smuzhiyun void Proc_1 (REG Rec_Pointer Ptr_Val_Par);
101*4882a593Smuzhiyun void Proc_2 (One_Fifty *Int_Par_Ref);
102*4882a593Smuzhiyun void Proc_3 (Rec_Pointer *Ptr_Ref_Par);
103*4882a593Smuzhiyun void Proc_4 (void);
104*4882a593Smuzhiyun void Proc_5 (void);
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun
107*4882a593Smuzhiyun extern Boolean Func_2(Str_30, Str_30);
108*4882a593Smuzhiyun extern void Proc_6(Enumeration, Enumeration *);
109*4882a593Smuzhiyun extern void Proc_7(One_Fifty, One_Fifty, One_Fifty *);
110*4882a593Smuzhiyun extern void Proc_8(Arr_1_Dim, Arr_2_Dim, int, int);
111*4882a593Smuzhiyun
dhry(int Number_Of_Runs)112*4882a593Smuzhiyun void dhry(int Number_Of_Runs)
113*4882a593Smuzhiyun /* main program, corresponds to procedures */
114*4882a593Smuzhiyun /* Main and Proc_0 in the Ada version */
115*4882a593Smuzhiyun {
116*4882a593Smuzhiyun One_Fifty Int_1_Loc;
117*4882a593Smuzhiyun REG One_Fifty Int_2_Loc;
118*4882a593Smuzhiyun One_Fifty Int_3_Loc;
119*4882a593Smuzhiyun REG char Ch_Index;
120*4882a593Smuzhiyun Enumeration Enum_Loc;
121*4882a593Smuzhiyun Str_30 Str_1_Loc;
122*4882a593Smuzhiyun Str_30 Str_2_Loc;
123*4882a593Smuzhiyun
124*4882a593Smuzhiyun /* Initializations */
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun Next_Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
127*4882a593Smuzhiyun Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
128*4882a593Smuzhiyun
129*4882a593Smuzhiyun Ptr_Glob->Ptr_Comp = Next_Ptr_Glob;
130*4882a593Smuzhiyun Ptr_Glob->Discr = Ident_1;
131*4882a593Smuzhiyun Ptr_Glob->variant.var_1.Enum_Comp = Ident_3;
132*4882a593Smuzhiyun Ptr_Glob->variant.var_1.Int_Comp = 40;
133*4882a593Smuzhiyun strcpy (Ptr_Glob->variant.var_1.Str_Comp,
134*4882a593Smuzhiyun "DHRYSTONE PROGRAM, SOME STRING");
135*4882a593Smuzhiyun strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");
136*4882a593Smuzhiyun
137*4882a593Smuzhiyun Arr_2_Glob [8][7] = 10;
138*4882a593Smuzhiyun /* Was missing in published program. Without this statement, */
139*4882a593Smuzhiyun /* Arr_2_Glob [8][7] would have an undefined value. */
140*4882a593Smuzhiyun /* Warning: With 16-Bit processors and Number_Of_Runs > 32000, */
141*4882a593Smuzhiyun /* overflow may occur for this array element. */
142*4882a593Smuzhiyun
143*4882a593Smuzhiyun #ifdef PRATTLE
144*4882a593Smuzhiyun printf ("\n");
145*4882a593Smuzhiyun printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
146*4882a593Smuzhiyun printf ("\n");
147*4882a593Smuzhiyun if (Reg)
148*4882a593Smuzhiyun {
149*4882a593Smuzhiyun printf ("Program compiled with 'register' attribute\n");
150*4882a593Smuzhiyun printf ("\n");
151*4882a593Smuzhiyun }
152*4882a593Smuzhiyun else
153*4882a593Smuzhiyun {
154*4882a593Smuzhiyun printf ("Program compiled without 'register' attribute\n");
155*4882a593Smuzhiyun printf ("\n");
156*4882a593Smuzhiyun }
157*4882a593Smuzhiyun printf ("Please give the number of runs through the benchmark: ");
158*4882a593Smuzhiyun {
159*4882a593Smuzhiyun int n;
160*4882a593Smuzhiyun scanf ("%d", &n);
161*4882a593Smuzhiyun Number_Of_Runs = n;
162*4882a593Smuzhiyun }
163*4882a593Smuzhiyun printf ("\n");
164*4882a593Smuzhiyun
165*4882a593Smuzhiyun printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
166*4882a593Smuzhiyun #endif /* PRATTLE */
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun Run_Index = 0;
169*4882a593Smuzhiyun
170*4882a593Smuzhiyun /***************/
171*4882a593Smuzhiyun /* Start timer */
172*4882a593Smuzhiyun /***************/
173*4882a593Smuzhiyun
174*4882a593Smuzhiyun #ifdef SELF_TIMED
175*4882a593Smuzhiyun #ifdef TIMES
176*4882a593Smuzhiyun times (&time_info);
177*4882a593Smuzhiyun Begin_Time = (long) time_info.tms_utime;
178*4882a593Smuzhiyun #endif
179*4882a593Smuzhiyun #ifdef TIME
180*4882a593Smuzhiyun Begin_Time = time ( (long *) 0);
181*4882a593Smuzhiyun #endif
182*4882a593Smuzhiyun #endif /* SELF_TIMED */
183*4882a593Smuzhiyun
184*4882a593Smuzhiyun for (Run_Index = 1; Run_Index < Number_Of_Runs; ++Run_Index)
185*4882a593Smuzhiyun {
186*4882a593Smuzhiyun
187*4882a593Smuzhiyun Proc_5();
188*4882a593Smuzhiyun Proc_4();
189*4882a593Smuzhiyun /* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */
190*4882a593Smuzhiyun Int_1_Loc = 2;
191*4882a593Smuzhiyun Int_2_Loc = 3;
192*4882a593Smuzhiyun strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
193*4882a593Smuzhiyun Enum_Loc = Ident_2;
194*4882a593Smuzhiyun Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
195*4882a593Smuzhiyun /* Bool_Glob == 1 */
196*4882a593Smuzhiyun while (Int_1_Loc < Int_2_Loc) /* loop body executed once */
197*4882a593Smuzhiyun {
198*4882a593Smuzhiyun Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
199*4882a593Smuzhiyun /* Int_3_Loc == 7 */
200*4882a593Smuzhiyun Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
201*4882a593Smuzhiyun /* Int_3_Loc == 7 */
202*4882a593Smuzhiyun Int_1_Loc += 1;
203*4882a593Smuzhiyun } /* while */
204*4882a593Smuzhiyun /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
205*4882a593Smuzhiyun Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc);
206*4882a593Smuzhiyun /* Int_Glob == 5 */
207*4882a593Smuzhiyun Proc_1 (Ptr_Glob);
208*4882a593Smuzhiyun for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
209*4882a593Smuzhiyun /* loop body executed twice */
210*4882a593Smuzhiyun {
211*4882a593Smuzhiyun if (Enum_Loc == Func_1 (Ch_Index, 'C'))
212*4882a593Smuzhiyun /* then, not executed */
213*4882a593Smuzhiyun {
214*4882a593Smuzhiyun Proc_6 (Ident_1, &Enum_Loc);
215*4882a593Smuzhiyun strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
216*4882a593Smuzhiyun Int_2_Loc = Run_Index;
217*4882a593Smuzhiyun Int_Glob = Run_Index;
218*4882a593Smuzhiyun }
219*4882a593Smuzhiyun }
220*4882a593Smuzhiyun /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
221*4882a593Smuzhiyun Int_2_Loc = Int_2_Loc * Int_1_Loc;
222*4882a593Smuzhiyun Int_1_Loc = Int_2_Loc / Int_3_Loc;
223*4882a593Smuzhiyun Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc;
224*4882a593Smuzhiyun /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */
225*4882a593Smuzhiyun Proc_2 (&Int_1_Loc);
226*4882a593Smuzhiyun /* Int_1_Loc == 5 */
227*4882a593Smuzhiyun
228*4882a593Smuzhiyun } /* loop "for Run_Index" */
229*4882a593Smuzhiyun
230*4882a593Smuzhiyun /**************/
231*4882a593Smuzhiyun /* Stop timer */
232*4882a593Smuzhiyun /**************/
233*4882a593Smuzhiyun #ifdef SELF_TIMED
234*4882a593Smuzhiyun #ifdef TIMES
235*4882a593Smuzhiyun times (&time_info);
236*4882a593Smuzhiyun End_Time = (long) time_info.tms_utime;
237*4882a593Smuzhiyun #endif
238*4882a593Smuzhiyun #ifdef TIME
239*4882a593Smuzhiyun End_Time = time ( (long *) 0);
240*4882a593Smuzhiyun #endif
241*4882a593Smuzhiyun #endif /* SELF_TIMED */
242*4882a593Smuzhiyun
243*4882a593Smuzhiyun /* BYTE version never executes this stuff */
244*4882a593Smuzhiyun #ifdef SELF_TIMED
245*4882a593Smuzhiyun printf ("Execution ends\n");
246*4882a593Smuzhiyun printf ("\n");
247*4882a593Smuzhiyun printf ("Final values of the variables used in the benchmark:\n");
248*4882a593Smuzhiyun printf ("\n");
249*4882a593Smuzhiyun printf ("Int_Glob: %d\n", Int_Glob);
250*4882a593Smuzhiyun printf (" should be: %d\n", 5);
251*4882a593Smuzhiyun printf ("Bool_Glob: %d\n", Bool_Glob);
252*4882a593Smuzhiyun printf (" should be: %d\n", 1);
253*4882a593Smuzhiyun printf ("Ch_1_Glob: %c\n", Ch_1_Glob);
254*4882a593Smuzhiyun printf (" should be: %c\n", 'A');
255*4882a593Smuzhiyun printf ("Ch_2_Glob: %c\n", Ch_2_Glob);
256*4882a593Smuzhiyun printf (" should be: %c\n", 'B');
257*4882a593Smuzhiyun printf ("Arr_1_Glob[8]: %d\n", Arr_1_Glob[8]);
258*4882a593Smuzhiyun printf (" should be: %d\n", 7);
259*4882a593Smuzhiyun printf ("Arr_2_Glob[8][7]: %d\n", Arr_2_Glob[8][7]);
260*4882a593Smuzhiyun printf (" should be: Number_Of_Runs + 10\n");
261*4882a593Smuzhiyun printf ("Ptr_Glob->\n");
262*4882a593Smuzhiyun printf (" Ptr_Comp: %d\n", (int) Ptr_Glob->Ptr_Comp);
263*4882a593Smuzhiyun printf (" should be: (implementation-dependent)\n");
264*4882a593Smuzhiyun printf (" Discr: %d\n", Ptr_Glob->Discr);
265*4882a593Smuzhiyun printf (" should be: %d\n", 0);
266*4882a593Smuzhiyun printf (" Enum_Comp: %d\n", Ptr_Glob->variant.var_1.Enum_Comp);
267*4882a593Smuzhiyun printf (" should be: %d\n", 2);
268*4882a593Smuzhiyun printf (" Int_Comp: %d\n", Ptr_Glob->variant.var_1.Int_Comp);
269*4882a593Smuzhiyun printf (" should be: %d\n", 17);
270*4882a593Smuzhiyun printf (" Str_Comp: %s\n", Ptr_Glob->variant.var_1.Str_Comp);
271*4882a593Smuzhiyun printf (" should be: DHRYSTONE PROGRAM, SOME STRING\n");
272*4882a593Smuzhiyun printf ("Next_Ptr_Glob->\n");
273*4882a593Smuzhiyun printf (" Ptr_Comp: %d\n", (int) Next_Ptr_Glob->Ptr_Comp);
274*4882a593Smuzhiyun printf (" should be: (implementation-dependent), same as above\n");
275*4882a593Smuzhiyun printf (" Discr: %d\n", Next_Ptr_Glob->Discr);
276*4882a593Smuzhiyun printf (" should be: %d\n", 0);
277*4882a593Smuzhiyun printf (" Enum_Comp: %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp);
278*4882a593Smuzhiyun printf (" should be: %d\n", 1);
279*4882a593Smuzhiyun printf (" Int_Comp: %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp);
280*4882a593Smuzhiyun printf (" should be: %d\n", 18);
281*4882a593Smuzhiyun printf (" Str_Comp: %s\n",
282*4882a593Smuzhiyun Next_Ptr_Glob->variant.var_1.Str_Comp);
283*4882a593Smuzhiyun printf (" should be: DHRYSTONE PROGRAM, SOME STRING\n");
284*4882a593Smuzhiyun printf ("Int_1_Loc: %d\n", Int_1_Loc);
285*4882a593Smuzhiyun printf (" should be: %d\n", 5);
286*4882a593Smuzhiyun printf ("Int_2_Loc: %d\n", Int_2_Loc);
287*4882a593Smuzhiyun printf (" should be: %d\n", 13);
288*4882a593Smuzhiyun printf ("Int_3_Loc: %d\n", Int_3_Loc);
289*4882a593Smuzhiyun printf (" should be: %d\n", 7);
290*4882a593Smuzhiyun printf ("Enum_Loc: %d\n", Enum_Loc);
291*4882a593Smuzhiyun printf (" should be: %d\n", 1);
292*4882a593Smuzhiyun printf ("Str_1_Loc: %s\n", Str_1_Loc);
293*4882a593Smuzhiyun printf (" should be: DHRYSTONE PROGRAM, 1'ST STRING\n");
294*4882a593Smuzhiyun printf ("Str_2_Loc: %s\n", Str_2_Loc);
295*4882a593Smuzhiyun printf (" should be: DHRYSTONE PROGRAM, 2'ND STRING\n");
296*4882a593Smuzhiyun printf ("\n");
297*4882a593Smuzhiyun
298*4882a593Smuzhiyun User_Time = End_Time - Begin_Time;
299*4882a593Smuzhiyun
300*4882a593Smuzhiyun if (User_Time < Too_Small_Time)
301*4882a593Smuzhiyun {
302*4882a593Smuzhiyun printf ("Measured time too small to obtain meaningful results\n");
303*4882a593Smuzhiyun printf ("Please increase number of runs\n");
304*4882a593Smuzhiyun printf ("\n");
305*4882a593Smuzhiyun }
306*4882a593Smuzhiyun else
307*4882a593Smuzhiyun {
308*4882a593Smuzhiyun #ifdef TIME
309*4882a593Smuzhiyun Microseconds = (float) User_Time * Mic_secs_Per_Second
310*4882a593Smuzhiyun / (float) Number_Of_Runs;
311*4882a593Smuzhiyun Dhrystones_Per_Second = (float) Number_Of_Runs / (float) User_Time;
312*4882a593Smuzhiyun #else
313*4882a593Smuzhiyun Microseconds = (float) User_Time * Mic_secs_Per_Second
314*4882a593Smuzhiyun / ((float) HZ * ((float) Number_Of_Runs));
315*4882a593Smuzhiyun Dhrystones_Per_Second = ((float) HZ * (float) Number_Of_Runs)
316*4882a593Smuzhiyun / (float) User_Time;
317*4882a593Smuzhiyun #endif
318*4882a593Smuzhiyun printf ("Microseconds for one run through Dhrystone: ");
319*4882a593Smuzhiyun printf ("%6.1f \n", Microseconds);
320*4882a593Smuzhiyun printf ("Dhrystones per Second: ");
321*4882a593Smuzhiyun printf ("%6.1f \n", Dhrystones_Per_Second);
322*4882a593Smuzhiyun printf ("\n");
323*4882a593Smuzhiyun }
324*4882a593Smuzhiyun #endif /* SELF_TIMED */
325*4882a593Smuzhiyun }
326*4882a593Smuzhiyun
327*4882a593Smuzhiyun
Proc_1(REG Rec_Pointer Ptr_Val_Par)328*4882a593Smuzhiyun void Proc_1 (REG Rec_Pointer Ptr_Val_Par)
329*4882a593Smuzhiyun /* executed once */
330*4882a593Smuzhiyun {
331*4882a593Smuzhiyun REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;
332*4882a593Smuzhiyun /* == Ptr_Glob_Next */
333*4882a593Smuzhiyun /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp, */
334*4882a593Smuzhiyun /* corresponds to "rename" in Ada, "with" in Pascal */
335*4882a593Smuzhiyun
336*4882a593Smuzhiyun structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob);
337*4882a593Smuzhiyun Ptr_Val_Par->variant.var_1.Int_Comp = 5;
338*4882a593Smuzhiyun Next_Record->variant.var_1.Int_Comp
339*4882a593Smuzhiyun = Ptr_Val_Par->variant.var_1.Int_Comp;
340*4882a593Smuzhiyun Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
341*4882a593Smuzhiyun Proc_3 (&Next_Record->Ptr_Comp);
342*4882a593Smuzhiyun /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp
343*4882a593Smuzhiyun == Ptr_Glob->Ptr_Comp */
344*4882a593Smuzhiyun if (Next_Record->Discr == Ident_1)
345*4882a593Smuzhiyun /* then, executed */
346*4882a593Smuzhiyun {
347*4882a593Smuzhiyun Next_Record->variant.var_1.Int_Comp = 6;
348*4882a593Smuzhiyun Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp,
349*4882a593Smuzhiyun &Next_Record->variant.var_1.Enum_Comp);
350*4882a593Smuzhiyun Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
351*4882a593Smuzhiyun Proc_7 (Next_Record->variant.var_1.Int_Comp, 10,
352*4882a593Smuzhiyun &Next_Record->variant.var_1.Int_Comp);
353*4882a593Smuzhiyun }
354*4882a593Smuzhiyun else /* not executed */
355*4882a593Smuzhiyun structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp);
356*4882a593Smuzhiyun } /* Proc_1 */
357*4882a593Smuzhiyun
358*4882a593Smuzhiyun
Proc_2(One_Fifty * Int_Par_Ref)359*4882a593Smuzhiyun void Proc_2 (One_Fifty *Int_Par_Ref)
360*4882a593Smuzhiyun /* executed once */
361*4882a593Smuzhiyun /* *Int_Par_Ref == 1, becomes 4 */
362*4882a593Smuzhiyun {
363*4882a593Smuzhiyun One_Fifty Int_Loc;
364*4882a593Smuzhiyun Enumeration Enum_Loc;
365*4882a593Smuzhiyun
366*4882a593Smuzhiyun Enum_Loc = 0;
367*4882a593Smuzhiyun
368*4882a593Smuzhiyun Int_Loc = *Int_Par_Ref + 10;
369*4882a593Smuzhiyun do /* executed once */
370*4882a593Smuzhiyun if (Ch_1_Glob == 'A')
371*4882a593Smuzhiyun /* then, executed */
372*4882a593Smuzhiyun {
373*4882a593Smuzhiyun Int_Loc -= 1;
374*4882a593Smuzhiyun *Int_Par_Ref = Int_Loc - Int_Glob;
375*4882a593Smuzhiyun Enum_Loc = Ident_1;
376*4882a593Smuzhiyun } /* if */
377*4882a593Smuzhiyun while (Enum_Loc != Ident_1); /* true */
378*4882a593Smuzhiyun } /* Proc_2 */
379*4882a593Smuzhiyun
380*4882a593Smuzhiyun
Proc_3(Rec_Pointer * Ptr_Ref_Par)381*4882a593Smuzhiyun void Proc_3 (Rec_Pointer *Ptr_Ref_Par)
382*4882a593Smuzhiyun /* executed once */
383*4882a593Smuzhiyun /* Ptr_Ref_Par becomes Ptr_Glob */
384*4882a593Smuzhiyun {
385*4882a593Smuzhiyun if (Ptr_Glob != Null)
386*4882a593Smuzhiyun /* then, executed */
387*4882a593Smuzhiyun *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
388*4882a593Smuzhiyun Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
389*4882a593Smuzhiyun } /* Proc_3 */
390*4882a593Smuzhiyun
391*4882a593Smuzhiyun
Proc_4(void)392*4882a593Smuzhiyun void Proc_4 (void) /* without parameters */
393*4882a593Smuzhiyun /* executed once */
394*4882a593Smuzhiyun {
395*4882a593Smuzhiyun Boolean Bool_Loc;
396*4882a593Smuzhiyun
397*4882a593Smuzhiyun Bool_Loc = Ch_1_Glob == 'A';
398*4882a593Smuzhiyun Bool_Glob = Bool_Loc | Bool_Glob;
399*4882a593Smuzhiyun Ch_2_Glob = 'B';
400*4882a593Smuzhiyun } /* Proc_4 */
401*4882a593Smuzhiyun
Proc_5(void)402*4882a593Smuzhiyun void Proc_5 (void) /* without parameters */
403*4882a593Smuzhiyun /*******/
404*4882a593Smuzhiyun /* executed once */
405*4882a593Smuzhiyun {
406*4882a593Smuzhiyun Ch_1_Glob = 'A';
407*4882a593Smuzhiyun Bool_Glob = false;
408*4882a593Smuzhiyun } /* Proc_5 */
409*4882a593Smuzhiyun
410*4882a593Smuzhiyun
411*4882a593Smuzhiyun /* Procedure for the assignment of structures, */
412*4882a593Smuzhiyun /* if the C compiler doesn't support this feature */
413*4882a593Smuzhiyun #ifdef NOSTRUCTASSIGN
memcpy(d,s,l)414*4882a593Smuzhiyun memcpy (d, s, l)
415*4882a593Smuzhiyun register char *d;
416*4882a593Smuzhiyun register char *s;
417*4882a593Smuzhiyun register int l;
418*4882a593Smuzhiyun {
419*4882a593Smuzhiyun while (l--) *d++ = *s++;
420*4882a593Smuzhiyun }
421*4882a593Smuzhiyun #endif
422