home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / source / dhrys.zoo / dhrys.4 < prev   
Encoding:
Text File  |  1990-02-21  |  23.0 KB  |  780 lines

  1.  
  2. #! /bin/sh
  3. # This is a shell archive, meaning:
  4. # 1. Remove everything above the #! /bin/sh line.
  5. # 2. Save the resulting text in a file.
  6. # 3. Execute the file with /bin/sh (not csh) to create:
  7. #    dhry_1.c
  8. #    dhry_2.c
  9. #    dhry_c.dif
  10. # This archive created: Wed Feb 14 19:33:18 1990
  11. export PATH; PATH=/bin:/usr/bin:$PATH
  12. echo shar: "extracting 'dhry_1.c'" '(11857 characters)'
  13. if test -f 'dhry_1.c'
  14. then
  15.     echo shar: "will not over-write existing file 'dhry_1.c'"
  16. else
  17. sed 's/^X//' << \SHAR_EOF > 'dhry_1.c'
  18. X/*
  19. X ****************************************************************************
  20. X *
  21. X *                   "DHRYSTONE" Benchmark Program
  22. X *                   -----------------------------
  23. X *                                                                            
  24. X *  Version:    C, Version 2.1
  25. X *                                                                            
  26. X *  File:       dhry_1.c (part 2 of 3)
  27. X *
  28. X *  Date:       May 25, 1988
  29. X *
  30. X *  Author:     Reinhold P. Weicker
  31. X *
  32. X ****************************************************************************
  33. X */
  34. X
  35. X#include "dhry.h"
  36. X
  37. X/* Global Variables: */
  38. X
  39. XRec_Pointer     Ptr_Glob,
  40. X                Next_Ptr_Glob;
  41. Xint             Int_Glob;
  42. XBoolean         Bool_Glob;
  43. Xchar            Ch_1_Glob,
  44. X                Ch_2_Glob;
  45. Xint             Arr_1_Glob [50];
  46. Xint             Arr_2_Glob [50] [50];
  47. X
  48. Xextern char     *malloc ();
  49. XEnumeration     Func_1 ();
  50. X  /* forward declaration necessary since Enumeration may not simply be int */
  51. X
  52. X#ifndef REG
  53. X        Boolean Reg = false;
  54. X#define REG
  55. X        /* REG becomes defined as empty */
  56. X        /* i.e. no register variables   */
  57. X#else
  58. X        Boolean Reg = true;
  59. X#endif
  60. X
  61. X/* variables for time measurement: */
  62. X
  63. X#ifdef TIMES
  64. Xstruct tms      time_info;
  65. Xextern  int     times ();
  66. X                /* see library function "times" */
  67. X#define Too_Small_Time (2*HZ)
  68. X                /* Measurements should last at least about 2 seconds */
  69. X#endif
  70. X#ifdef TIME
  71. Xextern long     time();
  72. X                /* see library function "time"  */
  73. X#define Too_Small_Time 2
  74. X                /* Measurements should last at least 2 seconds */
  75. X#endif
  76. X#ifdef MSC_CLOCK
  77. Xextern clock_t    clock();
  78. X#define Too_Small_Time (2*HZ)
  79. X#endif
  80. X
  81. Xlong            Begin_Time,
  82. X                End_Time,
  83. X                User_Time;
  84. Xfloat           Microseconds,
  85. X                Dhrystones_Per_Second;
  86. X
  87. X/* end of variables for time measurement */
  88. X
  89. X
  90. Xmain ()
  91. X/*****/
  92. X
  93. X  /* main program, corresponds to procedures        */
  94. X  /* Main and Proc_0 in the Ada version             */
  95. X{
  96. X        One_Fifty       Int_1_Loc;
  97. X  REG   One_Fifty       Int_2_Loc;
  98. X        One_Fifty       Int_3_Loc;
  99. X  REG   char            Ch_Index;
  100. X        Enumeration     Enum_Loc;
  101. X        Str_30          Str_1_Loc;
  102. X        Str_30          Str_2_Loc;
  103. X  REG   int             Run_Index;
  104. X  REG   int             Number_Of_Runs;
  105. X
  106. X  /* Initializations */
  107. X
  108. X  Next_Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
  109. X  Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
  110. X
  111. X  Ptr_Glob->Ptr_Comp                    = Next_Ptr_Glob;
  112. X  Ptr_Glob->Discr                       = Ident_1;
  113. X  Ptr_Glob->variant.var_1.Enum_Comp     = Ident_3;
  114. X  Ptr_Glob->variant.var_1.Int_Comp      = 40;
  115. X  strcpy (Ptr_Glob->variant.var_1.Str_Comp, 
  116. X          "DHRYSTONE PROGRAM, SOME STRING");
  117. X  strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");
  118. X
  119. X  Arr_2_Glob [8][7] = 10;
  120. X        /* Was missing in published program. Without this statement,    */
  121. X        /* Arr_2_Glob [8][7] would have an undefined value.             */
  122. X        /* Warning: With 16-Bit processors and Number_Of_Runs > 32000,  */
  123. X        /* overflow may occur for this array element.                   */
  124. X
  125. X  printf ("\n");
  126. X  printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
  127. X  printf ("\n");
  128. X  if (Reg)
  129. X  {
  130. X    printf ("Program compiled with 'register' attribute\n");
  131. X    printf ("\n");
  132. X  }
  133. X  else
  134. X  {
  135. X    printf ("Program compiled without 'register' attribute\n");
  136. X    printf ("\n");
  137. X  }
  138. X  printf ("Please give the number of runs through the benchmark: ");
  139. X  {
  140. X    int n;
  141. X    scanf ("%d", &n);
  142. X    Number_Of_Runs = n;
  143. X  }
  144. X  printf ("\n");
  145. X
  146. X  printf ("Execution starts, %d runs through Dhrystone\n", Number_Of_Runs);
  147. X
  148. X  /***************/
  149. X  /* Start timer */
  150. X  /***************/
  151. X#ifdef TIMES
  152. X  times (&time_info);
  153. X  Begin_Time = (long) time_info.tms_utime;
  154. X#endif
  155. X#ifdef TIME
  156. X  Begin_Time = time ( (long *) 0);
  157. X#endif
  158. X#ifdef MSC_CLOCK
  159. X  Begin_Time = clock();
  160. X#endif
  161. X
  162. X  for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
  163. X  {
  164. X
  165. X    Proc_5();
  166. X    Proc_4();
  167. X      /* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */
  168. X    Int_1_Loc = 2;
  169. X    Int_2_Loc = 3;
  170. X    strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
  171. X    Enum_Loc = Ident_2;
  172. X    Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
  173. X      /* Bool_Glob == 1 */
  174. X    while (Int_1_Loc < Int_2_Loc)  /* loop body executed once */
  175. X    {
  176. X      Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
  177. X        /* Int_3_Loc == 7 */
  178. X      Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
  179. X        /* Int_3_Loc == 7 */
  180. X      Int_1_Loc += 1;
  181. X    } /* while */
  182. X      /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
  183. X    Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc);
  184. X      /* Int_Glob == 5 */
  185. X    Proc_1 (Ptr_Glob);
  186. X    for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
  187. X                             /* loop body executed twice */
  188. X    {
  189. X      if (Enum_Loc == Func_1 (Ch_Index, 'C'))
  190. X          /* then, not executed */
  191. X        {
  192. X        Proc_6 (Ident_1, &Enum_Loc);
  193. X        strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
  194. X        Int_2_Loc = Run_Index;
  195. X        Int_Glob = Run_Index;
  196. X        }
  197. X    }
  198. X      /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
  199. X    Int_2_Loc = Int_2_Loc * Int_1_Loc;
  200. X    Int_1_Loc = Int_2_Loc / Int_3_Loc;
  201. X    Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc;
  202. X      /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */
  203. X    Proc_2 (&Int_1_Loc);
  204. X      /* Int_1_Loc == 5 */
  205. X
  206. X  } /* loop "for Run_Index" */
  207. X
  208. X  /**************/
  209. X  /* Stop timer */
  210. X  /**************/
  211. X  
  212. X#ifdef TIMES
  213. X  times (&time_info);
  214. X  End_Time = (long) time_info.tms_utime;
  215. X#endif
  216. X#ifdef TIME
  217. X  End_Time = time ( (long *) 0);
  218. X#endif
  219. X#ifdef MSC_CLOCK
  220. X  End_Time = clock();
  221. X#endif
  222. X
  223. X  printf ("Execution ends\n");
  224. X  printf ("\n");
  225. X  printf ("Final values of the variables used in the benchmark:\n");
  226. X  printf ("\n");
  227. X  printf ("Int_Glob:            %d\n", Int_Glob);
  228. X  printf ("        should be:   %d\n", 5);
  229. X  printf ("Bool_Glob:           %d\n", Bool_Glob);
  230. X  printf ("        should be:   %d\n", 1);
  231. X  printf ("Ch_1_Glob:           %c\n", Ch_1_Glob);
  232. X  printf ("        should be:   %c\n", 'A');
  233. X  printf ("Ch_2_Glob:           %c\n", Ch_2_Glob);
  234. X  printf ("        should be:   %c\n", 'B');
  235. X  printf ("Arr_1_Glob[8]:       %d\n", Arr_1_Glob[8]);
  236. X  printf ("        should be:   %d\n", 7);
  237. X  printf ("Arr_2_Glob[8][7]:    %d\n", Arr_2_Glob[8][7]);
  238. X  printf ("        should be:   Number_Of_Runs + 10\n");
  239. X  printf ("Ptr_Glob->\n");
  240. X  printf ("  Ptr_Comp:          %d\n", (int) Ptr_Glob->Ptr_Comp);
  241. X  printf ("        should be:   (implementation-dependent)\n");
  242. X  printf ("  Discr:             %d\n", Ptr_Glob->Discr);
  243. X  printf ("        should be:   %d\n", 0);
  244. X  printf ("  Enum_Comp:         %d\n", Ptr_Glob->variant.var_1.Enum_Comp);
  245. X  printf ("        should be:   %d\n", 2);
  246. X  printf ("  Int_Comp:          %d\n", Ptr_Glob->variant.var_1.Int_Comp);
  247. X  printf ("        should be:   %d\n", 17);
  248. X  printf ("  Str_Comp:          %s\n", Ptr_Glob->variant.var_1.Str_Comp);
  249. X  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
  250. X  printf ("Next_Ptr_Glob->\n");
  251. X  printf ("  Ptr_Comp:          %d\n", (int) Next_Ptr_Glob->Ptr_Comp);
  252. X  printf ("        should be:   (implementation-dependent), same as above\n");
  253. X  printf ("  Discr:             %d\n", Next_Ptr_Glob->Discr);
  254. X  printf ("        should be:   %d\n", 0);
  255. X  printf ("  Enum_Comp:         %d\n", Next_Ptr_Glob->variant.var_1.Enum_Comp);
  256. X  printf ("        should be:   %d\n", 1);
  257. X  printf ("  Int_Comp:          %d\n", Next_Ptr_Glob->variant.var_1.Int_Comp);
  258. X  printf ("        should be:   %d\n", 18);
  259. X  printf ("  Str_Comp:          %s\n",
  260. X                                Next_Ptr_Glob->variant.var_1.Str_Comp);
  261. X  printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
  262. X  printf ("Int_1_Loc:           %d\n", Int_1_Loc);
  263. X  printf ("        should be:   %d\n", 5);
  264. X  printf ("Int_2_Loc:           %d\n", Int_2_Loc);
  265. X  printf ("        should be:   %d\n", 13);
  266. X  printf ("Int_3_Loc:           %d\n", Int_3_Loc);
  267. X  printf ("        should be:   %d\n", 7);
  268. X  printf ("Enum_Loc:            %d\n", Enum_Loc);
  269. X  printf ("        should be:   %d\n", 1);
  270. X  printf ("Str_1_Loc:           %s\n", Str_1_Loc);
  271. X  printf ("        should be:   DHRYSTONE PROGRAM, 1'ST STRING\n");
  272. X  printf ("Str_2_Loc:           %s\n", Str_2_Loc);
  273. X  printf ("        should be:   DHRYSTONE PROGRAM, 2'ND STRING\n");
  274. X  printf ("\n");
  275. X
  276. X  User_Time = End_Time - Begin_Time;
  277. X
  278. X  if (User_Time < Too_Small_Time)
  279. X  {
  280. X    printf ("Measured time too small to obtain meaningful results\n");
  281. X    printf ("Please increase number of runs\n");
  282. X    printf ("\n");
  283. X  }
  284. X  else
  285. X  {
  286. X#ifdef TIME
  287. X    Microseconds = (float) User_Time * Mic_secs_Per_Second 
  288. X                        / (float) Number_Of_Runs;
  289. X    Dhrystones_Per_Second = (float) Number_Of_Runs / (float) User_Time;
  290. X#else
  291. X    Microseconds = (float) User_Time * Mic_secs_Per_Second 
  292. X                        / ((float) HZ * ((float) Number_Of_Runs));
  293. X    Dhrystones_Per_Second = ((float) HZ * (float) Number_Of_Runs)
  294. X                        / (float) User_Time;
  295. X#endif
  296. X    printf ("Microseconds for one run through Dhrystone: ");
  297. X    printf ("%6.1f \n", Microseconds);
  298. X    printf ("Dhrystones per Second:                      ");
  299. X    printf ("%6.1f \n", Dhrystones_Per_Second);
  300. X    printf ("\n");
  301. X  }
  302. X  
  303. X}
  304. X
  305. X
  306. XProc_1 (Ptr_Val_Par)
  307. X/******************/
  308. X
  309. XREG Rec_Pointer Ptr_Val_Par;
  310. X    /* executed once */
  311. X{
  312. X  REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;  
  313. X                                        /* == Ptr_Glob_Next */
  314. X  /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp,    */
  315. X  /* corresponds to "rename" in Ada, "with" in Pascal           */
  316. X  
  317. X  structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob); 
  318. X  Ptr_Val_Par->variant.var_1.Int_Comp = 5;
  319. X  Next_Record->variant.var_1.Int_Comp 
  320. X        = Ptr_Val_Par->variant.var_1.Int_Comp;
  321. X  Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
  322. X  Proc_3 (&Next_Record->Ptr_Comp);
  323. X    /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp 
  324. X                        == Ptr_Glob->Ptr_Comp */
  325. X  if (Next_Record->Discr == Ident_1)
  326. X    /* then, executed */
  327. X  {
  328. X    Next_Record->variant.var_1.Int_Comp = 6;
  329. X    Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp, 
  330. X           &Next_Record->variant.var_1.Enum_Comp);
  331. X    Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
  332. X    Proc_7 (Next_Record->variant.var_1.Int_Comp, 10, 
  333. X           &Next_Record->variant.var_1.Int_Comp);
  334. X  }
  335. X  else /* not executed */
  336. X    structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp);
  337. X} /* Proc_1 */
  338. X
  339. X
  340. XProc_2 (Int_Par_Ref)
  341. X/******************/
  342. X    /* executed once */
  343. X    /* *Int_Par_Ref == 1, becomes 4 */
  344. X
  345. XOne_Fifty   *Int_Par_Ref;
  346. X{
  347. X  One_Fifty  Int_Loc;  
  348. X  Enumeration   Enum_Loc;
  349. X
  350. X  Int_Loc = *Int_Par_Ref + 10;
  351. X  do /* executed once */
  352. X    if (Ch_1_Glob == 'A')
  353. X      /* then, executed */
  354. X    {
  355. X      Int_Loc -= 1;
  356. X      *Int_Par_Ref = Int_Loc - Int_Glob;
  357. X      Enum_Loc = Ident_1;
  358. X    } /* if */
  359. X  while (Enum_Loc != Ident_1); /* true */
  360. X} /* Proc_2 */
  361. X
  362. X
  363. XProc_3 (Ptr_Ref_Par)
  364. X/******************/
  365. X    /* executed once */
  366. X    /* Ptr_Ref_Par becomes Ptr_Glob */
  367. X
  368. XRec_Pointer *Ptr_Ref_Par;
  369. X
  370. X{
  371. X  if (Ptr_Glob != Null)
  372. X    /* then, executed */
  373. X    *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
  374. X  Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
  375. X} /* Proc_3 */
  376. X
  377. X
  378. XProc_4 () /* without parameters */
  379. X/*******/
  380. X    /* executed once */
  381. X{
  382. X  Boolean Bool_Loc;
  383. X
  384. X  Bool_Loc = Ch_1_Glob == 'A';
  385. X  Bool_Glob = Bool_Loc | Bool_Glob;
  386. X  Ch_2_Glob = 'B';
  387. X} /* Proc_4 */
  388. X
  389. X
  390. XProc_5 () /* without parameters */
  391. X/*******/
  392. X    /* executed once */
  393. X{
  394. X  Ch_1_Glob = 'A';
  395. X  Bool_Glob = false;
  396. X} /* Proc_5 */
  397. X
  398. X
  399. X        /* Procedure for the assignment of structures,          */
  400. X        /* if the C compiler doesn't support this feature       */
  401. X#ifdef  NOSTRUCTASSIGN
  402. Xmemcpy (d, s, l)
  403. Xregister char   *d;
  404. Xregister char   *s;
  405. Xregister int    l;
  406. X{
  407. X        while (l--) *d++ = *s++;
  408. X}
  409. X#endif
  410. X
  411. X
  412. SHAR_EOF
  413. if test 11857 -ne "`wc -c < 'dhry_1.c'`"
  414. then
  415.     echo shar: "error transmitting 'dhry_1.c'" '(should have been 11857 characters)'
  416. fi
  417. fi
  418. echo shar: "extracting 'dhry_2.c'" '(5273 characters)'
  419. if test -f 'dhry_2.c'
  420. then
  421.     echo shar: "will not over-write existing file 'dhry_2.c'"
  422. else
  423. sed 's/^X//' << \SHAR_EOF > 'dhry_2.c'
  424. X/*
  425. X ****************************************************************************
  426. X *
  427. X *                   "DHRYSTONE" Benchmark Program
  428. X *                   -----------------------------
  429. X *                                                                            
  430. X *  Version:    C, Version 2.1
  431. X *                                                                            
  432. X *  File:       dhry_2.c (part 3 of 3)
  433. X *
  434. X *  Date:       May 25, 1988
  435. X *
  436. X *  Author:     Reinhold P. Weicker
  437. X *
  438. X ****************************************************************************
  439. X */
  440. X
  441. X#include "dhry.h"
  442. X
  443. X#ifndef REG
  444. X#define REG
  445. X        /* REG becomes defined as empty */
  446. X        /* i.e. no register variables   */
  447. X#endif
  448. X
  449. Xextern  int     Int_Glob;
  450. Xextern  char    Ch_1_Glob;
  451. X
  452. X
  453. XProc_6 (Enum_Val_Par, Enum_Ref_Par)
  454. X/*********************************/
  455. X    /* executed once */
  456. X    /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
  457. X
  458. XEnumeration  Enum_Val_Par;
  459. XEnumeration *Enum_Ref_Par;
  460. X{
  461. X  *Enum_Ref_Par = Enum_Val_Par;
  462. X  if (! Func_3 (Enum_Val_Par))
  463. X    /* then, not executed */
  464. X    *Enum_Ref_Par = Ident_4;
  465. X  switch (Enum_Val_Par)
  466. X  {
  467. X    case Ident_1: 
  468. X      *Enum_Ref_Par = Ident_1;
  469. X      break;
  470. X    case Ident_2: 
  471. X      if (Int_Glob > 100)
  472. X        /* then */
  473. X      *Enum_Ref_Par = Ident_1;
  474. X      else *Enum_Ref_Par = Ident_4;
  475. X      break;
  476. X    case Ident_3: /* executed */
  477. X      *Enum_Ref_Par = Ident_2;
  478. X      break;
  479. X    case Ident_4: break;
  480. X    case Ident_5: 
  481. X      *Enum_Ref_Par = Ident_3;
  482. X      break;
  483. X  } /* switch */
  484. X} /* Proc_6 */
  485. X
  486. X
  487. XProc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
  488. X/**********************************************/
  489. X    /* executed three times                                      */ 
  490. X    /* first call:      Int_1_Par_Val == 2, Int_2_Par_Val == 3,  */
  491. X    /*                  Int_Par_Ref becomes 7                    */
  492. X    /* second call:     Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
  493. X    /*                  Int_Par_Ref becomes 17                   */
  494. X    /* third call:      Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
  495. X    /*                  Int_Par_Ref becomes 18                   */
  496. XOne_Fifty       Int_1_Par_Val;
  497. XOne_Fifty       Int_2_Par_Val;
  498. XOne_Fifty      *Int_Par_Ref;
  499. X{
  500. X  One_Fifty Int_Loc;
  501. X
  502. X  Int_Loc = Int_1_Par_Val + 2;
  503. X  *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
  504. X} /* Proc_7 */
  505. X
  506. X
  507. XProc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
  508. X/*********************************************************************/
  509. X    /* executed once      */
  510. X    /* Int_Par_Val_1 == 3 */
  511. X    /* Int_Par_Val_2 == 7 */
  512. XArr_1_Dim       Arr_1_Par_Ref;
  513. XArr_2_Dim       Arr_2_Par_Ref;
  514. Xint             Int_1_Par_Val;
  515. Xint             Int_2_Par_Val;
  516. X{
  517. X  REG One_Fifty Int_Index;
  518. X  REG One_Fifty Int_Loc;
  519. X
  520. X  Int_Loc = Int_1_Par_Val + 5;
  521. X  Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
  522. X  Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
  523. X  Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
  524. X  for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
  525. X    Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc;
  526. X  Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1;
  527. X  Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc];
  528. X  Int_Glob = 5;
  529. X} /* Proc_8 */
  530. X
  531. X
  532. XEnumeration Func_1 (Ch_1_Par_Val, Ch_2_Par_Val)
  533. X/*************************************************/
  534. X    /* executed three times                                         */
  535. X    /* first call:      Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R'    */
  536. X    /* second call:     Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C'    */
  537. X    /* third call:      Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C'    */
  538. X
  539. XCapital_Letter   Ch_1_Par_Val;
  540. XCapital_Letter   Ch_2_Par_Val;
  541. X{
  542. X  Capital_Letter        Ch_1_Loc;
  543. X  Capital_Letter        Ch_2_Loc;
  544. X
  545. X  Ch_1_Loc = Ch_1_Par_Val;
  546. X  Ch_2_Loc = Ch_1_Loc;
  547. X  if (Ch_2_Loc != Ch_2_Par_Val)
  548. X    /* then, executed */
  549. X    return (Ident_1);
  550. X  else  /* not executed */
  551. X  {
  552. X    Ch_1_Glob = Ch_1_Loc;
  553. X    return (Ident_2);
  554. X   }
  555. X} /* Func_1 */
  556. X
  557. X
  558. XBoolean Func_2 (Str_1_Par_Ref, Str_2_Par_Ref)
  559. X/*************************************************/
  560. X    /* executed once */
  561. X    /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
  562. X    /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
  563. X
  564. XStr_30  Str_1_Par_Ref;
  565. XStr_30  Str_2_Par_Ref;
  566. X{
  567. X  REG One_Thirty        Int_Loc;
  568. X      Capital_Letter    Ch_Loc;
  569. X
  570. X  Int_Loc = 2;
  571. X  while (Int_Loc <= 2) /* loop body executed once */
  572. X    if (Func_1 (Str_1_Par_Ref[Int_Loc],
  573. X                Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
  574. X      /* then, executed */
  575. X    {
  576. X      Ch_Loc = 'A';
  577. X      Int_Loc += 1;
  578. X    } /* if, while */
  579. X  if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
  580. X    /* then, not executed */
  581. X    Int_Loc = 7;
  582. X  if (Ch_Loc == 'R')
  583. X    /* then, not executed */
  584. X    return (true);
  585. X  else /* executed */
  586. X  {
  587. X    if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
  588. X      /* then, not executed */
  589. X    {
  590. X      Int_Loc += 7;
  591. X      Int_Glob = Int_Loc;
  592. X      return (true);
  593. X    }
  594. X    else /* executed */
  595. X      return (false);
  596. X  } /* if Ch_Loc */
  597. X} /* Func_2 */
  598. X
  599. X
  600. XBoolean Func_3 (Enum_Par_Val)
  601. X/***************************/
  602. X    /* executed once        */
  603. X    /* Enum_Par_Val == Ident_3 */
  604. XEnumeration Enum_Par_Val;
  605. X{
  606. X  Enumeration Enum_Loc;
  607. X
  608. X  Enum_Loc = Enum_Par_Val;
  609. X  if (Enum_Loc == Ident_3)
  610. X    /* then, executed */
  611. X    return (true);
  612. X  else /* not executed */
  613. X    return (false);
  614. X} /* Func_3 */
  615. X
  616. SHAR_EOF
  617. if test 5273 -ne "`wc -c < 'dhry_2.c'`"
  618. then
  619.     echo shar: "error transmitting 'dhry_2.c'" '(should have been 5273 characters)'
  620. fi
  621. fi
  622. echo shar: "extracting 'dhry_c.dif'" '(4354 characters)'
  623. if test -f 'dhry_c.dif'
  624. then
  625.     echo shar: "will not over-write existing file 'dhry_c.dif'"
  626. else
  627. sed 's/^X//' << \SHAR_EOF > 'dhry_c.dif'
  628. X7c7
  629. X<  *  Version:    C, Version 2.1
  630. X---
  631. X>  *  Version:    C, Version 2.0
  632. X9c9
  633. X<  *  File:       dhry.h (part 1 of 3)
  634. X---
  635. X>  *  File:       dhry_global.h (part 1 of 3)
  636. X11c11
  637. X<  *  Date:       May 25, 1988
  638. X---
  639. X>  *  Date:       March 3, 1988
  640. X30c30
  641. X<  *              In addition, Berkeley UNIX system calls "times ()" or "time ()"
  642. X---
  643. X>  *              In addition, UNIX system calls "times ()" or "time ()"
  644. X44c44
  645. X<  *      Please send results to Rick Richardson and/or Reinhold Weicker.
  646. X---
  647. X>  *      Please send results to Reinhold Weicker and/or Rick Richardson.
  648. X59c59
  649. X<  *  History:    This version C/2.1 has been made for two reasons:
  650. X---
  651. X>  *  History:    This version C/2.0 has been made for two reasons:
  652. X123,129d122
  653. X<  *              Version 2.1 is identical to version 2.0 distributed via
  654. X<  *              the UNIX network Usenet in March 1988 except that it corrects
  655. X<  *              some minor deficiencies that were found by users of version 2.0.
  656. X<  *              The only change within the measurement loop is that a
  657. X<  *              non-executed "else" part was added to the "if" statement in
  658. X<  *              Func_3, and a non-executed "else" part removed from Proc_3.
  659. X<  *
  660. X165,167c158,160
  661. X<  *              -DHZ=nnn
  662. X<  *                      In Berkeley UNIX, the function "times" returns process
  663. X<  *                      time in 1/HZ seconds, with HZ = 60 for most systems.
  664. X---
  665. X>  *              -DHZ=nnn                (default: 60)
  666. X>  *                      The function "times" returns process times in
  667. X>  *                      1/HZ seconds, with HZ = 60 for most systems.
  668. X169c162
  669. X<  *                      A VALUE.
  670. X---
  671. X>  *                      THE DEFAULT VALUE.
  672. X176,178c169,171
  673. X<  *  - dhry.h (this file, containing global definitions and comments)
  674. X<  *  - dhry_1.c (containing the code corresponding to Ada package Pack_1)
  675. X<  *  - dhry_2.c (containing the code corresponding to Ada package Pack_2)
  676. X---
  677. X>  *  - dhry_global.h (this file, containing global definitions and comments)
  678. X>  *  - dhry_pack_1.c (containing the code corresponding to Ada package Pack_1)
  679. X>  *  - dhry_pack_2.c (containing the code corresponding to Ada package Pack_2)
  680. X350a344
  681. X> #ifndef TIMES
  682. X353,354c347,354
  683. X<                 /* Use times(2) time function unless    */
  684. X<                 /* explicitly defined otherwise         */
  685. X---
  686. X> #endif
  687. X>                 /* Use "times" function for measurement */
  688. X>                 /* unless explicitly defined otherwise  */
  689. X> #ifndef HZ
  690. X> #define HZ      60
  691. X> #endif
  692. X>                 /* Use HZ = 60 for "times" function     */
  693. X>                 /* unless explicitly defined otherwise  */
  694. X363c363
  695. X<                 /* Berkeley UNIX C returns process times in seconds/HZ */
  696. X---
  697. X>                 /* UNIX C returns process times in seconds/HZ */
  698. X7c7
  699. X<  *  Version:    C, Version 2.1
  700. X---
  701. X>  *  Version:    C, Version 2.0
  702. X9c9
  703. X<  *  File:       dhry_1.c (part 2 of 3)
  704. X---
  705. X>  *  File:       dhry_pack_1.c (part 2 of 3)
  706. X11c11
  707. X<  *  Date:       May 25, 1988
  708. X---
  709. X>  *  Date:       March 3, 1988
  710. X18c18
  711. X< #include "dhry.h"
  712. X---
  713. X> #include "dhry_global.h"
  714. X50,51d49
  715. X< #define Too_Small_Time 120
  716. X<                 /* Measurements should last at least about 2 seconds */
  717. X55a54,55
  718. X> #endif
  719. X> 
  720. X58d57
  721. X< #endif
  722. X73a73
  723. X> 
  724. X84a85
  725. X> 
  726. X99,100c100,102
  727. X<         /* Was missing in published program. Without this statement,    */
  728. X<         /* Arr_2_Glob [8][7] would have an undefined value.             */
  729. X---
  730. X>         /* Was missing in published program. Without this               */
  731. X>         /* initialization, Arr_2_Glob [8][7] would have an              */
  732. X>         /* undefined value.                                             */
  733. X105c107
  734. X<   printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
  735. X---
  736. X>   printf ("Dhrystone Benchmark, Version 2.0 (Language: C)\n");
  737. X281c283
  738. X< /******************/
  739. X---
  740. X> /**********************/
  741. X338c340
  742. X< /******************/
  743. X---
  744. X> /**********************/
  745. X347a350,351
  746. X>   else /* not executed */
  747. X>     Int_Glob = 100;
  748. X349a354
  749. X> 
  750. X7c7
  751. X<  *  Version:    C, Version 2.1
  752. X---
  753. X>  *  Version:    C, Version 2.0
  754. X9c9
  755. X<  *  File:       dhry_2.c (part 3 of 3)
  756. X---
  757. X>  *  File:       dhry_pack_2.c (part 3 of 3)
  758. X11c11
  759. X<  *  Date:       May 25, 1988
  760. X---
  761. X>  *  Date:       March 3, 1988
  762. X18c18
  763. X< #include "dhry.h"
  764. X---
  765. X> #include "dhry_global.h"
  766. X189,190d188
  767. X<   else /* not executed */
  768. X<     return (false);
  769. SHAR_EOF
  770. if test 4354 -ne "`wc -c < 'dhry_c.dif'`"
  771. then
  772.     echo shar: "error transmitting 'dhry_c.dif'" '(should have been 4354 characters)'
  773. fi
  774. fi
  775. exit 0
  776. #    End of shell archive
  777.  
  778.  
  779.