Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:28

0001 /*
0002  ****************************************************************************
0003  *
0004  *                   "DHRYSTONE" Benchmark Program
0005  *                   -----------------------------
0006  *                                                                            
0007  *  Version:    C, Version 2.1
0008  *                                                                            
0009  *  File:       dhry_2.c (part 3 of 3)
0010  *
0011  *  Date:       May 25, 1988
0012  *
0013  *  Author:     Reinhold P. Weicker
0014  *
0015  ****************************************************************************
0016  */
0017 
0018 #include "dhry.h"
0019 
0020 #include <string.h>
0021 
0022 #ifndef REG
0023 #define REG
0024         /* REG becomes defined as empty */
0025         /* i.e. no register variables   */
0026 #endif
0027 
0028 extern  int     Int_Glob;
0029 extern  char    Ch_1_Glob;
0030 
0031 
0032 void Proc_6 (Enum_Val_Par, Enum_Ref_Par)
0033 /*********************************/
0034     /* executed once */
0035     /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
0036 
0037 Enumeration  Enum_Val_Par;
0038 Enumeration *Enum_Ref_Par;
0039 {
0040   *Enum_Ref_Par = Enum_Val_Par;
0041   if (! Func_3 (Enum_Val_Par))
0042     /* then, not executed */
0043     *Enum_Ref_Par = Ident_4;
0044   switch (Enum_Val_Par)
0045   {
0046     case Ident_1: 
0047       *Enum_Ref_Par = Ident_1;
0048       break;
0049     case Ident_2: 
0050       if (Int_Glob > 100)
0051         /* then */
0052       *Enum_Ref_Par = Ident_1;
0053       else *Enum_Ref_Par = Ident_4;
0054       break;
0055     case Ident_3: /* executed */
0056       *Enum_Ref_Par = Ident_2;
0057       break;
0058     case Ident_4: break;
0059     case Ident_5: 
0060       *Enum_Ref_Par = Ident_3;
0061       break;
0062   } /* switch */
0063 } /* Proc_6 */
0064 
0065 
0066 void Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
0067 /**********************************************/
0068     /* executed three times                                      */ 
0069     /* first call:      Int_1_Par_Val == 2, Int_2_Par_Val == 3,  */
0070     /*                  Int_Par_Ref becomes 7                    */
0071     /* second call:     Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
0072     /*                  Int_Par_Ref becomes 17                   */
0073     /* third call:      Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
0074     /*                  Int_Par_Ref becomes 18                   */
0075 One_Fifty       Int_1_Par_Val;
0076 One_Fifty       Int_2_Par_Val;
0077 One_Fifty      *Int_Par_Ref;
0078 {
0079   One_Fifty Int_Loc;
0080 
0081   Int_Loc = Int_1_Par_Val + 2;
0082   *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
0083 } /* Proc_7 */
0084 
0085 
0086 void Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
0087 /*********************************************************************/
0088     /* executed once      */
0089     /* Int_Par_Val_1 == 3 */
0090     /* Int_Par_Val_2 == 7 */
0091 Arr_1_Dim       Arr_1_Par_Ref;
0092 Arr_2_Dim       Arr_2_Par_Ref;
0093 int             Int_1_Par_Val;
0094 int             Int_2_Par_Val;
0095 {
0096   REG One_Fifty Int_Index;
0097   REG One_Fifty Int_Loc;
0098 
0099   Int_Loc = Int_1_Par_Val + 5;
0100   Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
0101   Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
0102   Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
0103   for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
0104     Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc;
0105   Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1;
0106   Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc];
0107   Int_Glob = 5;
0108 } /* Proc_8 */
0109 
0110 
0111 Enumeration Func_1 (Ch_1_Par_Val, Ch_2_Par_Val)
0112 /*************************************************/
0113     /* executed three times                                         */
0114     /* first call:      Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R'    */
0115     /* second call:     Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C'    */
0116     /* third call:      Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C'    */
0117 
0118 Capital_Letter   Ch_1_Par_Val;
0119 Capital_Letter   Ch_2_Par_Val;
0120 {
0121   Capital_Letter        Ch_1_Loc;
0122   Capital_Letter        Ch_2_Loc;
0123 
0124   Ch_1_Loc = Ch_1_Par_Val;
0125   Ch_2_Loc = Ch_1_Loc;
0126   if (Ch_2_Loc != Ch_2_Par_Val)
0127     /* then, executed */
0128     return (Ident_1);
0129   else  /* not executed */
0130   {
0131     Ch_1_Glob = Ch_1_Loc;
0132     return (Ident_2);
0133    }
0134 } /* Func_1 */
0135 
0136 
0137 Boolean Func_2 (Str_1_Par_Ref, Str_2_Par_Ref)
0138 /*************************************************/
0139     /* executed once */
0140     /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
0141     /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
0142 
0143 Str_30  Str_1_Par_Ref;
0144 Str_30  Str_2_Par_Ref;
0145 {
0146   REG One_Thirty        Int_Loc;
0147       Capital_Letter    Ch_Loc;
0148 
0149   Int_Loc = 2;
0150   while (Int_Loc <= 2) /* loop body executed once */
0151     if (Func_1 (Str_1_Par_Ref[Int_Loc],
0152                 Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
0153       /* then, executed */
0154     {
0155       Ch_Loc = 'A';
0156       Int_Loc += 1;
0157     } /* if, while */
0158   if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
0159     /* then, not executed */
0160     Int_Loc = 7;
0161   if (Ch_Loc == 'R')
0162     /* then, not executed */
0163     return (true);
0164   else /* executed */
0165   {
0166     if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
0167       /* then, not executed */
0168     {
0169       Int_Loc += 7;
0170       Int_Glob = Int_Loc;
0171       return (true);
0172     }
0173     else /* executed */
0174       return (false);
0175   } /* if Ch_Loc */
0176 } /* Func_2 */
0177 
0178 
0179 Boolean Func_3 (Enum_Par_Val)
0180 /***************************/
0181     /* executed once        */
0182     /* Enum_Par_Val == Ident_3 */
0183 Enumeration Enum_Par_Val;
0184 {
0185   Enumeration Enum_Loc;
0186 
0187   Enum_Loc = Enum_Par_Val;
0188   if (Enum_Loc == Ident_3)
0189     /* then, executed */
0190     return (true);
0191   else /* not executed */
0192     return (false);
0193 } /* Func_3 */
0194