Imported Upstream version 2.9.0
[debian/cc1111] / 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, SPEED_2X))
130     {
131         // We're hosed. romInit will have printed an error, nothing more to do.
132         return;
133     }
134 #endif    
135     
136     printf("[dhry]\n");
137
138     Next_Ptr_Glob = &_r[0];
139     Ptr_Glob = &_r[1];
140
141     Ptr_Glob->Ptr_Comp                    = Next_Ptr_Glob;
142     Ptr_Glob->Discr                       = Ident_1;
143     Ptr_Glob->variant.var_1.Enum_Comp     = Ident_3;
144     Ptr_Glob->variant.var_1.Int_Comp      = 40;
145
146     strcpy(Ptr_Glob->variant.var_1.Str_Comp, 
147             "DHRYSTONE PROGRAM, SOME STRING");
148     strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");
149
150     Arr_2_Glob [8][7] = 10;
151
152     /* Was missing in published program. Without this statement,    */
153     /* Arr_2_Glob [8][7] would have an undefined value.             */
154     /* Warning: With 16-Bit processors and Number_Of_Runs > 32000,  */
155     /* overflow may occur for this array element.                   */
156
157     /* 32766 is the highest value for a 16 bitter */
158 #if DEBUG
159     Number_Of_Runs = 1;
160 #else
161 #if defined(SDCC_ds400)    
162     Number_Of_Runs = 10240;
163 #else    
164     Number_Of_Runs = 32766;
165 #endif    
166 #endif    
167
168     runTime = clock();
169
170     /* Main test loop */
171     for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index) {
172         DPRINTF(("Run_Index = %d\n", Run_Index));
173         if (!(Run_Index & 1023))
174             printf("Loops: %u\r\n", Run_Index);
175         Proc_5();
176         Proc_4();
177         /* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */
178         DPRINTF(("Ch_1_Glob '%c' == 'A', Ch_2_Glob '%c' == 'B', Bool_Glob %d == 1\n", Ch_1_Glob, Ch_2_Glob, Bool_Glob));
179
180         Int_1_Loc = 2;
181         Int_2_Loc = 3;
182         strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
183         Enum_Loc = Ident_2;
184         Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
185         /* Bool_Glob == 1 */
186         DPRINTF(("Bool_Glob %d == 1, Int_1_Loc %d == 2, Int_2_Loc %d == 3\n", Bool_Glob, Int_1_Loc, Int_2_Loc));
187         while (Int_1_Loc < Int_2_Loc)  /* loop body executed once */
188             {
189                 DPRINTF(("m.1 Executes once.\n"));
190                 Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
191                 /* Int_3_Loc == 7 */
192                 DPRINTF(("Int_3_Loc %d == 7\n", Int_3_Loc));
193                 DPRINTF(("Proc_7\n"));
194                 Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
195                 /* Int_3_Loc == 7 */
196                 Int_1_Loc += 1;
197             } /* while */
198         DPRINTF(("m.2 Check above executed once.\n"));
199         /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
200         DPRINTF(("Int_1_Loc %d == 3, Int_2_Loc %d == 3, Int_3_Loc %d == 7\n",
201                Int_1_Loc, Int_2_Loc, Int_3_Loc));
202
203         DPRINTF(("Proc_8\n"));
204         Proc_8 (Arr_1_Glob, (int *)Arr_2_Glob, Int_1_Loc, Int_3_Loc);
205         /* Int_Glob == 5 */
206         DPRINTF(("Int_Glob %d == 5\n", Int_Glob));
207         DPRINTF(("Proc_1\n"));
208         Proc_1 (Ptr_Glob);
209         for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
210             /* loop body executed twice */
211             {
212                 DPRINTF(("Func_1\n"));
213                 if (Enum_Loc == Func_1 (Ch_Index, 'C'))
214                     /* then, not executed */
215                     {
216                         DPRINTF(("Proc_6\n"));
217                         Proc_6 (Ident_1, &Enum_Loc);
218                         strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
219                         Int_2_Loc = Run_Index;
220                         Int_Glob = Run_Index;
221                     }
222             }
223         /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
224         DPRINTF(("Int_1_Loc %d == 3, Int_2_Loc %d == 3, Int_3_Loc %d == 7\n",
225                Int_1_Loc, Int_2_Loc, Int_3_Loc));
226
227         Int_2_Loc = Int_2_Loc * Int_1_Loc; /* i2 = 3 * 3 = 9 */
228         Int_1_Loc = Int_2_Loc / Int_3_Loc; /* i1 = 9 / 7 = 1 */
229         Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc; /* i2 = 7 * (9 - 7) - 1 */
230         /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */
231         DPRINTF(("Int_1_Loc %d == 1, Int_2_Loc %d == 13, Int_3_Loc %d == 7\n",
232                Int_1_Loc, Int_2_Loc, Int_3_Loc));
233         DPRINTF(("Proc_2\n"));
234         Proc_2 (&Int_1_Loc);
235         /* Int_1_Loc == 5 */
236         DPRINTF(("Int_1_Loc %d == 5\n", Int_1_Loc));
237         DPRINTF(("Looping.\n"));
238     } /* loop "for Run_Index" */
239
240     printf("Run_Index = %d\n", Run_Index);
241
242     runTime = clock() - runTime;
243
244 #if 1
245     printf ("Execution ends\n");
246     printf ("\n");
247     printf ("Final values of the variables used in the benchmark:\n");
248     printf ("\n");
249     printf ("Int_Glob:            %d\n", Int_Glob);
250     printf ("        should be:   %d\n", (int)5);
251     printf ("Bool_Glob:           %d\n", Bool_Glob);
252     printf ("        should be:   %d\n", (int)1);
253     printf ("Ch_1_Glob:           %c\n", Ch_1_Glob);
254     printf ("        should be:   %c\n", 'A');
255     printf ("Ch_2_Glob:           %c\n", Ch_2_Glob);
256     printf ("        should be:   %c\n", 'B');
257     printf ("Arr_1_Glob[8]:       %d\n", Arr_1_Glob[8]);
258     printf ("        should be:   %d\n", (int)7);
259 #if 1
260     printf ("Arr_2_Glob[8][7]:    %d\n", Arr_2_Glob[8][7]);
261 #endif
262     printf ("        should be:   Number_Of_Runs + 10\n");
263     printf ("Ptr_Glob->\n");
264     printf ("  Ptr_Comp:          %d\n", (int) Ptr_Glob->Ptr_Comp);
265     printf ("        should be:   (implementation-dependent)\n");
266     printf ("  Discr:             %d\n", (int)Ptr_Glob->Discr);
267     printf ("        should be:   %d\n", (int)0);
268     printf ("  Enum_Comp:         %d\n", (int)Ptr_Glob->variant.var_1.Enum_Comp);
269     printf ("        should be:   %d\n", (int)2);
270     printf ("  Int_Comp:          %d\n", (int)Ptr_Glob->variant.var_1.Int_Comp);
271     printf ("        should be:   %d\n", (int)17);
272     printf ("  Str_Comp:          %s\n", (char *)Ptr_Glob->variant.var_1.Str_Comp);
273     printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
274     printf ("Next_Ptr_Glob->\n");
275     printf ("  Ptr_Comp:          %d\n", (int) Next_Ptr_Glob->Ptr_Comp);
276     printf ("        should be:   (implementation-dependent), same as above\n");
277     printf ("  Discr:             %d\n", Next_Ptr_Glob->Discr);
278     printf ("        should be:   %d\n", (int)0);
279     printf ("  Enum_Comp:         %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp);
280     printf ("        should be:   %d\n", (int)1);
281     printf ("  Int_Comp:          %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp);
282     printf ("        should be:   %d\n", (int)18);
283     printf ("  Str_Comp:          %s\n",
284             Next_Ptr_Glob->variant.var_1.Str_Comp);
285     printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
286     printf ("Int_1_Loc:           %d\n", Int_1_Loc);
287     printf ("        should be:   %d\n", (int)5);
288     printf ("Int_2_Loc:           %d\n", Int_2_Loc);
289     printf ("        should be:   %d\n", (int)13);
290     printf ("Int_3_Loc:           %d\n", Int_3_Loc);
291     printf ("        should be:   %d\n", (int)7);
292     printf ("Enum_Loc:            %d\n", Enum_Loc);
293     printf ("        should be:   %d\n", (int)1);
294     printf ("Str_1_Loc:           %s\n", (char *)Str_1_Loc);
295     printf ("        should be:   DHRYSTONE PROGRAM, 1'ST STRING\n");
296     printf ("Str_2_Loc:           %s\n", (char *)Str_2_Loc);
297     printf ("        should be:   DHRYSTONE PROGRAM, 2'ND STRING\n");
298     printf ("\n");
299 #endif
300 #if 1
301     printf("Number of runs: %u.  runTime: %u.\n", Number_Of_Runs, (unsigned)runTime);
302     mark();
303     printf("Dhrystones/s = %u\n", (unsigned)((unsigned long)Number_Of_Runs / (runTime/CLOCKS_PER_SEC)));
304     printf("MIPS = d/s/1757 = (sigh, need floats...)\n");
305 #endif
306 #ifdef PRINT_T_STATES    
307     _printTStates();
308 #endif    
309 #if 1
310     printf("Time: %lu ticks\n", runTime);
311 #endif
312 }
313
314 void Proc_1 (REG Rec_Pointer Ptr_Val_Par)
315 /* executed once */
316 {
317     REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;  
318     /* == Ptr_Glob_Next */
319     /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp,    */
320     /* corresponds to "rename" in Ada, "with" in Pascal           */
321   
322 #if !defined(SDCC_ds390)    
323     structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob);
324 #else
325     /* I have no idea why this is necessary... */
326     memcpyx((void xdata *)*Ptr_Val_Par->Ptr_Comp, (void xdata *)*Ptr_Glob, 
327            sizeof(Rec_Type));
328 #endif
329     Ptr_Val_Par->variant.var_1.Int_Comp = 5;
330     Next_Record->variant.var_1.Int_Comp 
331         = Ptr_Val_Par->variant.var_1.Int_Comp;
332     Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
333     Proc_3 (&Next_Record->Ptr_Comp);
334     /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp 
335        == Ptr_Glob->Ptr_Comp */
336     if (Next_Record->Discr == Ident_1)
337         /* then, executed */
338         {
339             Next_Record->variant.var_1.Int_Comp = 6;
340             Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp, 
341                     &Next_Record->variant.var_1.Enum_Comp);
342             Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
343             Proc_7 (Next_Record->variant.var_1.Int_Comp, 10, 
344                     &Next_Record->variant.var_1.Int_Comp);
345         }
346     else /* not executed */
347         structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp);
348 } /* Proc_1 */
349
350
351 void Proc_2 (One_Fifty *Int_Par_Ref)
352     /******************/
353     /* executed once */
354     /* *Int_Par_Ref == 1, becomes 4 */
355 {
356     One_Fifty  Int_Loc;  
357     Enumeration   Enum_Loc;
358
359     DPRINTF(("-> Proc_2\n"));
360
361     Int_Loc = *Int_Par_Ref + 10;
362     do {
363         DPRINTF(("1"));
364         /* executed once */
365         if (Ch_1_Glob == 'A')
366             /* then, executed */
367             {
368                 DPRINTF(("2"));
369                 Int_Loc -= 1;
370                 *Int_Par_Ref = Int_Loc - Int_Glob;
371                 Enum_Loc = Ident_1;
372             } /* if */
373         DPRINTF(("3"));
374     } while (Enum_Loc != Ident_1); /* true */
375     DPRINTF(("Proc_2 done.\n"));
376 } /* Proc_2 */
377
378
379 void Proc_3 (Rec_Pointer *Ptr_Ref_Par)
380     /******************/
381     /* executed once */
382     /* Ptr_Ref_Par becomes Ptr_Glob */
383 {
384     if (Ptr_Glob != Null)
385         /* then, executed */
386         *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
387     Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
388 } /* Proc_3 */
389
390 void Proc_4 (void) /* without parameters */
391     /*******/
392     /* executed once */
393 {
394     Boolean Bool_Loc;
395
396     DPRINTF(("-> Proc_4\n"));
397     Bool_Loc = Ch_1_Glob == 'A';
398     Bool_Glob = Bool_Loc | Bool_Glob;
399     Ch_2_Glob = 'B';
400     DPRINTF(("Expect Ch_1_Glob '%c' == 'A'\n", (char)Ch_1_Glob));
401     DPRINTF(("       Ch_2_Glob '%c' == 'B'\n", (char)Ch_2_Glob));
402     DPRINTF(("       Bool_Loc %d == 1\n", (unsigned)Bool_Loc));
403     DPRINTF(("       Bool_Glob %d == 1\n", (unsigned)Bool_Glob));
404 } /* Proc_4 */
405
406
407 void Proc_5 () /* without parameters */
408     /*******/
409     /* executed once */
410 {
411     Ch_1_Glob = 'A';
412     Bool_Glob = false;
413 } /* Proc_5 */
414
415 void Proc_6 (Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par)
416     /*********************************/
417     /* executed once */
418     /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
419
420 {
421     *Enum_Ref_Par = Enum_Val_Par;
422     if (! Func_3 (Enum_Val_Par))
423         /* then, not executed */
424         *Enum_Ref_Par = Ident_4;
425     switch (Enum_Val_Par)
426         {
427         case Ident_1: 
428             *Enum_Ref_Par = Ident_1;
429             break;
430         case Ident_2: 
431             if (Int_Glob > 100)
432                 /* then */
433                 *Enum_Ref_Par = Ident_1;
434             else *Enum_Ref_Par = Ident_4;
435             break;
436         case Ident_3: /* executed */
437             *Enum_Ref_Par = Ident_2;
438             break;
439         case Ident_4: break;
440         case Ident_5: 
441             *Enum_Ref_Par = Ident_3;
442             break;
443         } /* switch */
444 } /* Proc_6 */
445
446
447 /*************************************************/
448 /* executed three times                                         */
449 /* first call:      Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R'    */
450 /* second call:     Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C'    */
451 /* third call:      Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C'    */
452 Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val)
453 {
454     Capital_Letter        Ch_1_Loc;
455     Capital_Letter        Ch_2_Loc;
456
457     DPRINTF(("-> Func_1\n"));
458     DPRINTF(("  Inputs: Ch_1_Par_Val '%c' == { R, A, B }\n", (char)Ch_1_Par_Val));
459     DPRINTF(("          Ch_2_Par_Val '%c' == { Y, C, C }\n", (char)Ch_2_Par_Val));
460
461     Ch_1_Loc = Ch_1_Par_Val;
462     Ch_2_Loc = Ch_1_Loc;
463     if (Ch_2_Loc != Ch_2_Par_Val) {
464         /* then, executed */
465         return (Ident_1);
466     }
467     else  /* not executed */
468         {
469             Ch_1_Glob = Ch_1_Loc;
470             return (Ident_2);
471         }
472 } /* Func_1 */
473
474 Boolean Func_3 (Enumeration Enum_Par_Val)
475     /***************************/
476     /* executed once        */
477     /* Enum_Par_Val == Ident_3 */
478 {
479     Enumeration Enum_Loc;
480
481     Enum_Loc = Enum_Par_Val;
482     if (Enum_Loc == Ident_3)
483         /* then, executed */
484         return (true);
485     else /* not executed */
486         return (false);
487 } /* Func_3 */
488
489 void Proc_7 (One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val, One_Fifty *Int_Par_Ref)
490     /**********************************************/
491     /* executed three times                                      */ 
492     /* first call:      Int_1_Par_Val == 2, Int_2_Par_Val == 3,  */
493     /*                  Int_Par_Ref becomes 7                    */
494     /* second call:     Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
495     /*                  Int_Par_Ref becomes 17                   */
496     /* third call:      Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
497     /*                  Int_Par_Ref becomes 18                   */
498 {
499     One_Fifty Int_Loc;
500
501     Int_Loc = Int_1_Par_Val + 2;
502     *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
503 } /* Proc_7 */
504
505 /*void Proc_8 (Arr_1_Dim Arr_1_Par_Ref, Arr_2_Dim Arr_2_Par_Ref, 
506   int Int_1_Par_Val, int Int_2_Par_Val)*/
507 void Proc_8 (int *Arr_1_Par_Ref, int *Arr_2_Par_Ref,
508              int Int_1_Par_Val, int Int_2_Par_Val)
509 {
510     REG One_Fifty Int_Index;
511     REG One_Fifty Int_Loc;
512
513     DPRINTF(("-> Proc_8\n"));
514     Int_Loc = Int_1_Par_Val + 5;
515     Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
516     DPRINTF(("Int_Loc %d == 8 Int_2_Par_Val %d == 7\n", Int_Loc, Int_2_Par_Val));
517
518     Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
519     Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
520     for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
521         Arr_2_Par_Ref [Int_Loc*50 + Int_Index] = Int_Loc;
522     Arr_2_Par_Ref [Int_Loc * 50 + Int_Loc-1] += 1;
523     Arr_2_Par_Ref [(Int_Loc+20 *50) + Int_Loc] = Arr_1_Par_Ref [Int_Loc];
524     Int_Glob = 5;
525     DPRINTF(("Arr_1_Glob[8] %d == 7\n", Arr_1_Par_Ref[8]));
526 }
527
528 /*********************************************************************/
529 /* executed once      */
530 /* Int_Par_Val_1 == 3 */
531 /* Int_Par_Val_2 == 7 */
532 Boolean Func_2 (char *Str_1_Par_Ref, char *Str_2_Par_Ref)
533     /*************************************************/
534     /* executed once */
535     /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
536     /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
537 {
538     REG One_Thirty        Int_Loc;
539     Capital_Letter    Ch_Loc;
540
541     DPRINTF(("-> Func_2\n"));
542     DPRINTF(("  Inputs Str_1_Par_Ref \"%s\" = \"DHRYSTONE PROGRAM, 1'ST STRING\"\n", Str_1_Par_Ref));
543     DPRINTF(("         Str_2_Par_Ref \"%s\" = \"DHRYSTONE PROGRAM, 2'ND STRING\"\n", Str_2_Par_Ref));
544
545     Int_Loc = 2;
546
547     while (Int_Loc <= 2) {
548         if (Func_1 (Str_1_Par_Ref[Int_Loc],
549                     Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
550             /* then, executed */
551             {
552                 DPRINTF(("  2.3 Then OK.\n"));
553                 Ch_Loc = 'A';
554                 Int_Loc += 1;
555             } /* if, while */
556         else {
557             DPRINTF(("  2.2 Error.\n"));
558         }
559     }
560     if (Ch_Loc >= 'W' && Ch_Loc < 'Z') {
561         /* then, not executed */
562         DPRINTF((" 2.4 Error\n"));
563         Int_Loc = 7;
564     }
565     if (Ch_Loc == 'R') {
566         /* then, not executed */
567         DPRINTF((" 2.5 Error\n"));
568         return (true);
569     }
570     else /* executed */
571         {
572             DPRINTF(("Str_1_Par_Ref = \"%s\", Str_2_Par_Ref = \"%s\"\n",
573                    Str_1_Par_Ref, Str_2_Par_Ref));
574             if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
575                 /* then, not executed */
576                 {
577                     DPRINTF((" 2.5 Error diff=%d\n", strcmp(Str_1_Par_Ref, Str_2_Par_Ref)));
578                     Int_Loc += 7;
579                     Int_Glob = Int_Loc;
580                     return (true);
581                 }
582             else {
583                 /* executed */
584                 DPRINTF((" 2.6 OK\n"));
585                 return (false);
586             }
587         } /* if Ch_Loc */
588 } /* Func_2 */
589