7b6cff8b5dc95bcd213d6167ea56307ce2fc05f6
[fw/sdcc] / support / tests / dhrystone / dhry.c
1 /** Sanatised version of the dhrystone-2.1 test.
2
3     Modifications Michael Hope <michaelh@earthling.net>
4
5     This is derrived from the dhrystone-2.1.tar.gz tarball available
6     all over the net.  I sourced it from the Red Hat src rpm.
7
8     Modifications:
9     * Made it more ANSI compliant.
10     * Changed any array function arguments to pointers to make my 
11       compiler work.
12     * Removed malloc's for a couple of static arrays.
13     * Into one file.
14     * Proc_8 is a bit messy.  It originally took a 2 dim array, but
15       sdcc doesnt support this.  So the offsets are hard coded...
16
17     Notes:
18     * The comment at the start of Func_1 about the input being
19       H, R on the first call is wrong - Func_1 is first called
20       from Func_2 where the input is R, Y.  The test still succeeds.
21
22     References:
23     * http://www.netlib.org/performance/html/dhry.intro.html
24     * http://www.netlib.org/performance/html/dhry.data.col0.html
25
26     I couldnt find a copyright in the original - the most relevent
27     part follows:
28
29     A SPECIAL THANKS
30     I didn't write the DHRYSTONE benchmark.  Rheinhold Weicker did. He has
31     certainly provided us with a useful tool for benchmarking, and is
32     to be congratulated.
33
34     Rick Richardson
35     PC Research, Inc.
36     (201) 389-8963 (9-17 EST)
37     (201) 542-3734 (7-9,17-24 EST)
38     ...!uunet!pcrat!rick        (normal mail)
39     ...!uunet!pcrat!dry2        (results only)
40 */
41
42 #define NOENUM          1
43 #define NOSTRUCTASSIGN  1
44 #define REG
45
46 #include "dhry.h"
47 #include <string.h>
48 /** For printf */
49 #include <stdio.h>
50
51 #if defined(SDCC_ds390)
52 #include <tinibios.h>
53 #define clock() ClockTicks()
54 #define CLOCKS_PER_SEC 1000
55 #define memcpy(d,s,l) memcpyx(d,s,l)
56
57 # if defined(SDCC_ds400)
58 # include <ds400rom.h>
59 # endif
60
61 #elif defined(__z80) || defined(__gbz80)
62 unsigned int _clock(void);
63
64 #define clock _clock
65 #define CLOCKS_PER_SEC  100
66
67 #else
68 /** For clock() */
69 #include <time.h>
70 #include <types.h>
71 #endif
72
73 /** Set to one to print more messages about expected values etc. 
74  */
75 #define DEBUG   0
76
77 #if DEBUG
78 #define DPRINTF(_a) printf _a
79 #else
80 #define DPRINTF(_a)
81 #endif
82
83 Rec_Pointer     Ptr_Glob,
84                 Next_Ptr_Glob;
85 int             Int_Glob;
86 Boolean         Bool_Glob;
87 char            Ch_1_Glob,
88                 Ch_2_Glob;
89 int             Arr_1_Glob [50];
90 int             Arr_2_Glob [50] [50];
91
92 /* Used instead of malloc() */
93 static Rec_Type _r[2];
94
95 void mark(void)
96 {
97 }
98
99 void Proc_1 (REG Rec_Pointer Ptr_Val_Par);
100 void Proc_2 (One_Fifty *Int_Par_Ref);
101 void Proc_5 (void);
102 void Proc_4 (void);
103 void Proc_7 (One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val, One_Fifty *Int_Par_Ref);
104 void Proc_8 (int *Arr_1_Par_Ref, int *Arr_2_Par_Ref,
105              int Int_1_Par_Val, int Int_2_Par_Val);
106 void Proc_6 (Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par);
107 void Proc_3 (Rec_Pointer *Ptr_Ref_Par);
108 Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val);
109 Boolean Func_2 (char *Str_1_Par_Ref, char *Str_2_Par_Ref);
110 Boolean Func_3 (Enumeration Enum_Par_Val);
111
112 unsigned getsp(void);
113
114 void main(void)
115 {
116     One_Fifty       Int_1_Loc;
117     REG   One_Fifty       Int_2_Loc;
118     One_Fifty       Int_3_Loc;
119     REG   Capital_Letter Ch_Index;
120     Enumeration     Enum_Loc;
121     Str_30          Str_1_Loc;
122     Str_30          Str_2_Loc;
123     REG   int             Run_Index;
124     REG   int             Number_Of_Runs;
125     unsigned  long runTime;
126
127 #if defined(SDCC_ds400)
128     // Intialize the ROM.
129     if (romInit(1))
130     {
131         // We're hosed. romInit will have printed an error, nothing more to do.
132         return;
133     }
134
135     ClockInit();
136     
137     P5 &= ~4; // LED on.
138 #endif    
139     
140     printf("[dhry]\n");
141
142     Next_Ptr_Glob = &_r[0];
143     Ptr_Glob = &_r[1];
144
145     Ptr_Glob->Ptr_Comp                    = Next_Ptr_Glob;
146     Ptr_Glob->Discr                       = Ident_1;
147     Ptr_Glob->variant.var_1.Enum_Comp     = Ident_3;
148     Ptr_Glob->variant.var_1.Int_Comp      = 40;
149
150     strcpy(Ptr_Glob->variant.var_1.Str_Comp, 
151             "DHRYSTONE PROGRAM, SOME STRING");
152     strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");
153
154     Arr_2_Glob [8][7] = 10;
155
156     /* Was missing in published program. Without this statement,    */
157     /* Arr_2_Glob [8][7] would have an undefined value.             */
158     /* Warning: With 16-Bit processors and Number_Of_Runs > 32000,  */
159     /* overflow may occur for this array element.                   */
160
161     /* 32766 is the highest value for a 16 bitter */
162 #if DEBUG
163     Number_Of_Runs = 1;
164 #else
165     // Number_Of_Runs = 32766;
166     Number_Of_Runs = 2048;
167 #endif    
168
169     runTime = clock();
170
171     /* Main test loop */
172     for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index) {
173         DPRINTF(("Run_Index = %d\n", Run_Index));
174         if (!(Run_Index & 1023))
175             printf("Loops: %u\r\n", Run_Index);
176         Proc_5();
177         Proc_4();
178         /* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */
179         DPRINTF(("Ch_1_Glob '%c' == 'A', Ch_2_Glob '%c' == 'B', Bool_Glob %d == 1\n", Ch_1_Glob, Ch_2_Glob, Bool_Glob));
180
181         Int_1_Loc = 2;
182         Int_2_Loc = 3;
183         strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
184         Enum_Loc = Ident_2;
185         Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
186         /* Bool_Glob == 1 */
187         DPRINTF(("Bool_Glob %d == 1, Int_1_Loc %d == 2, Int_2_Loc %d == 3\n", Bool_Glob, Int_1_Loc, Int_2_Loc));
188         while (Int_1_Loc < Int_2_Loc)  /* loop body executed once */
189             {
190                 DPRINTF(("m.1 Executes once.\n"));
191                 Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
192                 /* Int_3_Loc == 7 */
193                 DPRINTF(("Int_3_Loc %d == 7\n", Int_3_Loc));
194                 DPRINTF(("Proc_7\n"));
195                 Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
196                 /* Int_3_Loc == 7 */
197                 Int_1_Loc += 1;
198             } /* while */
199         DPRINTF(("m.2 Check above executed once.\n"));
200         /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
201         DPRINTF(("Int_1_Loc %d == 3, Int_2_Loc %d == 3, Int_3_Loc %d == 7\n",
202                Int_1_Loc, Int_2_Loc, Int_3_Loc));
203
204         DPRINTF(("Proc_8\n"));
205         Proc_8 (Arr_1_Glob, (int *)Arr_2_Glob, Int_1_Loc, Int_3_Loc);
206         /* Int_Glob == 5 */
207         DPRINTF(("Int_Glob %d == 5\n", Int_Glob));
208         DPRINTF(("Proc_1\n"));
209         Proc_1 (Ptr_Glob);
210         for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
211             /* loop body executed twice */
212             {
213                 DPRINTF(("Func_1\n"));
214                 if (Enum_Loc == Func_1 (Ch_Index, 'C'))
215                     /* then, not executed */
216                     {
217                         DPRINTF(("Proc_6\n"));
218                         Proc_6 (Ident_1, &Enum_Loc);
219                         strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
220                         Int_2_Loc = Run_Index;
221                         Int_Glob = Run_Index;
222                     }
223             }
224         /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
225         DPRINTF(("Int_1_Loc %d == 3, Int_2_Loc %d == 3, Int_3_Loc %d == 7\n",
226                Int_1_Loc, Int_2_Loc, Int_3_Loc));
227
228         Int_2_Loc = Int_2_Loc * Int_1_Loc; /* i2 = 3 * 3 = 9 */
229         Int_1_Loc = Int_2_Loc / Int_3_Loc; /* i1 = 9 / 7 = 1 */
230         Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc; /* i2 = 7 * (9 - 7) - 1 */
231         /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */
232         DPRINTF(("Int_1_Loc %d == 1, Int_2_Loc %d == 13, Int_3_Loc %d == 7\n",
233                Int_1_Loc, Int_2_Loc, Int_3_Loc));
234         DPRINTF(("Proc_2\n"));
235         Proc_2 (&Int_1_Loc);
236         /* Int_1_Loc == 5 */
237         DPRINTF(("Int_1_Loc %d == 5\n", Int_1_Loc));
238         DPRINTF(("Looping.\n"));
239     } /* loop "for Run_Index" */
240
241     printf("Run_Index = %d\n", Run_Index);
242
243     runTime = clock() - runTime;
244
245 #if 1
246     printf ("Execution ends\n");
247     printf ("\n");
248     printf ("Final values of the variables used in the benchmark:\n");
249     printf ("\n");
250     printf ("Int_Glob:            %d\n", Int_Glob);
251     printf ("        should be:   %d\n", (int)5);
252     printf ("Bool_Glob:           %d\n", Bool_Glob);
253     printf ("        should be:   %d\n", (int)1);
254     printf ("Ch_1_Glob:           %c\n", Ch_1_Glob);
255     printf ("        should be:   %c\n", 'A');
256     printf ("Ch_2_Glob:           %c\n", Ch_2_Glob);
257     printf ("        should be:   %c\n", 'B');
258     printf ("Arr_1_Glob[8]:       %d\n", Arr_1_Glob[8]);
259     printf ("        should be:   %d\n", (int)7);
260 #if 1
261     printf ("Arr_2_Glob[8][7]:    %d\n", Arr_2_Glob[8][7]);
262 #endif
263     printf ("        should be:   Number_Of_Runs + 10\n");
264     printf ("Ptr_Glob->\n");
265     printf ("  Ptr_Comp:          %d\n", (int) Ptr_Glob->Ptr_Comp);
266     printf ("        should be:   (implementation-dependent)\n");
267     printf ("  Discr:             %d\n", (int)Ptr_Glob->Discr);
268     printf ("        should be:   %d\n", (int)0);
269     printf ("  Enum_Comp:         %d\n", (int)Ptr_Glob->variant.var_1.Enum_Comp);
270     printf ("        should be:   %d\n", (int)2);
271     printf ("  Int_Comp:          %d\n", (int)Ptr_Glob->variant.var_1.Int_Comp);
272     printf ("        should be:   %d\n", (int)17);
273     printf ("  Str_Comp:          %s\n", (char *)Ptr_Glob->variant.var_1.Str_Comp);
274     printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
275     printf ("Next_Ptr_Glob->\n");
276     printf ("  Ptr_Comp:          %d\n", (int) Next_Ptr_Glob->Ptr_Comp);
277     printf ("        should be:   (implementation-dependent), same as above\n");
278     printf ("  Discr:             %d\n", Next_Ptr_Glob->Discr);
279     printf ("        should be:   %d\n", (int)0);
280     printf ("  Enum_Comp:         %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp);
281     printf ("        should be:   %d\n", (int)1);
282     printf ("  Int_Comp:          %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp);
283     printf ("        should be:   %d\n", (int)18);
284     printf ("  Str_Comp:          %s\n",
285             Next_Ptr_Glob->variant.var_1.Str_Comp);
286     printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
287     printf ("Int_1_Loc:           %d\n", Int_1_Loc);
288     printf ("        should be:   %d\n", (int)5);
289     printf ("Int_2_Loc:           %d\n", Int_2_Loc);
290     printf ("        should be:   %d\n", (int)13);
291     printf ("Int_3_Loc:           %d\n", Int_3_Loc);
292     printf ("        should be:   %d\n", (int)7);
293     printf ("Enum_Loc:            %d\n", Enum_Loc);
294     printf ("        should be:   %d\n", (int)1);
295     printf ("Str_1_Loc:           %s\n", (char *)Str_1_Loc);
296     printf ("        should be:   DHRYSTONE PROGRAM, 1'ST STRING\n");
297     printf ("Str_2_Loc:           %s\n", (char *)Str_2_Loc);
298     printf ("        should be:   DHRYSTONE PROGRAM, 2'ND STRING\n");
299     printf ("\n");
300 #endif
301 #if 1
302     printf("Number of runs: %u.  runTime: %u.\n", Number_Of_Runs, (unsigned)runTime);
303     mark();
304     printf("Dhrystones/s = %u\n", (unsigned)((unsigned long)Number_Of_Runs / (runTime/CLOCKS_PER_SEC)));
305     printf("MIPS = d/s/1757 = (sigh, need floats...)\n");
306 #endif
307 #ifdef PRINT_T_STATES    
308     _printTStates();
309 #endif    
310 #if 1
311     printf("Time: %lu ticks\n", runTime);
312 #endif
313 }
314
315 void Proc_1 (REG Rec_Pointer Ptr_Val_Par)
316 /* executed once */
317 {
318     REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;  
319     /* == Ptr_Glob_Next */
320     /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp,    */
321     /* corresponds to "rename" in Ada, "with" in Pascal           */
322   
323 #if !defined(SDCC_ds390)    
324     structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob);
325 #else
326     /* I have no idea why this is necessary... */
327     memcpyx((void xdata *)*Ptr_Val_Par->Ptr_Comp, (void xdata *)*Ptr_Glob, 
328            sizeof(Rec_Type));
329 #endif
330     Ptr_Val_Par->variant.var_1.Int_Comp = 5;
331     Next_Record->variant.var_1.Int_Comp 
332         = Ptr_Val_Par->variant.var_1.Int_Comp;
333     Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
334     Proc_3 (&Next_Record->Ptr_Comp);
335     /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp 
336        == Ptr_Glob->Ptr_Comp */
337     if (Next_Record->Discr == Ident_1)
338         /* then, executed */
339         {
340             Next_Record->variant.var_1.Int_Comp = 6;
341             Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp, 
342                     &Next_Record->variant.var_1.Enum_Comp);
343             Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
344             Proc_7 (Next_Record->variant.var_1.Int_Comp, 10, 
345                     &Next_Record->variant.var_1.Int_Comp);
346         }
347     else /* not executed */
348         structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp);
349 } /* Proc_1 */
350
351
352 void Proc_2 (One_Fifty *Int_Par_Ref)
353     /******************/
354     /* executed once */
355     /* *Int_Par_Ref == 1, becomes 4 */
356 {
357     One_Fifty  Int_Loc;  
358     Enumeration   Enum_Loc;
359
360     DPRINTF(("-> Proc_2\n"));
361
362     Int_Loc = *Int_Par_Ref + 10;
363     do {
364         DPRINTF(("1"));
365         /* executed once */
366         if (Ch_1_Glob == 'A')
367             /* then, executed */
368             {
369                 DPRINTF(("2"));
370                 Int_Loc -= 1;
371                 *Int_Par_Ref = Int_Loc - Int_Glob;
372                 Enum_Loc = Ident_1;
373             } /* if */
374         DPRINTF(("3"));
375     } while (Enum_Loc != Ident_1); /* true */
376     DPRINTF(("Proc_2 done.\n"));
377 } /* Proc_2 */
378
379
380 void Proc_3 (Rec_Pointer *Ptr_Ref_Par)
381     /******************/
382     /* executed once */
383     /* Ptr_Ref_Par becomes Ptr_Glob */
384 {
385     if (Ptr_Glob != Null)
386         /* then, executed */
387         *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
388     Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
389 } /* Proc_3 */
390
391 void Proc_4 (void) /* without parameters */
392     /*******/
393     /* executed once */
394 {
395     Boolean Bool_Loc;
396
397     DPRINTF(("-> Proc_4\n"));
398     Bool_Loc = Ch_1_Glob == 'A';
399     Bool_Glob = Bool_Loc | Bool_Glob;
400     Ch_2_Glob = 'B';
401     DPRINTF(("Expect Ch_1_Glob '%c' == 'A'\n", (char)Ch_1_Glob));
402     DPRINTF(("       Ch_2_Glob '%c' == 'B'\n", (char)Ch_2_Glob));
403     DPRINTF(("       Bool_Loc %d == 1\n", (unsigned)Bool_Loc));
404     DPRINTF(("       Bool_Glob %d == 1\n", (unsigned)Bool_Glob));
405 } /* Proc_4 */
406
407
408 void Proc_5 () /* without parameters */
409     /*******/
410     /* executed once */
411 {
412     Ch_1_Glob = 'A';
413     Bool_Glob = false;
414 } /* Proc_5 */
415
416 void Proc_6 (Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par)
417     /*********************************/
418     /* executed once */
419     /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
420
421 {
422     *Enum_Ref_Par = Enum_Val_Par;
423     if (! Func_3 (Enum_Val_Par))
424         /* then, not executed */
425         *Enum_Ref_Par = Ident_4;
426     switch (Enum_Val_Par)
427         {
428         case Ident_1: 
429             *Enum_Ref_Par = Ident_1;
430             break;
431         case Ident_2: 
432             if (Int_Glob > 100)
433                 /* then */
434                 *Enum_Ref_Par = Ident_1;
435             else *Enum_Ref_Par = Ident_4;
436             break;
437         case Ident_3: /* executed */
438             *Enum_Ref_Par = Ident_2;
439             break;
440         case Ident_4: break;
441         case Ident_5: 
442             *Enum_Ref_Par = Ident_3;
443             break;
444         } /* switch */
445 } /* Proc_6 */
446
447
448 /*************************************************/
449 /* executed three times                                         */
450 /* first call:      Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R'    */
451 /* second call:     Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C'    */
452 /* third call:      Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C'    */
453 Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val)
454 {
455     Capital_Letter        Ch_1_Loc;
456     Capital_Letter        Ch_2_Loc;
457
458     DPRINTF(("-> Func_1\n"));
459     DPRINTF(("  Inputs: Ch_1_Par_Val '%c' == { R, A, B }\n", (char)Ch_1_Par_Val));
460     DPRINTF(("          Ch_2_Par_Val '%c' == { Y, C, C }\n", (char)Ch_2_Par_Val));
461
462     Ch_1_Loc = Ch_1_Par_Val;
463     Ch_2_Loc = Ch_1_Loc;
464     if (Ch_2_Loc != Ch_2_Par_Val) {
465         /* then, executed */
466         return (Ident_1);
467     }
468     else  /* not executed */
469         {
470             Ch_1_Glob = Ch_1_Loc;
471             return (Ident_2);
472         }
473 } /* Func_1 */
474
475 Boolean Func_3 (Enumeration Enum_Par_Val)
476     /***************************/
477     /* executed once        */
478     /* Enum_Par_Val == Ident_3 */
479 {
480     Enumeration Enum_Loc;
481
482     Enum_Loc = Enum_Par_Val;
483     if (Enum_Loc == Ident_3)
484         /* then, executed */
485         return (true);
486     else /* not executed */
487         return (false);
488 } /* Func_3 */
489
490 void Proc_7 (One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val, One_Fifty *Int_Par_Ref)
491     /**********************************************/
492     /* executed three times                                      */ 
493     /* first call:      Int_1_Par_Val == 2, Int_2_Par_Val == 3,  */
494     /*                  Int_Par_Ref becomes 7                    */
495     /* second call:     Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
496     /*                  Int_Par_Ref becomes 17                   */
497     /* third call:      Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
498     /*                  Int_Par_Ref becomes 18                   */
499 {
500     One_Fifty Int_Loc;
501
502     Int_Loc = Int_1_Par_Val + 2;
503     *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
504 } /* Proc_7 */
505
506 /*void Proc_8 (Arr_1_Dim Arr_1_Par_Ref, Arr_2_Dim Arr_2_Par_Ref, 
507   int Int_1_Par_Val, int Int_2_Par_Val)*/
508 void Proc_8 (int *Arr_1_Par_Ref, int *Arr_2_Par_Ref,
509              int Int_1_Par_Val, int Int_2_Par_Val)
510 {
511     REG One_Fifty Int_Index;
512     REG One_Fifty Int_Loc;
513
514     DPRINTF(("-> Proc_8\n"));
515     Int_Loc = Int_1_Par_Val + 5;
516     Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
517     DPRINTF(("Int_Loc %d == 8 Int_2_Par_Val %d == 7\n", Int_Loc, Int_2_Par_Val));
518
519     Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
520     Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
521     for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
522         Arr_2_Par_Ref [Int_Loc*50 + Int_Index] = Int_Loc;
523     Arr_2_Par_Ref [Int_Loc * 50 + Int_Loc-1] += 1;
524     Arr_2_Par_Ref [(Int_Loc+20 *50) + Int_Loc] = Arr_1_Par_Ref [Int_Loc];
525     Int_Glob = 5;
526     DPRINTF(("Arr_1_Glob[8] %d == 7\n", Arr_1_Par_Ref[8]));
527 }
528
529 /*********************************************************************/
530 /* executed once      */
531 /* Int_Par_Val_1 == 3 */
532 /* Int_Par_Val_2 == 7 */
533 Boolean Func_2 (char *Str_1_Par_Ref, char *Str_2_Par_Ref)
534     /*************************************************/
535     /* executed once */
536     /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
537     /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
538 {
539     REG One_Thirty        Int_Loc;
540     Capital_Letter    Ch_Loc;
541
542     DPRINTF(("-> Func_2\n"));
543     DPRINTF(("  Inputs Str_1_Par_Ref \"%s\" = \"DHRYSTONE PROGRAM, 1'ST STRING\"\n", Str_1_Par_Ref));
544     DPRINTF(("         Str_2_Par_Ref \"%s\" = \"DHRYSTONE PROGRAM, 2'ND STRING\"\n", Str_2_Par_Ref));
545
546     Int_Loc = 2;
547
548     while (Int_Loc <= 2) {
549         if (Func_1 (Str_1_Par_Ref[Int_Loc],
550                     Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
551             /* then, executed */
552             {
553                 DPRINTF(("  2.3 Then OK.\n"));
554                 Ch_Loc = 'A';
555                 Int_Loc += 1;
556             } /* if, while */
557         else {
558             DPRINTF(("  2.2 Error.\n"));
559         }
560     }
561     if (Ch_Loc >= 'W' && Ch_Loc < 'Z') {
562         /* then, not executed */
563         DPRINTF((" 2.4 Error\n"));
564         Int_Loc = 7;
565     }
566     if (Ch_Loc == 'R') {
567         /* then, not executed */
568         DPRINTF((" 2.5 Error\n"));
569         return (true);
570     }
571     else /* executed */
572         {
573             DPRINTF(("Str_1_Par_Ref = \"%s\", Str_2_Par_Ref = \"%s\"\n",
574                    Str_1_Par_Ref, Str_2_Par_Ref));
575             if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
576                 /* then, not executed */
577                 {
578                     DPRINTF((" 2.5 Error diff=%d\n", strcmp(Str_1_Par_Ref, Str_2_Par_Ref)));
579                     Int_Loc += 7;
580                     Int_Glob = Int_Loc;
581                     return (true);
582                 }
583             else {
584                 /* executed */
585                 DPRINTF((" 2.6 OK\n"));
586                 return (false);
587             }
588         } /* if Ch_Loc */
589 } /* Func_2 */
590