Home » Archimedes archive » Acorn Computing » 1994 02 subscription disc.adf » 9402s » PD/ArmSi/!ArmSI/c/dhry_1

PD/ArmSi/!ArmSI/c/dhry_1

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn Computing » 1994 02 subscription disc.adf » 9402s
Filename: PD/ArmSi/!ArmSI/c/dhry_1
Read OK:
File size: 2F8A bytes
Load address: 0000
Exec address: 0000
File contents
/*
 ****************************************************************************
 *
 *                   "DHRYSTONE" Benchmark Program
 *                   -----------------------------
 *                                                                            
 *  Version:    C, Version 2.1
 *                                                                            
 *  File:       dhry_1.c (part 2 of 3)
 *
 *  Date:       May 25, 1988
 *
 *  Author:     Reinhold P. Weicker
 *
 ****************************************************************************
 */

#include "dhry.h"

/* Global Variables: */

Rec_Pointer     Ptr_Glob,
                Next_Ptr_Glob;
int             Int_Glob;
Boolean         Bool_Glob;
char            Ch_1_Glob,
                Ch_2_Glob;
int             Arr_1_Glob [50];
int             Arr_2_Glob [50] [50];

extern char     *malloc ();
Enumeration     Func_1 ();
  /* forward declaration necessary since Enumeration may not simply be int */

#ifndef REG
        Boolean Reg = false;
#define REG
        /* REG becomes defined as empty */
        /* i.e. no register variables   */
#else
        Boolean Reg = true;
#endif

/* variables for time measurement: */

#ifdef TIMES
struct tms      time_info;
extern  int     times ();
                /* see library function "times" */
#define Too_Small_Time (2*HZ)
                /* Measurements should last at least about 2 seconds */
#endif
#ifdef TIME
extern long     time();
                /* see library function "time"  */
#define Too_Small_Time 2
                /* Measurements should last at least 2 seconds */
#endif
#ifdef MSC_CLOCK
extern clock_t clock();
#define Too_Small_Time (2*HZ)
#endif

long            Begin_Time,
                End_Time,
                User_Time;
float           Microseconds,
                Dhrystones_Per_Second;

/* end of variables for time measurement */


main ()
/*****/

  /* main program, corresponds to procedures        */
  /* Main and Proc_0 in the Ada version             */
{
        One_Fifty       Int_1_Loc;
  REG   One_Fifty       Int_2_Loc;
        One_Fifty       Int_3_Loc;
  REG   char            Ch_Index;
        Enumeration     Enum_Loc;
        Str_30          Str_1_Loc;
        Str_30          Str_2_Loc;
  REG   int             Run_Index;
  REG   int             Number_Of_Runs;

  /* Initializations */

  Next_Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
  Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));

  Ptr_Glob->Ptr_Comp                    = Next_Ptr_Glob;
  Ptr_Glob->Discr                       = Ident_1;
  Ptr_Glob->variant.var_1.Enum_Comp     = Ident_3;
  Ptr_Glob->variant.var_1.Int_Comp      = 40;
  strcpy (Ptr_Glob->variant.var_1.Str_Comp, 
          "DHRYSTONE PROGRAM, SOME STRING");
  strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");

  Arr_2_Glob [8][7] = 10;
        /* Was missing in published program. Without this statement,    */
        /* Arr_2_Glob [8][7] would have an undefined value.             */
        /* Warning: With 16-Bit processors and Number_Of_Runs > 32000,  */
        /* overflow may occur for this array element.                   */

#ifndef SILENT
  printf ("\n");
  printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
  printf ("\n");
  if (Reg)
  {
    printf ("Program compiled with 'register' attribute\n");
    printf ("\n");
  }
  else
  {
    printf ("Program compiled without 'register' attribute\n");
    printf ("\n");
  }
  printf ("Please give the number of runs through the benchmark: ");
  {
    int n;
    scanf ("%d", &n);
    Number_Of_Runs = n;
  }
  printf ("\n");

  printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
#else
  Number_Of_Runs = NORUNS;
#endif

  /***************/
  /* Start timer */
  /***************/
 
#ifdef TIMES
  times (&time_info);
  Begin_Time = (long) time_info.tms_utime;
#endif
#ifdef TIME
  Begin_Time = time ( (long *) 0);
#endif
#ifdef MSC_CLOCK
  Begin_Time = clock();
#endif

  for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
  {

    Proc_5();
    Proc_4();
      /* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */
    Int_1_Loc = 2;
    Int_2_Loc = 3;
    strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
    Enum_Loc = Ident_2;
    Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
      /* Bool_Glob == 1 */
    while (Int_1_Loc < Int_2_Loc)  /* loop body executed once */
    {
      Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
        /* Int_3_Loc == 7 */
      Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
        /* Int_3_Loc == 7 */
      Int_1_Loc += 1;
    } /* while */
      /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
    Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc);
      /* Int_Glob == 5 */
    Proc_1 (Ptr_Glob);
    for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
                             /* loop body executed twice */
    {
      if (Enum_Loc == Func_1 (Ch_Index, 'C'))
          /* then, not executed */
        {
        Proc_6 (Ident_1, &Enum_Loc);
        strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
        Int_2_Loc = Run_Index;
        Int_Glob = Run_Index;
        }
    }
      /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
    Int_2_Loc = Int_2_Loc * Int_1_Loc;
    Int_1_Loc = Int_2_Loc / Int_3_Loc;
    Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc;
      /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */
    Proc_2 (&Int_1_Loc);
      /* Int_1_Loc == 5 */

  } /* loop "for Run_Index" */

  /**************/
  /* Stop timer */
  /**************/
  
#ifdef TIMES
  times (&time_info);
  End_Time = (long) time_info.tms_utime;
#endif
#ifdef TIME
  End_Time = time ( (long *) 0);
#endif
#ifdef MSC_CLOCK
  End_Time = clock();
#endif

#ifndef SILENT
  printf ("Execution ends\n");
  printf ("\n");
  printf ("Final values of the variables used in the benchmark:\n");
  printf ("\n");
  printf ("Int_Glob:            %d\n", Int_Glob);
  printf ("        should be:   %d\n", 5);
  printf ("Bool_Glob:           %d\n", Bool_Glob);
  printf ("        should be:   %d\n", 1);
  printf ("Ch_1_Glob:           %c\n", Ch_1_Glob);
  printf ("        should be:   %c\n", 'A');
  printf ("Ch_2_Glob:           %c\n", Ch_2_Glob);
  printf ("        should be:   %c\n", 'B');
  printf ("Arr_1_Glob[8]:       %d\n", Arr_1_Glob[8]);
  printf ("        should be:   %d\n", 7);
  printf ("Arr_2_Glob[8][7]:    %d\n", Arr_2_Glob[8][7]);
  printf ("        should be:   Number_Of_Runs + 10\n");
  printf ("Ptr_Glob->\n");
  printf ("  Ptr_Comp:          %d\n", (int) Ptr_Glob->Ptr_Comp);
  printf ("        should be:   (implementation-dependent)\n");
  printf ("  Discr:             %d\n", Ptr_Glob->Discr);
  printf ("        should be:   %d\n", 0);
  printf ("  Enum_Comp:         %d\n", Ptr_Glob->variant.var_1.Enum_Comp);
  printf ("        should be:   %d\n", 2);
  printf ("  Int_Comp:          %d\n", Ptr_Glob->variant.var_1.Int_Comp);
  printf ("        should be:   %d\n", 17);
  printf ("  Str_Comp:          %s\n", Ptr_Glob->variant.var_1.Str_Comp);
  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
  printf ("Next_Ptr_Glob->\n");
  printf ("  Ptr_Comp:          %d\n", (int) Next_Ptr_Glob->Ptr_Comp);
  printf ("        should be:   (implementation-dependent), same as above\n");
  printf ("  Discr:             %d\n", Next_Ptr_Glob->Discr);
  printf ("        should be:   %d\n", 0);
  printf ("  Enum_Comp:         %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp);
  printf ("        should be:   %d\n", 1);
  printf ("  Int_Comp:          %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp);
  printf ("        should be:   %d\n", 18);
  printf ("  Str_Comp:          %s\n",
                                Next_Ptr_Glob->variant.var_1.Str_Comp);
  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
  printf ("Int_1_Loc:           %d\n", Int_1_Loc);
  printf ("        should be:   %d\n", 5);
  printf ("Int_2_Loc:           %d\n", Int_2_Loc);
  printf ("        should be:   %d\n", 13);
  printf ("Int_3_Loc:           %d\n", Int_3_Loc);
  printf ("        should be:   %d\n", 7);
  printf ("Enum_Loc:            %d\n", Enum_Loc);
  printf ("        should be:   %d\n", 1);
  printf ("Str_1_Loc:           %s\n", Str_1_Loc);
  printf ("        should be:   DHRYSTONE PROGRAM, 1'ST STRING\n");
  printf ("Str_2_Loc:           %s\n", Str_2_Loc);
  printf ("        should be:   DHRYSTONE PROGRAM, 2'ND STRING\n");
  printf ("\n");
#endif

  User_Time = End_Time - Begin_Time;

  if (User_Time < Too_Small_Time)
  {
#ifndef SILENT
    printf ("Measured time too small to obtain meaningful results\n");
    printf ("Please increase number of runs\n");
    printf ("\n");
#else
    system("UnSet ArmSI$Dhrystone");
#endif
  }
  else
  {
#ifdef TIME
    Microseconds = (float) User_Time * Mic_secs_Per_Second 
                        / (float) Number_Of_Runs;
    Dhrystones_Per_Second = (float) Number_Of_Runs / (float) User_Time;
#else
    Microseconds = (float) User_Time * Mic_secs_Per_Second 
                        / ((float) HZ * ((float) Number_Of_Runs));
    Dhrystones_Per_Second = ((float) HZ * (float) Number_Of_Runs)
                        / (float) User_Time;
#endif
#ifndef SILENT
    printf ("Microseconds for one run through Dhrystone: ");
    printf ("%6.1f \n", Microseconds);
    printf ("Dhrystones per Second:                      ");
    printf ("%6.1f \n", Dhrystones_Per_Second);
    printf ("\n");
#else
    { char *timing;
      sprintf(timing, "Set ArmSI$Dhrystone %6.1f %6.1f", Microseconds, Dhrystones_Per_Second);
      system(timing);
    }
#endif
  }
  
}


Proc_1 (Ptr_Val_Par)
/******************/

REG Rec_Pointer Ptr_Val_Par;
    /* executed once */
{
  REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;  
                                        /* == Ptr_Glob_Next */
  /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp,    */
  /* corresponds to "rename" in Ada, "with" in Pascal           */
  
  structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob); 
  Ptr_Val_Par->variant.var_1.Int_Comp = 5;
  Next_Record->variant.var_1.Int_Comp 
        = Ptr_Val_Par->variant.var_1.Int_Comp;
  Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
  Proc_3 (&Next_Record->Ptr_Comp);
    /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp 
                        == Ptr_Glob->Ptr_Comp */
  if (Next_Record->Discr == Ident_1)
    /* then, executed */
  {
    Next_Record->variant.var_1.Int_Comp = 6;
    Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp, 
           &Next_Record->variant.var_1.Enum_Comp);
    Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
    Proc_7 (Next_Record->variant.var_1.Int_Comp, 10, 
           &Next_Record->variant.var_1.Int_Comp);
  }
  else /* not executed */
    structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp);
} /* Proc_1 */


Proc_2 (Int_Par_Ref)
/******************/
    /* executed once */
    /* *Int_Par_Ref == 1, becomes 4 */

One_Fifty   *Int_Par_Ref;
{
  One_Fifty  Int_Loc;  
  Enumeration   Enum_Loc;

  Int_Loc = *Int_Par_Ref + 10;
  do /* executed once */
    if (Ch_1_Glob == 'A')
      /* then, executed */
    {
      Int_Loc -= 1;
      *Int_Par_Ref = Int_Loc - Int_Glob;
      Enum_Loc = Ident_1;
    } /* if */
  while (Enum_Loc != Ident_1); /* true */
} /* Proc_2 */


Proc_3 (Ptr_Ref_Par)
/******************/
    /* executed once */
    /* Ptr_Ref_Par becomes Ptr_Glob */

Rec_Pointer *Ptr_Ref_Par;

{
  if (Ptr_Glob != Null)
    /* then, executed */
    *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
  Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
} /* Proc_3 */


Proc_4 () /* without parameters */
/*******/
    /* executed once */
{
  Boolean Bool_Loc;

  Bool_Loc = Ch_1_Glob == 'A';
  Bool_Glob = Bool_Loc | Bool_Glob;
  Ch_2_Glob = 'B';
} /* Proc_4 */


Proc_5 () /* without parameters */
/*******/
    /* executed once */
{
  Ch_1_Glob = 'A';
  Bool_Glob = false;
} /* Proc_5 */


        /* Procedure for the assignment of structures,          */
        /* if the C compiler doesn't support this feature       */
#ifdef  NOSTRUCTASSIGN
memcpy (d, s, l)
register char   *d;
register char   *s;
register int    l;
{
        while (l--) *d++ = *s++;
}
#endif


00000000  2f 2a 0a 20 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |/*. ************|
00000010  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000050  0a 20 2a 0a 20 2a 20 20  20 20 20 20 20 20 20 20  |. *. *          |
00000060  20 20 20 20 20 20 20 20  20 22 44 48 52 59 53 54  |         "DHRYST|
00000070  4f 4e 45 22 20 42 65 6e  63 68 6d 61 72 6b 20 50  |ONE" Benchmark P|
00000080  72 6f 67 72 61 6d 0a 20  2a 20 20 20 20 20 20 20  |rogram. *       |
00000090  20 20 20 20 20 20 20 20  20 20 20 20 2d 2d 2d 2d  |            ----|
000000a0  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
000000b0  2d 2d 2d 2d 2d 2d 2d 2d  2d 0a 20 2a 20 20 20 20  |---------. *    |
000000c0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000100  20 20 20 20 20 20 20 20  0a 20 2a 20 20 56 65 72  |        . *  Ver|
00000110  73 69 6f 6e 3a 20 20 20  20 43 2c 20 56 65 72 73  |sion:    C, Vers|
00000120  69 6f 6e 20 32 2e 31 0a  20 2a 20 20 20 20 20 20  |ion 2.1. *      |
00000130  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000170  20 20 20 20 20 20 0a 20  2a 20 20 46 69 6c 65 3a  |      . *  File:|
00000180  20 20 20 20 20 20 20 64  68 72 79 5f 31 2e 63 20  |       dhry_1.c |
00000190  28 70 61 72 74 20 32 20  6f 66 20 33 29 0a 20 2a  |(part 2 of 3). *|
000001a0  0a 20 2a 20 20 44 61 74  65 3a 20 20 20 20 20 20  |. *  Date:      |
000001b0  20 4d 61 79 20 32 35 2c  20 31 39 38 38 0a 20 2a  | May 25, 1988. *|
000001c0  0a 20 2a 20 20 41 75 74  68 6f 72 3a 20 20 20 20  |. *  Author:    |
000001d0  20 52 65 69 6e 68 6f 6c  64 20 50 2e 20 57 65 69  | Reinhold P. Wei|
000001e0  63 6b 65 72 0a 20 2a 0a  20 2a 2a 2a 2a 2a 2a 2a  |cker. *. *******|
000001f0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000230  2a 2a 2a 2a 2a 0a 20 2a  2f 0a 0a 23 69 6e 63 6c  |*****. */..#incl|
00000240  75 64 65 20 22 64 68 72  79 2e 68 22 0a 0a 2f 2a  |ude "dhry.h"../*|
00000250  20 47 6c 6f 62 61 6c 20  56 61 72 69 61 62 6c 65  | Global Variable|
00000260  73 3a 20 2a 2f 0a 0a 52  65 63 5f 50 6f 69 6e 74  |s: */..Rec_Point|
00000270  65 72 20 20 20 20 20 50  74 72 5f 47 6c 6f 62 2c  |er     Ptr_Glob,|
00000280  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000290  20 4e 65 78 74 5f 50 74  72 5f 47 6c 6f 62 3b 0a  | Next_Ptr_Glob;.|
000002a0  69 6e 74 20 20 20 20 20  20 20 20 20 20 20 20 20  |int             |
000002b0  49 6e 74 5f 47 6c 6f 62  3b 0a 42 6f 6f 6c 65 61  |Int_Glob;.Boolea|
000002c0  6e 20 20 20 20 20 20 20  20 20 42 6f 6f 6c 5f 47  |n         Bool_G|
000002d0  6c 6f 62 3b 0a 63 68 61  72 20 20 20 20 20 20 20  |lob;.char       |
000002e0  20 20 20 20 20 43 68 5f  31 5f 47 6c 6f 62 2c 0a  |     Ch_1_Glob,.|
000002f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000300  43 68 5f 32 5f 47 6c 6f  62 3b 0a 69 6e 74 20 20  |Ch_2_Glob;.int  |
00000310  20 20 20 20 20 20 20 20  20 20 20 41 72 72 5f 31  |           Arr_1|
00000320  5f 47 6c 6f 62 20 5b 35  30 5d 3b 0a 69 6e 74 20  |_Glob [50];.int |
00000330  20 20 20 20 20 20 20 20  20 20 20 20 41 72 72 5f  |            Arr_|
00000340  32 5f 47 6c 6f 62 20 5b  35 30 5d 20 5b 35 30 5d  |2_Glob [50] [50]|
00000350  3b 0a 0a 65 78 74 65 72  6e 20 63 68 61 72 20 20  |;..extern char  |
00000360  20 20 20 2a 6d 61 6c 6c  6f 63 20 28 29 3b 0a 45  |   *malloc ();.E|
00000370  6e 75 6d 65 72 61 74 69  6f 6e 20 20 20 20 20 46  |numeration     F|
00000380  75 6e 63 5f 31 20 28 29  3b 0a 20 20 2f 2a 20 66  |unc_1 ();.  /* f|
00000390  6f 72 77 61 72 64 20 64  65 63 6c 61 72 61 74 69  |orward declarati|
000003a0  6f 6e 20 6e 65 63 65 73  73 61 72 79 20 73 69 6e  |on necessary sin|
000003b0  63 65 20 45 6e 75 6d 65  72 61 74 69 6f 6e 20 6d  |ce Enumeration m|
000003c0  61 79 20 6e 6f 74 20 73  69 6d 70 6c 79 20 62 65  |ay not simply be|
000003d0  20 69 6e 74 20 2a 2f 0a  0a 23 69 66 6e 64 65 66  | int */..#ifndef|
000003e0  20 52 45 47 0a 20 20 20  20 20 20 20 20 42 6f 6f  | REG.        Boo|
000003f0  6c 65 61 6e 20 52 65 67  20 3d 20 66 61 6c 73 65  |lean Reg = false|
00000400  3b 0a 23 64 65 66 69 6e  65 20 52 45 47 0a 20 20  |;.#define REG.  |
00000410  20 20 20 20 20 20 2f 2a  20 52 45 47 20 62 65 63  |      /* REG bec|
00000420  6f 6d 65 73 20 64 65 66  69 6e 65 64 20 61 73 20  |omes defined as |
00000430  65 6d 70 74 79 20 2a 2f  0a 20 20 20 20 20 20 20  |empty */.       |
00000440  20 2f 2a 20 69 2e 65 2e  20 6e 6f 20 72 65 67 69  | /* i.e. no regi|
00000450  73 74 65 72 20 76 61 72  69 61 62 6c 65 73 20 20  |ster variables  |
00000460  20 2a 2f 0a 23 65 6c 73  65 0a 20 20 20 20 20 20  | */.#else.      |
00000470  20 20 42 6f 6f 6c 65 61  6e 20 52 65 67 20 3d 20  |  Boolean Reg = |
00000480  74 72 75 65 3b 0a 23 65  6e 64 69 66 0a 0a 2f 2a  |true;.#endif../*|
00000490  20 76 61 72 69 61 62 6c  65 73 20 66 6f 72 20 74  | variables for t|
000004a0  69 6d 65 20 6d 65 61 73  75 72 65 6d 65 6e 74 3a  |ime measurement:|
000004b0  20 2a 2f 0a 0a 23 69 66  64 65 66 20 54 49 4d 45  | */..#ifdef TIME|
000004c0  53 0a 73 74 72 75 63 74  20 74 6d 73 20 20 20 20  |S.struct tms    |
000004d0  20 20 74 69 6d 65 5f 69  6e 66 6f 3b 0a 65 78 74  |  time_info;.ext|
000004e0  65 72 6e 20 20 69 6e 74  20 20 20 20 20 74 69 6d  |ern  int     tim|
000004f0  65 73 20 28 29 3b 0a 20  20 20 20 20 20 20 20 20  |es ();.         |
00000500  20 20 20 20 20 20 20 2f  2a 20 73 65 65 20 6c 69  |       /* see li|
00000510  62 72 61 72 79 20 66 75  6e 63 74 69 6f 6e 20 22  |brary function "|
00000520  74 69 6d 65 73 22 20 2a  2f 0a 23 64 65 66 69 6e  |times" */.#defin|
00000530  65 20 54 6f 6f 5f 53 6d  61 6c 6c 5f 54 69 6d 65  |e Too_Small_Time|
00000540  20 28 32 2a 48 5a 29 0a  20 20 20 20 20 20 20 20  | (2*HZ).        |
00000550  20 20 20 20 20 20 20 20  2f 2a 20 4d 65 61 73 75  |        /* Measu|
00000560  72 65 6d 65 6e 74 73 20  73 68 6f 75 6c 64 20 6c  |rements should l|
00000570  61 73 74 20 61 74 20 6c  65 61 73 74 20 61 62 6f  |ast at least abo|
00000580  75 74 20 32 20 73 65 63  6f 6e 64 73 20 2a 2f 0a  |ut 2 seconds */.|
00000590  23 65 6e 64 69 66 0a 23  69 66 64 65 66 20 54 49  |#endif.#ifdef TI|
000005a0  4d 45 0a 65 78 74 65 72  6e 20 6c 6f 6e 67 20 20  |ME.extern long  |
000005b0  20 20 20 74 69 6d 65 28  29 3b 0a 20 20 20 20 20  |   time();.     |
000005c0  20 20 20 20 20 20 20 20  20 20 20 2f 2a 20 73 65  |           /* se|
000005d0  65 20 6c 69 62 72 61 72  79 20 66 75 6e 63 74 69  |e library functi|
000005e0  6f 6e 20 22 74 69 6d 65  22 20 20 2a 2f 0a 23 64  |on "time"  */.#d|
000005f0  65 66 69 6e 65 20 54 6f  6f 5f 53 6d 61 6c 6c 5f  |efine Too_Small_|
00000600  54 69 6d 65 20 32 0a 20  20 20 20 20 20 20 20 20  |Time 2.         |
00000610  20 20 20 20 20 20 20 2f  2a 20 4d 65 61 73 75 72  |       /* Measur|
00000620  65 6d 65 6e 74 73 20 73  68 6f 75 6c 64 20 6c 61  |ements should la|
00000630  73 74 20 61 74 20 6c 65  61 73 74 20 32 20 73 65  |st at least 2 se|
00000640  63 6f 6e 64 73 20 2a 2f  0a 23 65 6e 64 69 66 0a  |conds */.#endif.|
00000650  23 69 66 64 65 66 20 4d  53 43 5f 43 4c 4f 43 4b  |#ifdef MSC_CLOCK|
00000660  0a 65 78 74 65 72 6e 20  63 6c 6f 63 6b 5f 74 20  |.extern clock_t |
00000670  63 6c 6f 63 6b 28 29 3b  0a 23 64 65 66 69 6e 65  |clock();.#define|
00000680  20 54 6f 6f 5f 53 6d 61  6c 6c 5f 54 69 6d 65 20  | Too_Small_Time |
00000690  28 32 2a 48 5a 29 0a 23  65 6e 64 69 66 0a 0a 6c  |(2*HZ).#endif..l|
000006a0  6f 6e 67 20 20 20 20 20  20 20 20 20 20 20 20 42  |ong            B|
000006b0  65 67 69 6e 5f 54 69 6d  65 2c 0a 20 20 20 20 20  |egin_Time,.     |
000006c0  20 20 20 20 20 20 20 20  20 20 20 45 6e 64 5f 54  |           End_T|
000006d0  69 6d 65 2c 0a 20 20 20  20 20 20 20 20 20 20 20  |ime,.           |
000006e0  20 20 20 20 20 55 73 65  72 5f 54 69 6d 65 3b 0a  |     User_Time;.|
000006f0  66 6c 6f 61 74 20 20 20  20 20 20 20 20 20 20 20  |float           |
00000700  4d 69 63 72 6f 73 65 63  6f 6e 64 73 2c 0a 20 20  |Microseconds,.  |
00000710  20 20 20 20 20 20 20 20  20 20 20 20 20 20 44 68  |              Dh|
00000720  72 79 73 74 6f 6e 65 73  5f 50 65 72 5f 53 65 63  |rystones_Per_Sec|
00000730  6f 6e 64 3b 0a 0a 2f 2a  20 65 6e 64 20 6f 66 20  |ond;../* end of |
00000740  76 61 72 69 61 62 6c 65  73 20 66 6f 72 20 74 69  |variables for ti|
00000750  6d 65 20 6d 65 61 73 75  72 65 6d 65 6e 74 20 2a  |me measurement *|
00000760  2f 0a 0a 0a 6d 61 69 6e  20 28 29 0a 2f 2a 2a 2a  |/...main ()./***|
00000770  2a 2a 2f 0a 0a 20 20 2f  2a 20 6d 61 69 6e 20 70  |**/..  /* main p|
00000780  72 6f 67 72 61 6d 2c 20  63 6f 72 72 65 73 70 6f  |rogram, correspo|
00000790  6e 64 73 20 74 6f 20 70  72 6f 63 65 64 75 72 65  |nds to procedure|
000007a0  73 20 20 20 20 20 20 20  20 2a 2f 0a 20 20 2f 2a  |s        */.  /*|
000007b0  20 4d 61 69 6e 20 61 6e  64 20 50 72 6f 63 5f 30  | Main and Proc_0|
000007c0  20 69 6e 20 74 68 65 20  41 64 61 20 76 65 72 73  | in the Ada vers|
000007d0  69 6f 6e 20 20 20 20 20  20 20 20 20 20 20 20 20  |ion             |
000007e0  2a 2f 0a 7b 0a 20 20 20  20 20 20 20 20 4f 6e 65  |*/.{.        One|
000007f0  5f 46 69 66 74 79 20 20  20 20 20 20 20 49 6e 74  |_Fifty       Int|
00000800  5f 31 5f 4c 6f 63 3b 0a  20 20 52 45 47 20 20 20  |_1_Loc;.  REG   |
00000810  4f 6e 65 5f 46 69 66 74  79 20 20 20 20 20 20 20  |One_Fifty       |
00000820  49 6e 74 5f 32 5f 4c 6f  63 3b 0a 20 20 20 20 20  |Int_2_Loc;.     |
00000830  20 20 20 4f 6e 65 5f 46  69 66 74 79 20 20 20 20  |   One_Fifty    |
00000840  20 20 20 49 6e 74 5f 33  5f 4c 6f 63 3b 0a 20 20  |   Int_3_Loc;.  |
00000850  52 45 47 20 20 20 63 68  61 72 20 20 20 20 20 20  |REG   char      |
00000860  20 20 20 20 20 20 43 68  5f 49 6e 64 65 78 3b 0a  |      Ch_Index;.|
00000870  20 20 20 20 20 20 20 20  45 6e 75 6d 65 72 61 74  |        Enumerat|
00000880  69 6f 6e 20 20 20 20 20  45 6e 75 6d 5f 4c 6f 63  |ion     Enum_Loc|
00000890  3b 0a 20 20 20 20 20 20  20 20 53 74 72 5f 33 30  |;.        Str_30|
000008a0  20 20 20 20 20 20 20 20  20 20 53 74 72 5f 31 5f  |          Str_1_|
000008b0  4c 6f 63 3b 0a 20 20 20  20 20 20 20 20 53 74 72  |Loc;.        Str|
000008c0  5f 33 30 20 20 20 20 20  20 20 20 20 20 53 74 72  |_30          Str|
000008d0  5f 32 5f 4c 6f 63 3b 0a  20 20 52 45 47 20 20 20  |_2_Loc;.  REG   |
000008e0  69 6e 74 20 20 20 20 20  20 20 20 20 20 20 20 20  |int             |
000008f0  52 75 6e 5f 49 6e 64 65  78 3b 0a 20 20 52 45 47  |Run_Index;.  REG|
00000900  20 20 20 69 6e 74 20 20  20 20 20 20 20 20 20 20  |   int          |
00000910  20 20 20 4e 75 6d 62 65  72 5f 4f 66 5f 52 75 6e  |   Number_Of_Run|
00000920  73 3b 0a 0a 20 20 2f 2a  20 49 6e 69 74 69 61 6c  |s;..  /* Initial|
00000930  69 7a 61 74 69 6f 6e 73  20 2a 2f 0a 0a 20 20 4e  |izations */..  N|
00000940  65 78 74 5f 50 74 72 5f  47 6c 6f 62 20 3d 20 28  |ext_Ptr_Glob = (|
00000950  52 65 63 5f 50 6f 69 6e  74 65 72 29 20 6d 61 6c  |Rec_Pointer) mal|
00000960  6c 6f 63 20 28 73 69 7a  65 6f 66 20 28 52 65 63  |loc (sizeof (Rec|
00000970  5f 54 79 70 65 29 29 3b  0a 20 20 50 74 72 5f 47  |_Type));.  Ptr_G|
00000980  6c 6f 62 20 3d 20 28 52  65 63 5f 50 6f 69 6e 74  |lob = (Rec_Point|
00000990  65 72 29 20 6d 61 6c 6c  6f 63 20 28 73 69 7a 65  |er) malloc (size|
000009a0  6f 66 20 28 52 65 63 5f  54 79 70 65 29 29 3b 0a  |of (Rec_Type));.|
000009b0  0a 20 20 50 74 72 5f 47  6c 6f 62 2d 3e 50 74 72  |.  Ptr_Glob->Ptr|
000009c0  5f 43 6f 6d 70 20 20 20  20 20 20 20 20 20 20 20  |_Comp           |
000009d0  20 20 20 20 20 20 20 20  20 3d 20 4e 65 78 74 5f  |         = Next_|
000009e0  50 74 72 5f 47 6c 6f 62  3b 0a 20 20 50 74 72 5f  |Ptr_Glob;.  Ptr_|
000009f0  47 6c 6f 62 2d 3e 44 69  73 63 72 20 20 20 20 20  |Glob->Discr     |
00000a00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000a10  20 20 3d 20 49 64 65 6e  74 5f 31 3b 0a 20 20 50  |  = Ident_1;.  P|
00000a20  74 72 5f 47 6c 6f 62 2d  3e 76 61 72 69 61 6e 74  |tr_Glob->variant|
00000a30  2e 76 61 72 5f 31 2e 45  6e 75 6d 5f 43 6f 6d 70  |.var_1.Enum_Comp|
00000a40  20 20 20 20 20 3d 20 49  64 65 6e 74 5f 33 3b 0a  |     = Ident_3;.|
00000a50  20 20 50 74 72 5f 47 6c  6f 62 2d 3e 76 61 72 69  |  Ptr_Glob->vari|
00000a60  61 6e 74 2e 76 61 72 5f  31 2e 49 6e 74 5f 43 6f  |ant.var_1.Int_Co|
00000a70  6d 70 20 20 20 20 20 20  3d 20 34 30 3b 0a 20 20  |mp      = 40;.  |
00000a80  73 74 72 63 70 79 20 28  50 74 72 5f 47 6c 6f 62  |strcpy (Ptr_Glob|
00000a90  2d 3e 76 61 72 69 61 6e  74 2e 76 61 72 5f 31 2e  |->variant.var_1.|
00000aa0  53 74 72 5f 43 6f 6d 70  2c 20 0a 20 20 20 20 20  |Str_Comp, .     |
00000ab0  20 20 20 20 20 22 44 48  52 59 53 54 4f 4e 45 20  |     "DHRYSTONE |
00000ac0  50 52 4f 47 52 41 4d 2c  20 53 4f 4d 45 20 53 54  |PROGRAM, SOME ST|
00000ad0  52 49 4e 47 22 29 3b 0a  20 20 73 74 72 63 70 79  |RING");.  strcpy|
00000ae0  20 28 53 74 72 5f 31 5f  4c 6f 63 2c 20 22 44 48  | (Str_1_Loc, "DH|
00000af0  52 59 53 54 4f 4e 45 20  50 52 4f 47 52 41 4d 2c  |RYSTONE PROGRAM,|
00000b00  20 31 27 53 54 20 53 54  52 49 4e 47 22 29 3b 0a  | 1'ST STRING");.|
00000b10  0a 20 20 41 72 72 5f 32  5f 47 6c 6f 62 20 5b 38  |.  Arr_2_Glob [8|
00000b20  5d 5b 37 5d 20 3d 20 31  30 3b 0a 20 20 20 20 20  |][7] = 10;.     |
00000b30  20 20 20 2f 2a 20 57 61  73 20 6d 69 73 73 69 6e  |   /* Was missin|
00000b40  67 20 69 6e 20 70 75 62  6c 69 73 68 65 64 20 70  |g in published p|
00000b50  72 6f 67 72 61 6d 2e 20  57 69 74 68 6f 75 74 20  |rogram. Without |
00000b60  74 68 69 73 20 73 74 61  74 65 6d 65 6e 74 2c 20  |this statement, |
00000b70  20 20 20 2a 2f 0a 20 20  20 20 20 20 20 20 2f 2a  |   */.        /*|
00000b80  20 41 72 72 5f 32 5f 47  6c 6f 62 20 5b 38 5d 5b  | Arr_2_Glob [8][|
00000b90  37 5d 20 77 6f 75 6c 64  20 68 61 76 65 20 61 6e  |7] would have an|
00000ba0  20 75 6e 64 65 66 69 6e  65 64 20 76 61 6c 75 65  | undefined value|
00000bb0  2e 20 20 20 20 20 20 20  20 20 20 20 20 20 2a 2f  |.             */|
00000bc0  0a 20 20 20 20 20 20 20  20 2f 2a 20 57 61 72 6e  |.        /* Warn|
00000bd0  69 6e 67 3a 20 57 69 74  68 20 31 36 2d 42 69 74  |ing: With 16-Bit|
00000be0  20 70 72 6f 63 65 73 73  6f 72 73 20 61 6e 64 20  | processors and |
00000bf0  4e 75 6d 62 65 72 5f 4f  66 5f 52 75 6e 73 20 3e  |Number_Of_Runs >|
00000c00  20 33 32 30 30 30 2c 20  20 2a 2f 0a 20 20 20 20  | 32000,  */.    |
00000c10  20 20 20 20 2f 2a 20 6f  76 65 72 66 6c 6f 77 20  |    /* overflow |
00000c20  6d 61 79 20 6f 63 63 75  72 20 66 6f 72 20 74 68  |may occur for th|
00000c30  69 73 20 61 72 72 61 79  20 65 6c 65 6d 65 6e 74  |is array element|
00000c40  2e 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000c50  20 20 20 20 2a 2f 0a 0a  23 69 66 6e 64 65 66 20  |    */..#ifndef |
00000c60  53 49 4c 45 4e 54 0a 20  20 70 72 69 6e 74 66 20  |SILENT.  printf |
00000c70  28 22 5c 6e 22 29 3b 0a  20 20 70 72 69 6e 74 66  |("\n");.  printf|
00000c80  20 28 22 44 68 72 79 73  74 6f 6e 65 20 42 65 6e  | ("Dhrystone Ben|
00000c90  63 68 6d 61 72 6b 2c 20  56 65 72 73 69 6f 6e 20  |chmark, Version |
00000ca0  32 2e 31 20 28 4c 61 6e  67 75 61 67 65 3a 20 43  |2.1 (Language: C|
00000cb0  29 5c 6e 22 29 3b 0a 20  20 70 72 69 6e 74 66 20  |)\n");.  printf |
00000cc0  28 22 5c 6e 22 29 3b 0a  20 20 69 66 20 28 52 65  |("\n");.  if (Re|
00000cd0  67 29 0a 20 20 7b 0a 20  20 20 20 70 72 69 6e 74  |g).  {.    print|
00000ce0  66 20 28 22 50 72 6f 67  72 61 6d 20 63 6f 6d 70  |f ("Program comp|
00000cf0  69 6c 65 64 20 77 69 74  68 20 27 72 65 67 69 73  |iled with 'regis|
00000d00  74 65 72 27 20 61 74 74  72 69 62 75 74 65 5c 6e  |ter' attribute\n|
00000d10  22 29 3b 0a 20 20 20 20  70 72 69 6e 74 66 20 28  |");.    printf (|
00000d20  22 5c 6e 22 29 3b 0a 20  20 7d 0a 20 20 65 6c 73  |"\n");.  }.  els|
00000d30  65 0a 20 20 7b 0a 20 20  20 20 70 72 69 6e 74 66  |e.  {.    printf|
00000d40  20 28 22 50 72 6f 67 72  61 6d 20 63 6f 6d 70 69  | ("Program compi|
00000d50  6c 65 64 20 77 69 74 68  6f 75 74 20 27 72 65 67  |led without 'reg|
00000d60  69 73 74 65 72 27 20 61  74 74 72 69 62 75 74 65  |ister' attribute|
00000d70  5c 6e 22 29 3b 0a 20 20  20 20 70 72 69 6e 74 66  |\n");.    printf|
00000d80  20 28 22 5c 6e 22 29 3b  0a 20 20 7d 0a 20 20 70  | ("\n");.  }.  p|
00000d90  72 69 6e 74 66 20 28 22  50 6c 65 61 73 65 20 67  |rintf ("Please g|
00000da0  69 76 65 20 74 68 65 20  6e 75 6d 62 65 72 20 6f  |ive the number o|
00000db0  66 20 72 75 6e 73 20 74  68 72 6f 75 67 68 20 74  |f runs through t|
00000dc0  68 65 20 62 65 6e 63 68  6d 61 72 6b 3a 20 22 29  |he benchmark: ")|
00000dd0  3b 0a 20 20 7b 0a 20 20  20 20 69 6e 74 20 6e 3b  |;.  {.    int n;|
00000de0  0a 20 20 20 20 73 63 61  6e 66 20 28 22 25 64 22  |.    scanf ("%d"|
00000df0  2c 20 26 6e 29 3b 0a 20  20 20 20 4e 75 6d 62 65  |, &n);.    Numbe|
00000e00  72 5f 4f 66 5f 52 75 6e  73 20 3d 20 6e 3b 0a 20  |r_Of_Runs = n;. |
00000e10  20 7d 0a 20 20 70 72 69  6e 74 66 20 28 22 5c 6e  | }.  printf ("\n|
00000e20  22 29 3b 0a 0a 20 20 70  72 69 6e 74 66 20 28 22  |");..  printf ("|
00000e30  45 78 65 63 75 74 69 6f  6e 20 73 74 61 72 74 73  |Execution starts|
00000e40  2c 20 25 64 20 72 75 6e  73 20 74 68 72 6f 75 67  |, %d runs throug|
00000e50  68 20 44 68 72 79 73 74  6f 6e 65 5c 6e 22 2c 20  |h Dhrystone\n", |
00000e60  4e 75 6d 62 65 72 5f 4f  66 5f 52 75 6e 73 29 3b  |Number_Of_Runs);|
00000e70  0a 23 65 6c 73 65 0a 20  20 4e 75 6d 62 65 72 5f  |.#else.  Number_|
00000e80  4f 66 5f 52 75 6e 73 20  3d 20 4e 4f 52 55 4e 53  |Of_Runs = NORUNS|
00000e90  3b 0a 23 65 6e 64 69 66  0a 0a 20 20 2f 2a 2a 2a  |;.#endif..  /***|
00000ea0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2f 0a 20 20  |************/.  |
00000eb0  2f 2a 20 53 74 61 72 74  20 74 69 6d 65 72 20 2a  |/* Start timer *|
00000ec0  2f 0a 20 20 2f 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |/.  /***********|
00000ed0  2a 2a 2a 2a 2f 0a 20 0a  23 69 66 64 65 66 20 54  |****/. .#ifdef T|
00000ee0  49 4d 45 53 0a 20 20 74  69 6d 65 73 20 28 26 74  |IMES.  times (&t|
00000ef0  69 6d 65 5f 69 6e 66 6f  29 3b 0a 20 20 42 65 67  |ime_info);.  Beg|
00000f00  69 6e 5f 54 69 6d 65 20  3d 20 28 6c 6f 6e 67 29  |in_Time = (long)|
00000f10  20 74 69 6d 65 5f 69 6e  66 6f 2e 74 6d 73 5f 75  | time_info.tms_u|
00000f20  74 69 6d 65 3b 0a 23 65  6e 64 69 66 0a 23 69 66  |time;.#endif.#if|
00000f30  64 65 66 20 54 49 4d 45  0a 20 20 42 65 67 69 6e  |def TIME.  Begin|
00000f40  5f 54 69 6d 65 20 3d 20  74 69 6d 65 20 28 20 28  |_Time = time ( (|
00000f50  6c 6f 6e 67 20 2a 29 20  30 29 3b 0a 23 65 6e 64  |long *) 0);.#end|
00000f60  69 66 0a 23 69 66 64 65  66 20 4d 53 43 5f 43 4c  |if.#ifdef MSC_CL|
00000f70  4f 43 4b 0a 20 20 42 65  67 69 6e 5f 54 69 6d 65  |OCK.  Begin_Time|
00000f80  20 3d 20 63 6c 6f 63 6b  28 29 3b 0a 23 65 6e 64  | = clock();.#end|
00000f90  69 66 0a 0a 20 20 66 6f  72 20 28 52 75 6e 5f 49  |if..  for (Run_I|
00000fa0  6e 64 65 78 20 3d 20 31  3b 20 52 75 6e 5f 49 6e  |ndex = 1; Run_In|
00000fb0  64 65 78 20 3c 3d 20 4e  75 6d 62 65 72 5f 4f 66  |dex <= Number_Of|
00000fc0  5f 52 75 6e 73 3b 20 2b  2b 52 75 6e 5f 49 6e 64  |_Runs; ++Run_Ind|
00000fd0  65 78 29 0a 20 20 7b 0a  0a 20 20 20 20 50 72 6f  |ex).  {..    Pro|
00000fe0  63 5f 35 28 29 3b 0a 20  20 20 20 50 72 6f 63 5f  |c_5();.    Proc_|
00000ff0  34 28 29 3b 0a 20 20 20  20 20 20 2f 2a 20 43 68  |4();.      /* Ch|
00001000  5f 31 5f 47 6c 6f 62 20  3d 3d 20 27 41 27 2c 20  |_1_Glob == 'A', |
00001010  43 68 5f 32 5f 47 6c 6f  62 20 3d 3d 20 27 42 27  |Ch_2_Glob == 'B'|
00001020  2c 20 42 6f 6f 6c 5f 47  6c 6f 62 20 3d 3d 20 74  |, Bool_Glob == t|
00001030  72 75 65 20 2a 2f 0a 20  20 20 20 49 6e 74 5f 31  |rue */.    Int_1|
00001040  5f 4c 6f 63 20 3d 20 32  3b 0a 20 20 20 20 49 6e  |_Loc = 2;.    In|
00001050  74 5f 32 5f 4c 6f 63 20  3d 20 33 3b 0a 20 20 20  |t_2_Loc = 3;.   |
00001060  20 73 74 72 63 70 79 20  28 53 74 72 5f 32 5f 4c  | strcpy (Str_2_L|
00001070  6f 63 2c 20 22 44 48 52  59 53 54 4f 4e 45 20 50  |oc, "DHRYSTONE P|
00001080  52 4f 47 52 41 4d 2c 20  32 27 4e 44 20 53 54 52  |ROGRAM, 2'ND STR|
00001090  49 4e 47 22 29 3b 0a 20  20 20 20 45 6e 75 6d 5f  |ING");.    Enum_|
000010a0  4c 6f 63 20 3d 20 49 64  65 6e 74 5f 32 3b 0a 20  |Loc = Ident_2;. |
000010b0  20 20 20 42 6f 6f 6c 5f  47 6c 6f 62 20 3d 20 21  |   Bool_Glob = !|
000010c0  20 46 75 6e 63 5f 32 20  28 53 74 72 5f 31 5f 4c  | Func_2 (Str_1_L|
000010d0  6f 63 2c 20 53 74 72 5f  32 5f 4c 6f 63 29 3b 0a  |oc, Str_2_Loc);.|
000010e0  20 20 20 20 20 20 2f 2a  20 42 6f 6f 6c 5f 47 6c  |      /* Bool_Gl|
000010f0  6f 62 20 3d 3d 20 31 20  2a 2f 0a 20 20 20 20 77  |ob == 1 */.    w|
00001100  68 69 6c 65 20 28 49 6e  74 5f 31 5f 4c 6f 63 20  |hile (Int_1_Loc |
00001110  3c 20 49 6e 74 5f 32 5f  4c 6f 63 29 20 20 2f 2a  |< Int_2_Loc)  /*|
00001120  20 6c 6f 6f 70 20 62 6f  64 79 20 65 78 65 63 75  | loop body execu|
00001130  74 65 64 20 6f 6e 63 65  20 2a 2f 0a 20 20 20 20  |ted once */.    |
00001140  7b 0a 20 20 20 20 20 20  49 6e 74 5f 33 5f 4c 6f  |{.      Int_3_Lo|
00001150  63 20 3d 20 35 20 2a 20  49 6e 74 5f 31 5f 4c 6f  |c = 5 * Int_1_Lo|
00001160  63 20 2d 20 49 6e 74 5f  32 5f 4c 6f 63 3b 0a 20  |c - Int_2_Loc;. |
00001170  20 20 20 20 20 20 20 2f  2a 20 49 6e 74 5f 33 5f  |       /* Int_3_|
00001180  4c 6f 63 20 3d 3d 20 37  20 2a 2f 0a 20 20 20 20  |Loc == 7 */.    |
00001190  20 20 50 72 6f 63 5f 37  20 28 49 6e 74 5f 31 5f  |  Proc_7 (Int_1_|
000011a0  4c 6f 63 2c 20 49 6e 74  5f 32 5f 4c 6f 63 2c 20  |Loc, Int_2_Loc, |
000011b0  26 49 6e 74 5f 33 5f 4c  6f 63 29 3b 0a 20 20 20  |&Int_3_Loc);.   |
000011c0  20 20 20 20 20 2f 2a 20  49 6e 74 5f 33 5f 4c 6f  |     /* Int_3_Lo|
000011d0  63 20 3d 3d 20 37 20 2a  2f 0a 20 20 20 20 20 20  |c == 7 */.      |
000011e0  49 6e 74 5f 31 5f 4c 6f  63 20 2b 3d 20 31 3b 0a  |Int_1_Loc += 1;.|
000011f0  20 20 20 20 7d 20 2f 2a  20 77 68 69 6c 65 20 2a  |    } /* while *|
00001200  2f 0a 20 20 20 20 20 20  2f 2a 20 49 6e 74 5f 31  |/.      /* Int_1|
00001210  5f 4c 6f 63 20 3d 3d 20  33 2c 20 49 6e 74 5f 32  |_Loc == 3, Int_2|
00001220  5f 4c 6f 63 20 3d 3d 20  33 2c 20 49 6e 74 5f 33  |_Loc == 3, Int_3|
00001230  5f 4c 6f 63 20 3d 3d 20  37 20 2a 2f 0a 20 20 20  |_Loc == 7 */.   |
00001240  20 50 72 6f 63 5f 38 20  28 41 72 72 5f 31 5f 47  | Proc_8 (Arr_1_G|
00001250  6c 6f 62 2c 20 41 72 72  5f 32 5f 47 6c 6f 62 2c  |lob, Arr_2_Glob,|
00001260  20 49 6e 74 5f 31 5f 4c  6f 63 2c 20 49 6e 74 5f  | Int_1_Loc, Int_|
00001270  33 5f 4c 6f 63 29 3b 0a  20 20 20 20 20 20 2f 2a  |3_Loc);.      /*|
00001280  20 49 6e 74 5f 47 6c 6f  62 20 3d 3d 20 35 20 2a  | Int_Glob == 5 *|
00001290  2f 0a 20 20 20 20 50 72  6f 63 5f 31 20 28 50 74  |/.    Proc_1 (Pt|
000012a0  72 5f 47 6c 6f 62 29 3b  0a 20 20 20 20 66 6f 72  |r_Glob);.    for|
000012b0  20 28 43 68 5f 49 6e 64  65 78 20 3d 20 27 41 27  | (Ch_Index = 'A'|
000012c0  3b 20 43 68 5f 49 6e 64  65 78 20 3c 3d 20 43 68  |; Ch_Index <= Ch|
000012d0  5f 32 5f 47 6c 6f 62 3b  20 2b 2b 43 68 5f 49 6e  |_2_Glob; ++Ch_In|
000012e0  64 65 78 29 0a 20 20 20  20 20 20 20 20 20 20 20  |dex).           |
000012f0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001300  20 20 2f 2a 20 6c 6f 6f  70 20 62 6f 64 79 20 65  |  /* loop body e|
00001310  78 65 63 75 74 65 64 20  74 77 69 63 65 20 2a 2f  |xecuted twice */|
00001320  0a 20 20 20 20 7b 0a 20  20 20 20 20 20 69 66 20  |.    {.      if |
00001330  28 45 6e 75 6d 5f 4c 6f  63 20 3d 3d 20 46 75 6e  |(Enum_Loc == Fun|
00001340  63 5f 31 20 28 43 68 5f  49 6e 64 65 78 2c 20 27  |c_1 (Ch_Index, '|
00001350  43 27 29 29 0a 20 20 20  20 20 20 20 20 20 20 2f  |C')).          /|
00001360  2a 20 74 68 65 6e 2c 20  6e 6f 74 20 65 78 65 63  |* then, not exec|
00001370  75 74 65 64 20 2a 2f 0a  20 20 20 20 20 20 20 20  |uted */.        |
00001380  7b 0a 20 20 20 20 20 20  20 20 50 72 6f 63 5f 36  |{.        Proc_6|
00001390  20 28 49 64 65 6e 74 5f  31 2c 20 26 45 6e 75 6d  | (Ident_1, &Enum|
000013a0  5f 4c 6f 63 29 3b 0a 20  20 20 20 20 20 20 20 73  |_Loc);.        s|
000013b0  74 72 63 70 79 20 28 53  74 72 5f 32 5f 4c 6f 63  |trcpy (Str_2_Loc|
000013c0  2c 20 22 44 48 52 59 53  54 4f 4e 45 20 50 52 4f  |, "DHRYSTONE PRO|
000013d0  47 52 41 4d 2c 20 33 27  52 44 20 53 54 52 49 4e  |GRAM, 3'RD STRIN|
000013e0  47 22 29 3b 0a 20 20 20  20 20 20 20 20 49 6e 74  |G");.        Int|
000013f0  5f 32 5f 4c 6f 63 20 3d  20 52 75 6e 5f 49 6e 64  |_2_Loc = Run_Ind|
00001400  65 78 3b 0a 20 20 20 20  20 20 20 20 49 6e 74 5f  |ex;.        Int_|
00001410  47 6c 6f 62 20 3d 20 52  75 6e 5f 49 6e 64 65 78  |Glob = Run_Index|
00001420  3b 0a 20 20 20 20 20 20  20 20 7d 0a 20 20 20 20  |;.        }.    |
00001430  7d 0a 20 20 20 20 20 20  2f 2a 20 49 6e 74 5f 31  |}.      /* Int_1|
00001440  5f 4c 6f 63 20 3d 3d 20  33 2c 20 49 6e 74 5f 32  |_Loc == 3, Int_2|
00001450  5f 4c 6f 63 20 3d 3d 20  33 2c 20 49 6e 74 5f 33  |_Loc == 3, Int_3|
00001460  5f 4c 6f 63 20 3d 3d 20  37 20 2a 2f 0a 20 20 20  |_Loc == 7 */.   |
00001470  20 49 6e 74 5f 32 5f 4c  6f 63 20 3d 20 49 6e 74  | Int_2_Loc = Int|
00001480  5f 32 5f 4c 6f 63 20 2a  20 49 6e 74 5f 31 5f 4c  |_2_Loc * Int_1_L|
00001490  6f 63 3b 0a 20 20 20 20  49 6e 74 5f 31 5f 4c 6f  |oc;.    Int_1_Lo|
000014a0  63 20 3d 20 49 6e 74 5f  32 5f 4c 6f 63 20 2f 20  |c = Int_2_Loc / |
000014b0  49 6e 74 5f 33 5f 4c 6f  63 3b 0a 20 20 20 20 49  |Int_3_Loc;.    I|
000014c0  6e 74 5f 32 5f 4c 6f 63  20 3d 20 37 20 2a 20 28  |nt_2_Loc = 7 * (|
000014d0  49 6e 74 5f 32 5f 4c 6f  63 20 2d 20 49 6e 74 5f  |Int_2_Loc - Int_|
000014e0  33 5f 4c 6f 63 29 20 2d  20 49 6e 74 5f 31 5f 4c  |3_Loc) - Int_1_L|
000014f0  6f 63 3b 0a 20 20 20 20  20 20 2f 2a 20 49 6e 74  |oc;.      /* Int|
00001500  5f 31 5f 4c 6f 63 20 3d  3d 20 31 2c 20 49 6e 74  |_1_Loc == 1, Int|
00001510  5f 32 5f 4c 6f 63 20 3d  3d 20 31 33 2c 20 49 6e  |_2_Loc == 13, In|
00001520  74 5f 33 5f 4c 6f 63 20  3d 3d 20 37 20 2a 2f 0a  |t_3_Loc == 7 */.|
00001530  20 20 20 20 50 72 6f 63  5f 32 20 28 26 49 6e 74  |    Proc_2 (&Int|
00001540  5f 31 5f 4c 6f 63 29 3b  0a 20 20 20 20 20 20 2f  |_1_Loc);.      /|
00001550  2a 20 49 6e 74 5f 31 5f  4c 6f 63 20 3d 3d 20 35  |* Int_1_Loc == 5|
00001560  20 2a 2f 0a 0a 20 20 7d  20 2f 2a 20 6c 6f 6f 70  | */..  } /* loop|
00001570  20 22 66 6f 72 20 52 75  6e 5f 49 6e 64 65 78 22  | "for Run_Index"|
00001580  20 2a 2f 0a 0a 20 20 2f  2a 2a 2a 2a 2a 2a 2a 2a  | */..  /********|
00001590  2a 2a 2a 2a 2a 2a 2f 0a  20 20 2f 2a 20 53 74 6f  |******/.  /* Sto|
000015a0  70 20 74 69 6d 65 72 20  2a 2f 0a 20 20 2f 2a 2a  |p timer */.  /**|
000015b0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2f 0a 20 20  |************/.  |
000015c0  0a 23 69 66 64 65 66 20  54 49 4d 45 53 0a 20 20  |.#ifdef TIMES.  |
000015d0  74 69 6d 65 73 20 28 26  74 69 6d 65 5f 69 6e 66  |times (&time_inf|
000015e0  6f 29 3b 0a 20 20 45 6e  64 5f 54 69 6d 65 20 3d  |o);.  End_Time =|
000015f0  20 28 6c 6f 6e 67 29 20  74 69 6d 65 5f 69 6e 66  | (long) time_inf|
00001600  6f 2e 74 6d 73 5f 75 74  69 6d 65 3b 0a 23 65 6e  |o.tms_utime;.#en|
00001610  64 69 66 0a 23 69 66 64  65 66 20 54 49 4d 45 0a  |dif.#ifdef TIME.|
00001620  20 20 45 6e 64 5f 54 69  6d 65 20 3d 20 74 69 6d  |  End_Time = tim|
00001630  65 20 28 20 28 6c 6f 6e  67 20 2a 29 20 30 29 3b  |e ( (long *) 0);|
00001640  0a 23 65 6e 64 69 66 0a  23 69 66 64 65 66 20 4d  |.#endif.#ifdef M|
00001650  53 43 5f 43 4c 4f 43 4b  0a 20 20 45 6e 64 5f 54  |SC_CLOCK.  End_T|
00001660  69 6d 65 20 3d 20 63 6c  6f 63 6b 28 29 3b 0a 23  |ime = clock();.#|
00001670  65 6e 64 69 66 0a 0a 23  69 66 6e 64 65 66 20 53  |endif..#ifndef S|
00001680  49 4c 45 4e 54 0a 20 20  70 72 69 6e 74 66 20 28  |ILENT.  printf (|
00001690  22 45 78 65 63 75 74 69  6f 6e 20 65 6e 64 73 5c  |"Execution ends\|
000016a0  6e 22 29 3b 0a 20 20 70  72 69 6e 74 66 20 28 22  |n");.  printf ("|
000016b0  5c 6e 22 29 3b 0a 20 20  70 72 69 6e 74 66 20 28  |\n");.  printf (|
000016c0  22 46 69 6e 61 6c 20 76  61 6c 75 65 73 20 6f 66  |"Final values of|
000016d0  20 74 68 65 20 76 61 72  69 61 62 6c 65 73 20 75  | the variables u|
000016e0  73 65 64 20 69 6e 20 74  68 65 20 62 65 6e 63 68  |sed in the bench|
000016f0  6d 61 72 6b 3a 5c 6e 22  29 3b 0a 20 20 70 72 69  |mark:\n");.  pri|
00001700  6e 74 66 20 28 22 5c 6e  22 29 3b 0a 20 20 70 72  |ntf ("\n");.  pr|
00001710  69 6e 74 66 20 28 22 49  6e 74 5f 47 6c 6f 62 3a  |intf ("Int_Glob:|
00001720  20 20 20 20 20 20 20 20  20 20 20 20 25 64 5c 6e  |            %d\n|
00001730  22 2c 20 49 6e 74 5f 47  6c 6f 62 29 3b 0a 20 20  |", Int_Glob);.  |
00001740  70 72 69 6e 74 66 20 28  22 20 20 20 20 20 20 20  |printf ("       |
00001750  20 73 68 6f 75 6c 64 20  62 65 3a 20 20 20 25 64  | should be:   %d|
00001760  5c 6e 22 2c 20 35 29 3b  0a 20 20 70 72 69 6e 74  |\n", 5);.  print|
00001770  66 20 28 22 42 6f 6f 6c  5f 47 6c 6f 62 3a 20 20  |f ("Bool_Glob:  |
00001780  20 20 20 20 20 20 20 20  20 25 64 5c 6e 22 2c 20  |         %d\n", |
00001790  42 6f 6f 6c 5f 47 6c 6f  62 29 3b 0a 20 20 70 72  |Bool_Glob);.  pr|
000017a0  69 6e 74 66 20 28 22 20  20 20 20 20 20 20 20 73  |intf ("        s|
000017b0  68 6f 75 6c 64 20 62 65  3a 20 20 20 25 64 5c 6e  |hould be:   %d\n|
000017c0  22 2c 20 31 29 3b 0a 20  20 70 72 69 6e 74 66 20  |", 1);.  printf |
000017d0  28 22 43 68 5f 31 5f 47  6c 6f 62 3a 20 20 20 20  |("Ch_1_Glob:    |
000017e0  20 20 20 20 20 20 20 25  63 5c 6e 22 2c 20 43 68  |       %c\n", Ch|
000017f0  5f 31 5f 47 6c 6f 62 29  3b 0a 20 20 70 72 69 6e  |_1_Glob);.  prin|
00001800  74 66 20 28 22 20 20 20  20 20 20 20 20 73 68 6f  |tf ("        sho|
00001810  75 6c 64 20 62 65 3a 20  20 20 25 63 5c 6e 22 2c  |uld be:   %c\n",|
00001820  20 27 41 27 29 3b 0a 20  20 70 72 69 6e 74 66 20  | 'A');.  printf |
00001830  28 22 43 68 5f 32 5f 47  6c 6f 62 3a 20 20 20 20  |("Ch_2_Glob:    |
00001840  20 20 20 20 20 20 20 25  63 5c 6e 22 2c 20 43 68  |       %c\n", Ch|
00001850  5f 32 5f 47 6c 6f 62 29  3b 0a 20 20 70 72 69 6e  |_2_Glob);.  prin|
00001860  74 66 20 28 22 20 20 20  20 20 20 20 20 73 68 6f  |tf ("        sho|
00001870  75 6c 64 20 62 65 3a 20  20 20 25 63 5c 6e 22 2c  |uld be:   %c\n",|
00001880  20 27 42 27 29 3b 0a 20  20 70 72 69 6e 74 66 20  | 'B');.  printf |
00001890  28 22 41 72 72 5f 31 5f  47 6c 6f 62 5b 38 5d 3a  |("Arr_1_Glob[8]:|
000018a0  20 20 20 20 20 20 20 25  64 5c 6e 22 2c 20 41 72  |       %d\n", Ar|
000018b0  72 5f 31 5f 47 6c 6f 62  5b 38 5d 29 3b 0a 20 20  |r_1_Glob[8]);.  |
000018c0  70 72 69 6e 74 66 20 28  22 20 20 20 20 20 20 20  |printf ("       |
000018d0  20 73 68 6f 75 6c 64 20  62 65 3a 20 20 20 25 64  | should be:   %d|
000018e0  5c 6e 22 2c 20 37 29 3b  0a 20 20 70 72 69 6e 74  |\n", 7);.  print|
000018f0  66 20 28 22 41 72 72 5f  32 5f 47 6c 6f 62 5b 38  |f ("Arr_2_Glob[8|
00001900  5d 5b 37 5d 3a 20 20 20  20 25 64 5c 6e 22 2c 20  |][7]:    %d\n", |
00001910  41 72 72 5f 32 5f 47 6c  6f 62 5b 38 5d 5b 37 5d  |Arr_2_Glob[8][7]|
00001920  29 3b 0a 20 20 70 72 69  6e 74 66 20 28 22 20 20  |);.  printf ("  |
00001930  20 20 20 20 20 20 73 68  6f 75 6c 64 20 62 65 3a  |      should be:|
00001940  20 20 20 4e 75 6d 62 65  72 5f 4f 66 5f 52 75 6e  |   Number_Of_Run|
00001950  73 20 2b 20 31 30 5c 6e  22 29 3b 0a 20 20 70 72  |s + 10\n");.  pr|
00001960  69 6e 74 66 20 28 22 50  74 72 5f 47 6c 6f 62 2d  |intf ("Ptr_Glob-|
00001970  3e 5c 6e 22 29 3b 0a 20  20 70 72 69 6e 74 66 20  |>\n");.  printf |
00001980  28 22 20 20 50 74 72 5f  43 6f 6d 70 3a 20 20 20  |("  Ptr_Comp:   |
00001990  20 20 20 20 20 20 20 25  64 5c 6e 22 2c 20 28 69  |       %d\n", (i|
000019a0  6e 74 29 20 50 74 72 5f  47 6c 6f 62 2d 3e 50 74  |nt) Ptr_Glob->Pt|
000019b0  72 5f 43 6f 6d 70 29 3b  0a 20 20 70 72 69 6e 74  |r_Comp);.  print|
000019c0  66 20 28 22 20 20 20 20  20 20 20 20 73 68 6f 75  |f ("        shou|
000019d0  6c 64 20 62 65 3a 20 20  20 28 69 6d 70 6c 65 6d  |ld be:   (implem|
000019e0  65 6e 74 61 74 69 6f 6e  2d 64 65 70 65 6e 64 65  |entation-depende|
000019f0  6e 74 29 5c 6e 22 29 3b  0a 20 20 70 72 69 6e 74  |nt)\n");.  print|
00001a00  66 20 28 22 20 20 44 69  73 63 72 3a 20 20 20 20  |f ("  Discr:    |
00001a10  20 20 20 20 20 20 20 20  20 25 64 5c 6e 22 2c 20  |         %d\n", |
00001a20  50 74 72 5f 47 6c 6f 62  2d 3e 44 69 73 63 72 29  |Ptr_Glob->Discr)|
00001a30  3b 0a 20 20 70 72 69 6e  74 66 20 28 22 20 20 20  |;.  printf ("   |
00001a40  20 20 20 20 20 73 68 6f  75 6c 64 20 62 65 3a 20  |     should be: |
00001a50  20 20 25 64 5c 6e 22 2c  20 30 29 3b 0a 20 20 70  |  %d\n", 0);.  p|
00001a60  72 69 6e 74 66 20 28 22  20 20 45 6e 75 6d 5f 43  |rintf ("  Enum_C|
00001a70  6f 6d 70 3a 20 20 20 20  20 20 20 20 20 25 64 5c  |omp:         %d\|
00001a80  6e 22 2c 20 50 74 72 5f  47 6c 6f 62 2d 3e 76 61  |n", Ptr_Glob->va|
00001a90  72 69 61 6e 74 2e 76 61  72 5f 31 2e 45 6e 75 6d  |riant.var_1.Enum|
00001aa0  5f 43 6f 6d 70 29 3b 0a  20 20 70 72 69 6e 74 66  |_Comp);.  printf|
00001ab0  20 28 22 20 20 20 20 20  20 20 20 73 68 6f 75 6c  | ("        shoul|
00001ac0  64 20 62 65 3a 20 20 20  25 64 5c 6e 22 2c 20 32  |d be:   %d\n", 2|
00001ad0  29 3b 0a 20 20 70 72 69  6e 74 66 20 28 22 20 20  |);.  printf ("  |
00001ae0  49 6e 74 5f 43 6f 6d 70  3a 20 20 20 20 20 20 20  |Int_Comp:       |
00001af0  20 20 20 25 64 5c 6e 22  2c 20 50 74 72 5f 47 6c  |   %d\n", Ptr_Gl|
00001b00  6f 62 2d 3e 76 61 72 69  61 6e 74 2e 76 61 72 5f  |ob->variant.var_|
00001b10  31 2e 49 6e 74 5f 43 6f  6d 70 29 3b 0a 20 20 70  |1.Int_Comp);.  p|
00001b20  72 69 6e 74 66 20 28 22  20 20 20 20 20 20 20 20  |rintf ("        |
00001b30  73 68 6f 75 6c 64 20 62  65 3a 20 20 20 25 64 5c  |should be:   %d\|
00001b40  6e 22 2c 20 31 37 29 3b  0a 20 20 70 72 69 6e 74  |n", 17);.  print|
00001b50  66 20 28 22 20 20 53 74  72 5f 43 6f 6d 70 3a 20  |f ("  Str_Comp: |
00001b60  20 20 20 20 20 20 20 20  20 25 73 5c 6e 22 2c 20  |         %s\n", |
00001b70  50 74 72 5f 47 6c 6f 62  2d 3e 76 61 72 69 61 6e  |Ptr_Glob->varian|
00001b80  74 2e 76 61 72 5f 31 2e  53 74 72 5f 43 6f 6d 70  |t.var_1.Str_Comp|
00001b90  29 3b 0a 20 20 70 72 69  6e 74 66 20 28 22 20 20  |);.  printf ("  |
00001ba0  20 20 20 20 20 20 73 68  6f 75 6c 64 20 62 65 3a  |      should be:|
00001bb0  20 20 20 44 48 52 59 53  54 4f 4e 45 20 50 52 4f  |   DHRYSTONE PRO|
00001bc0  47 52 41 4d 2c 20 53 4f  4d 45 20 53 54 52 49 4e  |GRAM, SOME STRIN|
00001bd0  47 5c 6e 22 29 3b 0a 20  20 70 72 69 6e 74 66 20  |G\n");.  printf |
00001be0  28 22 4e 65 78 74 5f 50  74 72 5f 47 6c 6f 62 2d  |("Next_Ptr_Glob-|
00001bf0  3e 5c 6e 22 29 3b 0a 20  20 70 72 69 6e 74 66 20  |>\n");.  printf |
00001c00  28 22 20 20 50 74 72 5f  43 6f 6d 70 3a 20 20 20  |("  Ptr_Comp:   |
00001c10  20 20 20 20 20 20 20 25  64 5c 6e 22 2c 20 28 69  |       %d\n", (i|
00001c20  6e 74 29 20 4e 65 78 74  5f 50 74 72 5f 47 6c 6f  |nt) Next_Ptr_Glo|
00001c30  62 2d 3e 50 74 72 5f 43  6f 6d 70 29 3b 0a 20 20  |b->Ptr_Comp);.  |
00001c40  70 72 69 6e 74 66 20 28  22 20 20 20 20 20 20 20  |printf ("       |
00001c50  20 73 68 6f 75 6c 64 20  62 65 3a 20 20 20 28 69  | should be:   (i|
00001c60  6d 70 6c 65 6d 65 6e 74  61 74 69 6f 6e 2d 64 65  |mplementation-de|
00001c70  70 65 6e 64 65 6e 74 29  2c 20 73 61 6d 65 20 61  |pendent), same a|
00001c80  73 20 61 62 6f 76 65 5c  6e 22 29 3b 0a 20 20 70  |s above\n");.  p|
00001c90  72 69 6e 74 66 20 28 22  20 20 44 69 73 63 72 3a  |rintf ("  Discr:|
00001ca0  20 20 20 20 20 20 20 20  20 20 20 20 20 25 64 5c  |             %d\|
00001cb0  6e 22 2c 20 4e 65 78 74  5f 50 74 72 5f 47 6c 6f  |n", Next_Ptr_Glo|
00001cc0  62 2d 3e 44 69 73 63 72  29 3b 0a 20 20 70 72 69  |b->Discr);.  pri|
00001cd0  6e 74 66 20 28 22 20 20  20 20 20 20 20 20 73 68  |ntf ("        sh|
00001ce0  6f 75 6c 64 20 62 65 3a  20 20 20 25 64 5c 6e 22  |ould be:   %d\n"|
00001cf0  2c 20 30 29 3b 0a 20 20  70 72 69 6e 74 66 20 28  |, 0);.  printf (|
00001d00  22 20 20 45 6e 75 6d 5f  43 6f 6d 70 3a 20 20 20  |"  Enum_Comp:   |
00001d10  20 20 20 20 20 20 25 64  5c 6e 22 2c 20 4e 65 78  |      %d\n", Nex|
00001d20  74 5f 50 74 72 5f 47 6c  6f 62 2d 3e 76 61 72 69  |t_Ptr_Glob->vari|
00001d30  61 6e 74 2e 76 61 72 5f  31 2e 45 6e 75 6d 5f 43  |ant.var_1.Enum_C|
00001d40  6f 6d 70 29 3b 0a 20 20  70 72 69 6e 74 66 20 28  |omp);.  printf (|
00001d50  22 20 20 20 20 20 20 20  20 73 68 6f 75 6c 64 20  |"        should |
00001d60  62 65 3a 20 20 20 25 64  5c 6e 22 2c 20 31 29 3b  |be:   %d\n", 1);|
00001d70  0a 20 20 70 72 69 6e 74  66 20 28 22 20 20 49 6e  |.  printf ("  In|
00001d80  74 5f 43 6f 6d 70 3a 20  20 20 20 20 20 20 20 20  |t_Comp:         |
00001d90  20 25 64 5c 6e 22 2c 20  4e 65 78 74 5f 50 74 72  | %d\n", Next_Ptr|
00001da0  5f 47 6c 6f 62 2d 3e 76  61 72 69 61 6e 74 2e 76  |_Glob->variant.v|
00001db0  61 72 5f 31 2e 49 6e 74  5f 43 6f 6d 70 29 3b 0a  |ar_1.Int_Comp);.|
00001dc0  20 20 70 72 69 6e 74 66  20 28 22 20 20 20 20 20  |  printf ("     |
00001dd0  20 20 20 73 68 6f 75 6c  64 20 62 65 3a 20 20 20  |   should be:   |
00001de0  25 64 5c 6e 22 2c 20 31  38 29 3b 0a 20 20 70 72  |%d\n", 18);.  pr|
00001df0  69 6e 74 66 20 28 22 20  20 53 74 72 5f 43 6f 6d  |intf ("  Str_Com|
00001e00  70 3a 20 20 20 20 20 20  20 20 20 20 25 73 5c 6e  |p:          %s\n|
00001e10  22 2c 0a 20 20 20 20 20  20 20 20 20 20 20 20 20  |",.             |
00001e20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001e30  20 20 20 4e 65 78 74 5f  50 74 72 5f 47 6c 6f 62  |   Next_Ptr_Glob|
00001e40  2d 3e 76 61 72 69 61 6e  74 2e 76 61 72 5f 31 2e  |->variant.var_1.|
00001e50  53 74 72 5f 43 6f 6d 70  29 3b 0a 20 20 70 72 69  |Str_Comp);.  pri|
00001e60  6e 74 66 20 28 22 20 20  20 20 20 20 20 20 73 68  |ntf ("        sh|
00001e70  6f 75 6c 64 20 62 65 3a  20 20 20 44 48 52 59 53  |ould be:   DHRYS|
00001e80  54 4f 4e 45 20 50 52 4f  47 52 41 4d 2c 20 53 4f  |TONE PROGRAM, SO|
00001e90  4d 45 20 53 54 52 49 4e  47 5c 6e 22 29 3b 0a 20  |ME STRING\n");. |
00001ea0  20 70 72 69 6e 74 66 20  28 22 49 6e 74 5f 31 5f  | printf ("Int_1_|
00001eb0  4c 6f 63 3a 20 20 20 20  20 20 20 20 20 20 20 25  |Loc:           %|
00001ec0  64 5c 6e 22 2c 20 49 6e  74 5f 31 5f 4c 6f 63 29  |d\n", Int_1_Loc)|
00001ed0  3b 0a 20 20 70 72 69 6e  74 66 20 28 22 20 20 20  |;.  printf ("   |
00001ee0  20 20 20 20 20 73 68 6f  75 6c 64 20 62 65 3a 20  |     should be: |
00001ef0  20 20 25 64 5c 6e 22 2c  20 35 29 3b 0a 20 20 70  |  %d\n", 5);.  p|
00001f00  72 69 6e 74 66 20 28 22  49 6e 74 5f 32 5f 4c 6f  |rintf ("Int_2_Lo|
00001f10  63 3a 20 20 20 20 20 20  20 20 20 20 20 25 64 5c  |c:           %d\|
00001f20  6e 22 2c 20 49 6e 74 5f  32 5f 4c 6f 63 29 3b 0a  |n", Int_2_Loc);.|
00001f30  20 20 70 72 69 6e 74 66  20 28 22 20 20 20 20 20  |  printf ("     |
00001f40  20 20 20 73 68 6f 75 6c  64 20 62 65 3a 20 20 20  |   should be:   |
00001f50  25 64 5c 6e 22 2c 20 31  33 29 3b 0a 20 20 70 72  |%d\n", 13);.  pr|
00001f60  69 6e 74 66 20 28 22 49  6e 74 5f 33 5f 4c 6f 63  |intf ("Int_3_Loc|
00001f70  3a 20 20 20 20 20 20 20  20 20 20 20 25 64 5c 6e  |:           %d\n|
00001f80  22 2c 20 49 6e 74 5f 33  5f 4c 6f 63 29 3b 0a 20  |", Int_3_Loc);. |
00001f90  20 70 72 69 6e 74 66 20  28 22 20 20 20 20 20 20  | printf ("      |
00001fa0  20 20 73 68 6f 75 6c 64  20 62 65 3a 20 20 20 25  |  should be:   %|
00001fb0  64 5c 6e 22 2c 20 37 29  3b 0a 20 20 70 72 69 6e  |d\n", 7);.  prin|
00001fc0  74 66 20 28 22 45 6e 75  6d 5f 4c 6f 63 3a 20 20  |tf ("Enum_Loc:  |
00001fd0  20 20 20 20 20 20 20 20  20 20 25 64 5c 6e 22 2c  |          %d\n",|
00001fe0  20 45 6e 75 6d 5f 4c 6f  63 29 3b 0a 20 20 70 72  | Enum_Loc);.  pr|
00001ff0  69 6e 74 66 20 28 22 20  20 20 20 20 20 20 20 73  |intf ("        s|
00002000  68 6f 75 6c 64 20 62 65  3a 20 20 20 25 64 5c 6e  |hould be:   %d\n|
00002010  22 2c 20 31 29 3b 0a 20  20 70 72 69 6e 74 66 20  |", 1);.  printf |
00002020  28 22 53 74 72 5f 31 5f  4c 6f 63 3a 20 20 20 20  |("Str_1_Loc:    |
00002030  20 20 20 20 20 20 20 25  73 5c 6e 22 2c 20 53 74  |       %s\n", St|
00002040  72 5f 31 5f 4c 6f 63 29  3b 0a 20 20 70 72 69 6e  |r_1_Loc);.  prin|
00002050  74 66 20 28 22 20 20 20  20 20 20 20 20 73 68 6f  |tf ("        sho|
00002060  75 6c 64 20 62 65 3a 20  20 20 44 48 52 59 53 54  |uld be:   DHRYST|
00002070  4f 4e 45 20 50 52 4f 47  52 41 4d 2c 20 31 27 53  |ONE PROGRAM, 1'S|
00002080  54 20 53 54 52 49 4e 47  5c 6e 22 29 3b 0a 20 20  |T STRING\n");.  |
00002090  70 72 69 6e 74 66 20 28  22 53 74 72 5f 32 5f 4c  |printf ("Str_2_L|
000020a0  6f 63 3a 20 20 20 20 20  20 20 20 20 20 20 25 73  |oc:           %s|
000020b0  5c 6e 22 2c 20 53 74 72  5f 32 5f 4c 6f 63 29 3b  |\n", Str_2_Loc);|
000020c0  0a 20 20 70 72 69 6e 74  66 20 28 22 20 20 20 20  |.  printf ("    |
000020d0  20 20 20 20 73 68 6f 75  6c 64 20 62 65 3a 20 20  |    should be:  |
000020e0  20 44 48 52 59 53 54 4f  4e 45 20 50 52 4f 47 52  | DHRYSTONE PROGR|
000020f0  41 4d 2c 20 32 27 4e 44  20 53 54 52 49 4e 47 5c  |AM, 2'ND STRING\|
00002100  6e 22 29 3b 0a 20 20 70  72 69 6e 74 66 20 28 22  |n");.  printf ("|
00002110  5c 6e 22 29 3b 0a 23 65  6e 64 69 66 0a 0a 20 20  |\n");.#endif..  |
00002120  55 73 65 72 5f 54 69 6d  65 20 3d 20 45 6e 64 5f  |User_Time = End_|
00002130  54 69 6d 65 20 2d 20 42  65 67 69 6e 5f 54 69 6d  |Time - Begin_Tim|
00002140  65 3b 0a 0a 20 20 69 66  20 28 55 73 65 72 5f 54  |e;..  if (User_T|
00002150  69 6d 65 20 3c 20 54 6f  6f 5f 53 6d 61 6c 6c 5f  |ime < Too_Small_|
00002160  54 69 6d 65 29 0a 20 20  7b 0a 23 69 66 6e 64 65  |Time).  {.#ifnde|
00002170  66 20 53 49 4c 45 4e 54  0a 20 20 20 20 70 72 69  |f SILENT.    pri|
00002180  6e 74 66 20 28 22 4d 65  61 73 75 72 65 64 20 74  |ntf ("Measured t|
00002190  69 6d 65 20 74 6f 6f 20  73 6d 61 6c 6c 20 74 6f  |ime too small to|
000021a0  20 6f 62 74 61 69 6e 20  6d 65 61 6e 69 6e 67 66  | obtain meaningf|
000021b0  75 6c 20 72 65 73 75 6c  74 73 5c 6e 22 29 3b 0a  |ul results\n");.|
000021c0  20 20 20 20 70 72 69 6e  74 66 20 28 22 50 6c 65  |    printf ("Ple|
000021d0  61 73 65 20 69 6e 63 72  65 61 73 65 20 6e 75 6d  |ase increase num|
000021e0  62 65 72 20 6f 66 20 72  75 6e 73 5c 6e 22 29 3b  |ber of runs\n");|
000021f0  0a 20 20 20 20 70 72 69  6e 74 66 20 28 22 5c 6e  |.    printf ("\n|
00002200  22 29 3b 0a 23 65 6c 73  65 0a 20 20 20 20 73 79  |");.#else.    sy|
00002210  73 74 65 6d 28 22 55 6e  53 65 74 20 41 72 6d 53  |stem("UnSet ArmS|
00002220  49 24 44 68 72 79 73 74  6f 6e 65 22 29 3b 0a 23  |I$Dhrystone");.#|
00002230  65 6e 64 69 66 0a 20 20  7d 0a 20 20 65 6c 73 65  |endif.  }.  else|
00002240  0a 20 20 7b 0a 23 69 66  64 65 66 20 54 49 4d 45  |.  {.#ifdef TIME|
00002250  0a 20 20 20 20 4d 69 63  72 6f 73 65 63 6f 6e 64  |.    Microsecond|
00002260  73 20 3d 20 28 66 6c 6f  61 74 29 20 55 73 65 72  |s = (float) User|
00002270  5f 54 69 6d 65 20 2a 20  4d 69 63 5f 73 65 63 73  |_Time * Mic_secs|
00002280  5f 50 65 72 5f 53 65 63  6f 6e 64 20 0a 20 20 20  |_Per_Second .   |
00002290  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000022a0  20 20 20 20 20 2f 20 28  66 6c 6f 61 74 29 20 4e  |     / (float) N|
000022b0  75 6d 62 65 72 5f 4f 66  5f 52 75 6e 73 3b 0a 20  |umber_Of_Runs;. |
000022c0  20 20 20 44 68 72 79 73  74 6f 6e 65 73 5f 50 65  |   Dhrystones_Pe|
000022d0  72 5f 53 65 63 6f 6e 64  20 3d 20 28 66 6c 6f 61  |r_Second = (floa|
000022e0  74 29 20 4e 75 6d 62 65  72 5f 4f 66 5f 52 75 6e  |t) Number_Of_Run|
000022f0  73 20 2f 20 28 66 6c 6f  61 74 29 20 55 73 65 72  |s / (float) User|
00002300  5f 54 69 6d 65 3b 0a 23  65 6c 73 65 0a 20 20 20  |_Time;.#else.   |
00002310  20 4d 69 63 72 6f 73 65  63 6f 6e 64 73 20 3d 20  | Microseconds = |
00002320  28 66 6c 6f 61 74 29 20  55 73 65 72 5f 54 69 6d  |(float) User_Tim|
00002330  65 20 2a 20 4d 69 63 5f  73 65 63 73 5f 50 65 72  |e * Mic_secs_Per|
00002340  5f 53 65 63 6f 6e 64 20  0a 20 20 20 20 20 20 20  |_Second .       |
00002350  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002360  20 2f 20 28 28 66 6c 6f  61 74 29 20 48 5a 20 2a  | / ((float) HZ *|
00002370  20 28 28 66 6c 6f 61 74  29 20 4e 75 6d 62 65 72  | ((float) Number|
00002380  5f 4f 66 5f 52 75 6e 73  29 29 3b 0a 20 20 20 20  |_Of_Runs));.    |
00002390  44 68 72 79 73 74 6f 6e  65 73 5f 50 65 72 5f 53  |Dhrystones_Per_S|
000023a0  65 63 6f 6e 64 20 3d 20  28 28 66 6c 6f 61 74 29  |econd = ((float)|
000023b0  20 48 5a 20 2a 20 28 66  6c 6f 61 74 29 20 4e 75  | HZ * (float) Nu|
000023c0  6d 62 65 72 5f 4f 66 5f  52 75 6e 73 29 0a 20 20  |mber_Of_Runs).  |
000023d0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000023e0  20 20 20 20 20 20 2f 20  28 66 6c 6f 61 74 29 20  |      / (float) |
000023f0  55 73 65 72 5f 54 69 6d  65 3b 0a 23 65 6e 64 69  |User_Time;.#endi|
00002400  66 0a 23 69 66 6e 64 65  66 20 53 49 4c 45 4e 54  |f.#ifndef SILENT|
00002410  0a 20 20 20 20 70 72 69  6e 74 66 20 28 22 4d 69  |.    printf ("Mi|
00002420  63 72 6f 73 65 63 6f 6e  64 73 20 66 6f 72 20 6f  |croseconds for o|
00002430  6e 65 20 72 75 6e 20 74  68 72 6f 75 67 68 20 44  |ne run through D|
00002440  68 72 79 73 74 6f 6e 65  3a 20 22 29 3b 0a 20 20  |hrystone: ");.  |
00002450  20 20 70 72 69 6e 74 66  20 28 22 25 36 2e 31 66  |  printf ("%6.1f|
00002460  20 5c 6e 22 2c 20 4d 69  63 72 6f 73 65 63 6f 6e  | \n", Microsecon|
00002470  64 73 29 3b 0a 20 20 20  20 70 72 69 6e 74 66 20  |ds);.    printf |
00002480  28 22 44 68 72 79 73 74  6f 6e 65 73 20 70 65 72  |("Dhrystones per|
00002490  20 53 65 63 6f 6e 64 3a  20 20 20 20 20 20 20 20  | Second:        |
000024a0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 22 29  |              ")|
000024b0  3b 0a 20 20 20 20 70 72  69 6e 74 66 20 28 22 25  |;.    printf ("%|
000024c0  36 2e 31 66 20 5c 6e 22  2c 20 44 68 72 79 73 74  |6.1f \n", Dhryst|
000024d0  6f 6e 65 73 5f 50 65 72  5f 53 65 63 6f 6e 64 29  |ones_Per_Second)|
000024e0  3b 0a 20 20 20 20 70 72  69 6e 74 66 20 28 22 5c  |;.    printf ("\|
000024f0  6e 22 29 3b 0a 23 65 6c  73 65 0a 20 20 20 20 7b  |n");.#else.    {|
00002500  20 63 68 61 72 20 2a 74  69 6d 69 6e 67 3b 0a 20  | char *timing;. |
00002510  20 20 20 20 20 73 70 72  69 6e 74 66 28 74 69 6d  |     sprintf(tim|
00002520  69 6e 67 2c 20 22 53 65  74 20 41 72 6d 53 49 24  |ing, "Set ArmSI$|
00002530  44 68 72 79 73 74 6f 6e  65 20 25 36 2e 31 66 20  |Dhrystone %6.1f |
00002540  25 36 2e 31 66 22 2c 20  4d 69 63 72 6f 73 65 63  |%6.1f", Microsec|
00002550  6f 6e 64 73 2c 20 44 68  72 79 73 74 6f 6e 65 73  |onds, Dhrystones|
00002560  5f 50 65 72 5f 53 65 63  6f 6e 64 29 3b 0a 20 20  |_Per_Second);.  |
00002570  20 20 20 20 73 79 73 74  65 6d 28 74 69 6d 69 6e  |    system(timin|
00002580  67 29 3b 0a 20 20 20 20  7d 0a 23 65 6e 64 69 66  |g);.    }.#endif|
00002590  0a 20 20 7d 0a 20 20 0a  7d 0a 0a 0a 50 72 6f 63  |.  }.  .}...Proc|
000025a0  5f 31 20 28 50 74 72 5f  56 61 6c 5f 50 61 72 29  |_1 (Ptr_Val_Par)|
000025b0  0a 2f 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |./**************|
000025c0  2a 2a 2a 2a 2f 0a 0a 52  45 47 20 52 65 63 5f 50  |****/..REG Rec_P|
000025d0  6f 69 6e 74 65 72 20 50  74 72 5f 56 61 6c 5f 50  |ointer Ptr_Val_P|
000025e0  61 72 3b 0a 20 20 20 20  2f 2a 20 65 78 65 63 75  |ar;.    /* execu|
000025f0  74 65 64 20 6f 6e 63 65  20 2a 2f 0a 7b 0a 20 20  |ted once */.{.  |
00002600  52 45 47 20 52 65 63 5f  50 6f 69 6e 74 65 72 20  |REG Rec_Pointer |
00002610  4e 65 78 74 5f 52 65 63  6f 72 64 20 3d 20 50 74  |Next_Record = Pt|
00002620  72 5f 56 61 6c 5f 50 61  72 2d 3e 50 74 72 5f 43  |r_Val_Par->Ptr_C|
00002630  6f 6d 70 3b 20 20 0a 20  20 20 20 20 20 20 20 20  |omp;  .         |
00002640  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00002650  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 2f  |               /|
00002660  2a 20 3d 3d 20 50 74 72  5f 47 6c 6f 62 5f 4e 65  |* == Ptr_Glob_Ne|
00002670  78 74 20 2a 2f 0a 20 20  2f 2a 20 4c 6f 63 61 6c  |xt */.  /* Local|
00002680  20 76 61 72 69 61 62 6c  65 2c 20 69 6e 69 74 69  | variable, initi|
00002690  61 6c 69 7a 65 64 20 77  69 74 68 20 50 74 72 5f  |alized with Ptr_|
000026a0  56 61 6c 5f 50 61 72 2d  3e 50 74 72 5f 43 6f 6d  |Val_Par->Ptr_Com|
000026b0  70 2c 20 20 20 20 2a 2f  0a 20 20 2f 2a 20 63 6f  |p,    */.  /* co|
000026c0  72 72 65 73 70 6f 6e 64  73 20 74 6f 20 22 72 65  |rresponds to "re|
000026d0  6e 61 6d 65 22 20 69 6e  20 41 64 61 2c 20 22 77  |name" in Ada, "w|
000026e0  69 74 68 22 20 69 6e 20  50 61 73 63 61 6c 20 20  |ith" in Pascal  |
000026f0  20 20 20 20 20 20 20 20  20 2a 2f 0a 20 20 0a 20  |         */.  . |
00002700  20 73 74 72 75 63 74 61  73 73 69 67 6e 20 28 2a  | structassign (*|
00002710  50 74 72 5f 56 61 6c 5f  50 61 72 2d 3e 50 74 72  |Ptr_Val_Par->Ptr|
00002720  5f 43 6f 6d 70 2c 20 2a  50 74 72 5f 47 6c 6f 62  |_Comp, *Ptr_Glob|
00002730  29 3b 20 0a 20 20 50 74  72 5f 56 61 6c 5f 50 61  |); .  Ptr_Val_Pa|
00002740  72 2d 3e 76 61 72 69 61  6e 74 2e 76 61 72 5f 31  |r->variant.var_1|
00002750  2e 49 6e 74 5f 43 6f 6d  70 20 3d 20 35 3b 0a 20  |.Int_Comp = 5;. |
00002760  20 4e 65 78 74 5f 52 65  63 6f 72 64 2d 3e 76 61  | Next_Record->va|
00002770  72 69 61 6e 74 2e 76 61  72 5f 31 2e 49 6e 74 5f  |riant.var_1.Int_|
00002780  43 6f 6d 70 20 0a 20 20  20 20 20 20 20 20 3d 20  |Comp .        = |
00002790  50 74 72 5f 56 61 6c 5f  50 61 72 2d 3e 76 61 72  |Ptr_Val_Par->var|
000027a0  69 61 6e 74 2e 76 61 72  5f 31 2e 49 6e 74 5f 43  |iant.var_1.Int_C|
000027b0  6f 6d 70 3b 0a 20 20 4e  65 78 74 5f 52 65 63 6f  |omp;.  Next_Reco|
000027c0  72 64 2d 3e 50 74 72 5f  43 6f 6d 70 20 3d 20 50  |rd->Ptr_Comp = P|
000027d0  74 72 5f 56 61 6c 5f 50  61 72 2d 3e 50 74 72 5f  |tr_Val_Par->Ptr_|
000027e0  43 6f 6d 70 3b 0a 20 20  50 72 6f 63 5f 33 20 28  |Comp;.  Proc_3 (|
000027f0  26 4e 65 78 74 5f 52 65  63 6f 72 64 2d 3e 50 74  |&Next_Record->Pt|
00002800  72 5f 43 6f 6d 70 29 3b  0a 20 20 20 20 2f 2a 20  |r_Comp);.    /* |
00002810  50 74 72 5f 56 61 6c 5f  50 61 72 2d 3e 50 74 72  |Ptr_Val_Par->Ptr|
00002820  5f 43 6f 6d 70 2d 3e 50  74 72 5f 43 6f 6d 70 20  |_Comp->Ptr_Comp |
00002830  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00002840  20 20 20 20 20 20 20 20  20 3d 3d 20 50 74 72 5f  |         == Ptr_|
00002850  47 6c 6f 62 2d 3e 50 74  72 5f 43 6f 6d 70 20 2a  |Glob->Ptr_Comp *|
00002860  2f 0a 20 20 69 66 20 28  4e 65 78 74 5f 52 65 63  |/.  if (Next_Rec|
00002870  6f 72 64 2d 3e 44 69 73  63 72 20 3d 3d 20 49 64  |ord->Discr == Id|
00002880  65 6e 74 5f 31 29 0a 20  20 20 20 2f 2a 20 74 68  |ent_1).    /* th|
00002890  65 6e 2c 20 65 78 65 63  75 74 65 64 20 2a 2f 0a  |en, executed */.|
000028a0  20 20 7b 0a 20 20 20 20  4e 65 78 74 5f 52 65 63  |  {.    Next_Rec|
000028b0  6f 72 64 2d 3e 76 61 72  69 61 6e 74 2e 76 61 72  |ord->variant.var|
000028c0  5f 31 2e 49 6e 74 5f 43  6f 6d 70 20 3d 20 36 3b  |_1.Int_Comp = 6;|
000028d0  0a 20 20 20 20 50 72 6f  63 5f 36 20 28 50 74 72  |.    Proc_6 (Ptr|
000028e0  5f 56 61 6c 5f 50 61 72  2d 3e 76 61 72 69 61 6e  |_Val_Par->varian|
000028f0  74 2e 76 61 72 5f 31 2e  45 6e 75 6d 5f 43 6f 6d  |t.var_1.Enum_Com|
00002900  70 2c 20 0a 20 20 20 20  20 20 20 20 20 20 20 26  |p, .           &|
00002910  4e 65 78 74 5f 52 65 63  6f 72 64 2d 3e 76 61 72  |Next_Record->var|
00002920  69 61 6e 74 2e 76 61 72  5f 31 2e 45 6e 75 6d 5f  |iant.var_1.Enum_|
00002930  43 6f 6d 70 29 3b 0a 20  20 20 20 4e 65 78 74 5f  |Comp);.    Next_|
00002940  52 65 63 6f 72 64 2d 3e  50 74 72 5f 43 6f 6d 70  |Record->Ptr_Comp|
00002950  20 3d 20 50 74 72 5f 47  6c 6f 62 2d 3e 50 74 72  | = Ptr_Glob->Ptr|
00002960  5f 43 6f 6d 70 3b 0a 20  20 20 20 50 72 6f 63 5f  |_Comp;.    Proc_|
00002970  37 20 28 4e 65 78 74 5f  52 65 63 6f 72 64 2d 3e  |7 (Next_Record->|
00002980  76 61 72 69 61 6e 74 2e  76 61 72 5f 31 2e 49 6e  |variant.var_1.In|
00002990  74 5f 43 6f 6d 70 2c 20  31 30 2c 20 0a 20 20 20  |t_Comp, 10, .   |
000029a0  20 20 20 20 20 20 20 20  26 4e 65 78 74 5f 52 65  |        &Next_Re|
000029b0  63 6f 72 64 2d 3e 76 61  72 69 61 6e 74 2e 76 61  |cord->variant.va|
000029c0  72 5f 31 2e 49 6e 74 5f  43 6f 6d 70 29 3b 0a 20  |r_1.Int_Comp);. |
000029d0  20 7d 0a 20 20 65 6c 73  65 20 2f 2a 20 6e 6f 74  | }.  else /* not|
000029e0  20 65 78 65 63 75 74 65  64 20 2a 2f 0a 20 20 20  | executed */.   |
000029f0  20 73 74 72 75 63 74 61  73 73 69 67 6e 20 28 2a  | structassign (*|
00002a00  50 74 72 5f 56 61 6c 5f  50 61 72 2c 20 2a 50 74  |Ptr_Val_Par, *Pt|
00002a10  72 5f 56 61 6c 5f 50 61  72 2d 3e 50 74 72 5f 43  |r_Val_Par->Ptr_C|
00002a20  6f 6d 70 29 3b 0a 7d 20  2f 2a 20 50 72 6f 63 5f  |omp);.} /* Proc_|
00002a30  31 20 2a 2f 0a 0a 0a 50  72 6f 63 5f 32 20 28 49  |1 */...Proc_2 (I|
00002a40  6e 74 5f 50 61 72 5f 52  65 66 29 0a 2f 2a 2a 2a  |nt_Par_Ref)./***|
00002a50  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2f  |***************/|
00002a60  0a 20 20 20 20 2f 2a 20  65 78 65 63 75 74 65 64  |.    /* executed|
00002a70  20 6f 6e 63 65 20 2a 2f  0a 20 20 20 20 2f 2a 20  | once */.    /* |
00002a80  2a 49 6e 74 5f 50 61 72  5f 52 65 66 20 3d 3d 20  |*Int_Par_Ref == |
00002a90  31 2c 20 62 65 63 6f 6d  65 73 20 34 20 2a 2f 0a  |1, becomes 4 */.|
00002aa0  0a 4f 6e 65 5f 46 69 66  74 79 20 20 20 2a 49 6e  |.One_Fifty   *In|
00002ab0  74 5f 50 61 72 5f 52 65  66 3b 0a 7b 0a 20 20 4f  |t_Par_Ref;.{.  O|
00002ac0  6e 65 5f 46 69 66 74 79  20 20 49 6e 74 5f 4c 6f  |ne_Fifty  Int_Lo|
00002ad0  63 3b 20 20 0a 20 20 45  6e 75 6d 65 72 61 74 69  |c;  .  Enumerati|
00002ae0  6f 6e 20 20 20 45 6e 75  6d 5f 4c 6f 63 3b 0a 0a  |on   Enum_Loc;..|
00002af0  20 20 49 6e 74 5f 4c 6f  63 20 3d 20 2a 49 6e 74  |  Int_Loc = *Int|
00002b00  5f 50 61 72 5f 52 65 66  20 2b 20 31 30 3b 0a 20  |_Par_Ref + 10;. |
00002b10  20 64 6f 20 2f 2a 20 65  78 65 63 75 74 65 64 20  | do /* executed |
00002b20  6f 6e 63 65 20 2a 2f 0a  20 20 20 20 69 66 20 28  |once */.    if (|
00002b30  43 68 5f 31 5f 47 6c 6f  62 20 3d 3d 20 27 41 27  |Ch_1_Glob == 'A'|
00002b40  29 0a 20 20 20 20 20 20  2f 2a 20 74 68 65 6e 2c  |).      /* then,|
00002b50  20 65 78 65 63 75 74 65  64 20 2a 2f 0a 20 20 20  | executed */.   |
00002b60  20 7b 0a 20 20 20 20 20  20 49 6e 74 5f 4c 6f 63  | {.      Int_Loc|
00002b70  20 2d 3d 20 31 3b 0a 20  20 20 20 20 20 2a 49 6e  | -= 1;.      *In|
00002b80  74 5f 50 61 72 5f 52 65  66 20 3d 20 49 6e 74 5f  |t_Par_Ref = Int_|
00002b90  4c 6f 63 20 2d 20 49 6e  74 5f 47 6c 6f 62 3b 0a  |Loc - Int_Glob;.|
00002ba0  20 20 20 20 20 20 45 6e  75 6d 5f 4c 6f 63 20 3d  |      Enum_Loc =|
00002bb0  20 49 64 65 6e 74 5f 31  3b 0a 20 20 20 20 7d 20  | Ident_1;.    } |
00002bc0  2f 2a 20 69 66 20 2a 2f  0a 20 20 77 68 69 6c 65  |/* if */.  while|
00002bd0  20 28 45 6e 75 6d 5f 4c  6f 63 20 21 3d 20 49 64  | (Enum_Loc != Id|
00002be0  65 6e 74 5f 31 29 3b 20  2f 2a 20 74 72 75 65 20  |ent_1); /* true |
00002bf0  2a 2f 0a 7d 20 2f 2a 20  50 72 6f 63 5f 32 20 2a  |*/.} /* Proc_2 *|
00002c00  2f 0a 0a 0a 50 72 6f 63  5f 33 20 28 50 74 72 5f  |/...Proc_3 (Ptr_|
00002c10  52 65 66 5f 50 61 72 29  0a 2f 2a 2a 2a 2a 2a 2a  |Ref_Par)./******|
00002c20  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2f 0a 20 20  |************/.  |
00002c30  20 20 2f 2a 20 65 78 65  63 75 74 65 64 20 6f 6e  |  /* executed on|
00002c40  63 65 20 2a 2f 0a 20 20  20 20 2f 2a 20 50 74 72  |ce */.    /* Ptr|
00002c50  5f 52 65 66 5f 50 61 72  20 62 65 63 6f 6d 65 73  |_Ref_Par becomes|
00002c60  20 50 74 72 5f 47 6c 6f  62 20 2a 2f 0a 0a 52 65  | Ptr_Glob */..Re|
00002c70  63 5f 50 6f 69 6e 74 65  72 20 2a 50 74 72 5f 52  |c_Pointer *Ptr_R|
00002c80  65 66 5f 50 61 72 3b 0a  0a 7b 0a 20 20 69 66 20  |ef_Par;..{.  if |
00002c90  28 50 74 72 5f 47 6c 6f  62 20 21 3d 20 4e 75 6c  |(Ptr_Glob != Nul|
00002ca0  6c 29 0a 20 20 20 20 2f  2a 20 74 68 65 6e 2c 20  |l).    /* then, |
00002cb0  65 78 65 63 75 74 65 64  20 2a 2f 0a 20 20 20 20  |executed */.    |
00002cc0  2a 50 74 72 5f 52 65 66  5f 50 61 72 20 3d 20 50  |*Ptr_Ref_Par = P|
00002cd0  74 72 5f 47 6c 6f 62 2d  3e 50 74 72 5f 43 6f 6d  |tr_Glob->Ptr_Com|
00002ce0  70 3b 0a 20 20 50 72 6f  63 5f 37 20 28 31 30 2c  |p;.  Proc_7 (10,|
00002cf0  20 49 6e 74 5f 47 6c 6f  62 2c 20 26 50 74 72 5f  | Int_Glob, &Ptr_|
00002d00  47 6c 6f 62 2d 3e 76 61  72 69 61 6e 74 2e 76 61  |Glob->variant.va|
00002d10  72 5f 31 2e 49 6e 74 5f  43 6f 6d 70 29 3b 0a 7d  |r_1.Int_Comp);.}|
00002d20  20 2f 2a 20 50 72 6f 63  5f 33 20 2a 2f 0a 0a 0a  | /* Proc_3 */...|
00002d30  50 72 6f 63 5f 34 20 28  29 20 2f 2a 20 77 69 74  |Proc_4 () /* wit|
00002d40  68 6f 75 74 20 70 61 72  61 6d 65 74 65 72 73 20  |hout parameters |
00002d50  2a 2f 0a 2f 2a 2a 2a 2a  2a 2a 2a 2f 0a 20 20 20  |*/./*******/.   |
00002d60  20 2f 2a 20 65 78 65 63  75 74 65 64 20 6f 6e 63  | /* executed onc|
00002d70  65 20 2a 2f 0a 7b 0a 20  20 42 6f 6f 6c 65 61 6e  |e */.{.  Boolean|
00002d80  20 42 6f 6f 6c 5f 4c 6f  63 3b 0a 0a 20 20 42 6f  | Bool_Loc;..  Bo|
00002d90  6f 6c 5f 4c 6f 63 20 3d  20 43 68 5f 31 5f 47 6c  |ol_Loc = Ch_1_Gl|
00002da0  6f 62 20 3d 3d 20 27 41  27 3b 0a 20 20 42 6f 6f  |ob == 'A';.  Boo|
00002db0  6c 5f 47 6c 6f 62 20 3d  20 42 6f 6f 6c 5f 4c 6f  |l_Glob = Bool_Lo|
00002dc0  63 20 7c 20 42 6f 6f 6c  5f 47 6c 6f 62 3b 0a 20  |c | Bool_Glob;. |
00002dd0  20 43 68 5f 32 5f 47 6c  6f 62 20 3d 20 27 42 27  | Ch_2_Glob = 'B'|
00002de0  3b 0a 7d 20 2f 2a 20 50  72 6f 63 5f 34 20 2a 2f  |;.} /* Proc_4 */|
00002df0  0a 0a 0a 50 72 6f 63 5f  35 20 28 29 20 2f 2a 20  |...Proc_5 () /* |
00002e00  77 69 74 68 6f 75 74 20  70 61 72 61 6d 65 74 65  |without paramete|
00002e10  72 73 20 2a 2f 0a 2f 2a  2a 2a 2a 2a 2a 2a 2f 0a  |rs */./*******/.|
00002e20  20 20 20 20 2f 2a 20 65  78 65 63 75 74 65 64 20  |    /* executed |
00002e30  6f 6e 63 65 20 2a 2f 0a  7b 0a 20 20 43 68 5f 31  |once */.{.  Ch_1|
00002e40  5f 47 6c 6f 62 20 3d 20  27 41 27 3b 0a 20 20 42  |_Glob = 'A';.  B|
00002e50  6f 6f 6c 5f 47 6c 6f 62  20 3d 20 66 61 6c 73 65  |ool_Glob = false|
00002e60  3b 0a 7d 20 2f 2a 20 50  72 6f 63 5f 35 20 2a 2f  |;.} /* Proc_5 */|
00002e70  0a 0a 0a 20 20 20 20 20  20 20 20 2f 2a 20 50 72  |...        /* Pr|
00002e80  6f 63 65 64 75 72 65 20  66 6f 72 20 74 68 65 20  |ocedure for the |
00002e90  61 73 73 69 67 6e 6d 65  6e 74 20 6f 66 20 73 74  |assignment of st|
00002ea0  72 75 63 74 75 72 65 73  2c 20 20 20 20 20 20 20  |ructures,       |
00002eb0  20 20 20 2a 2f 0a 20 20  20 20 20 20 20 20 2f 2a  |   */.        /*|
00002ec0  20 69 66 20 74 68 65 20  43 20 63 6f 6d 70 69 6c  | if the C compil|
00002ed0  65 72 20 64 6f 65 73 6e  27 74 20 73 75 70 70 6f  |er doesn't suppo|
00002ee0  72 74 20 74 68 69 73 20  66 65 61 74 75 72 65 20  |rt this feature |
00002ef0  20 20 20 20 20 20 2a 2f  0a 23 69 66 64 65 66 20  |      */.#ifdef |
00002f00  20 4e 4f 53 54 52 55 43  54 41 53 53 49 47 4e 0a  | NOSTRUCTASSIGN.|
00002f10  6d 65 6d 63 70 79 20 28  64 2c 20 73 2c 20 6c 29  |memcpy (d, s, l)|
00002f20  0a 72 65 67 69 73 74 65  72 20 63 68 61 72 20 20  |.register char  |
00002f30  20 2a 64 3b 0a 72 65 67  69 73 74 65 72 20 63 68  | *d;.register ch|
00002f40  61 72 20 20 20 2a 73 3b  0a 72 65 67 69 73 74 65  |ar   *s;.registe|
00002f50  72 20 69 6e 74 20 20 20  20 6c 3b 0a 7b 0a 20 20  |r int    l;.{.  |
00002f60  20 20 20 20 20 20 77 68  69 6c 65 20 28 6c 2d 2d  |      while (l--|
00002f70  29 20 2a 64 2b 2b 20 3d  20 2a 73 2b 2b 3b 0a 7d  |) *d++ = *s++;.}|
00002f80  0a 23 65 6e 64 69 66 0a  0a 0a                    |.#endif...|
00002f8a