Source: ERCC08:DRY.DHRY2#C Compiled: 25/04/89 16.53.50 Object: ERCC08:DRY.DHRY2#O Parms set: OPT 0 /* 1 **************************************************************************** 2 * 3 * "DHRYSTONE" Benchmark Program 4 * ----------------------------- 5 * 6 * Version: C, Version 2.1 7 * 8 * File: dhry_2.c (part 3 of 3) 9 * 10 * Date: May 25, 1988 11 * 12 * Author: Reinhold P. Weicker 13 * 14 **************************************************************************** 15 */ 16 17 *&*&nclude dhry#h*/ 18 /* jm */ 19 #define TIME 20 #define HZ 50 21 /* jm */ 22 23 /* 24 **************************************************************************** 25 * 26 * "DHRYSTONE" Benchmark Program 27 * ----------------------------- 28 * 29 * Version: C, Version 2.1 30 * 31 * File: dhry.h (part 1 of 3) 32 * 33 * Date: May 25, 1988 34 * 35 * Author: Reinhold P. Weicker 36 * Siemens AG, E STE 35 37 * Postfach 3240 38 * 8520 Erlangen 39 * Germany (West) 40 * Phone: [xxx-49]-9131-7-20330 41 * (8-17 Central European Time) 42 * Usenet: ..!mcvax!unido!estevax!weicker 43 * 44 * Original Version (in Ada) published in 45 * "Communications of the ACM" vol. 27., no. 10 (Oct. 1984), 46 * pp. 1013 - 1030, together with the statistics 47 * on which the distribution of statements etc. is based. 48 * 49 * In this C version, the following C library functions are used: 50 * - strcpy, strcmp (inside the measurement loop) 51 * - printf, scanf (outside the measurement loop) 52 * In addition, Berkeley UNIX system calls "times ()" or "time ()" 53 * are used for execution time measurement. For measurements 54 * on other systems, these calls have to be changed. 55 * 56 * Collection of Results: 57 * Reinhold Weicker (address see above) and 58 * 59 * Rick Richardson 60 * PC Research. Inc. 61 * 94 Apple Orchard Drive 62 * Tinton Falls, NJ 07724 63 * Phone: (201) 389-8963 (9-17 EST) 64 * Usenet: ...!uunet!pcrat!rick 65 * 66 * Please send results to Rick Richardson and/or Reinhold Weicker. 67 * Complete information should be given on hardware and software used. 68 * Hardware information includes: Machine type, CPU, type and size 69 * of caches; for microprocessors: clock frequency, memory speed 70 * (number of wait states). 71 * Software information includes: Compiler (and runtime library) 72 * manufacturer and version, compilation switches, OS version. 73 * The Operating System version may give an indication about the 74 * compiler; Dhrystone itself performs no OS calls in the measurement loop. 75 * 76 * The complete output generated by the program should be mailed 77 * such that at least some checks for correctness can be made. 78 * 79 *************************************************************************** 80 * 81 * History: This version C/2.1 has been made for two reasons: 82 * 83 * 1) There is an obvious need for a common C version of 84 * Dhrystone, since C is at present the most popular system 85 * programming language for the class of processors 86 * (microcomputers, minicomputers) where Dhrystone is used most. 87 * There should be, as far as possible, only one C version of 88 * Dhrystone such that results can be compared without 89 * restrictions. In the past, the C versions distributed 90 * by Rick Richardson (Version 1.1) and by Reinhold Weicker 91 * had small (though not significant) differences. 92 * 93 * 2) As far as it is possible without changes to the Dhrystone 94 * statistics, optimizing compilers should be prevented from 95 * removing significant statements. 96 * 97 * This C version has been developed in cooperation with 98 * Rick Richardson (Tinton Falls, NJ), it incorporates many 99 * ideas from the "Version 1.1" distributed previously by 100 * him over the UNIX network Usenet. 101 * I also thank Chaim Benedelac (National Semiconductor), 102 * David Ditzel (SUN), Earl Killian and John Mashey (MIPS), 103 * Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley) 104 * for their help with comments on earlier versions of the 105 * benchmark. 106 * 107 * Changes: In the initialization part, this version follows mostly 108 * Rick Richardson's version distributed via Usenet, not the 109 * version distributed earlier via floppy disk by Reinhold Weicker. 110 * As a concession to older compilers, names have been made 111 * unique within the first 8 characters. 112 * Inside the measurement loop, this version follows the 113 * version previously distributed by Reinhold Weicker. 114 * 115 * At several places in the benchmark, code has been added, 116 * but within the measurement loop only in branches that 117 * are not executed. The intention is that optimizing compilers 118 * should be prevented from moving code out of the measurement 119 * loop, or from removing code altogether. Since the statements 120 * that are executed within the measurement loop have NOT been 121 * changed, the numbers defining the "Dhrystone distribution" 122 * (distribution of statements, operand types and locality) 123 * still hold. Except for sophisticated optimizing compilers, 124 * execution times for this version should be the same as 125 * for previous versions. 126 * 127 * Since it has proven difficult to subtract the time for the 128 * measurement loop overhead in a correct way, the loop check 129 * has been made a part of the benchmark. This does have 130 * an impact - though a very minor one - on the distribution 131 * statistics which have been updated for this version. 132 * 133 * All changes within the measurement loop are described 134 * and discussed in the companion paper "Rationale for 135 * Dhrystone version 2". 136 * 137 * Because of the self-imposed limitation that the order and 138 * distribution of the executed statements should not be 139 * changed, there are still cases where optimizing compilers 140 * may not generate code for some statements. To a certain 141 * degree, this is unavoidable for small synthetic benchmarks. 142 * Users of the benchmark are advised to check code listings 143 * whether code is generated for all statements of Dhrystone. 144 * 145 * Version 2.1 is identical to version 2.0 distributed via 146 * the UNIX network Usenet in March 1988 except that it corrects 147 * some minor deficiencies that were found by users of version 2.0. 148 * The only change within the measurement loop is that a 149 * non-executed "else" part was added to the "if" statement in 150 * Func_3, and a non-executed "else" part removed from Proc_3. 151 * 152 *************************************************************************** 153 * 154 * Defines: The following "Defines" are possible: 155 * -DREG=register (default: Not defined) 156 * As an approximation to what an average C programmer 157 * might do, the "register" storage class is applied 158 * (if enabled by -DREG=register) 159 * - for local variables, if they are used (dynamically) 160 * five or more times 161 * - for parameters if they are used (dynamically) 162 * six or more times 163 * Note that an optimal "register" strategy is 164 * compiler-dependent, and that "register" declarations 165 * do not necessarily lead to faster execution. 166 * -DNOSTRUCTASSIGN (default: Not defined) 167 * Define if the C compiler does not support 168 * assignment of structures. 169 * -DNOENUMS (default: Not defined) 170 * Define if the C compiler does not support 171 * enumeration types. 172 * -DTIMES (default) 173 * -DTIME 174 * The "times" function of UNIX (returning process times) 175 * or the "time" function (returning wallclock time) 176 * is used for measurement. 177 * For single user machines, "time ()" is adequate. For 178 * multi-user machines where you cannot get single-user 179 * access, use the "times ()" function. If you have 180 * neither, use a stopwatch in the dead of night. 181 * "printf"s are provided marking the points "Start Timer" 182 * and "Stop Timer". DO NOT use the UNIX "time(1)" 183 * command, as this will measure the total time to 184 * run this program, which will (erroneously) include 185 * the time to allocate storage (malloc) and to perform 186 * the initialization. 187 * -DHZ=nnn 188 * In Berkeley UNIX, the function "times" returns process 189 * time in 1/HZ seconds, with HZ = 60 for most systems. 190 * CHECK YOUR SYSTEM DESCRIPTION BEFORE YOU JUST APPLY 191 * A VALUE. 192 * 193 *************************************************************************** 194 * 195 * Compilation model and measurement (IMPORTANT): 196 * 197 * This C version of Dhrystone consists of three files: 198 * - dhry.h (this file, containing global definitions and comments) 199 * - dhry_1.c (containing the code corresponding to Ada package Pack_1) 200 * - dhry_2.c (containing the code corresponding to Ada package Pack_2) 201 * 202 * The following "ground rules" apply for measurements: 203 * - Separate compilation 204 * - No procedure merging 205 * - Otherwise, compiler optimizations are allowed but should be indicated 206 * - Default results are those without register declarations 207 * See the companion paper "Rationale for Dhrystone Version 2" for a more 208 * detailed discussion of these ground rules. 209 * 210 * For 16-Bit processors (e.g. 80186, 80286), times for all compilation 211 * models ("small", "medium", "large" etc.) should be given if possible, 212 * together with a definition of these models for the compiler system used. 213 * 214 ************************************************************************** 215 * 216 * Dhrystone (C version) statistics: 217 * 218 * [Comment from the first distribution, updated for version 2. 219 * Note that because of language differences, the numbers are slightly 220 * different from the Ada version.] 221 * 222 * The following program contains statements of a high level programming 223 * language (here: C) in a distribution considered representative: 224 * 225 * assignments 52 (51.0 %) 226 * control statements 33 (32.4 %) 227 * procedure, function calls 17 (16.7 %) 228 * 229 * 103 statements are dynamically executed. The program is balanced with 230 * respect to the three aspects: 231 * 232 * - statement type 233 * - operand type 234 * - operand locality 235 * operand global, local, parameter, or constant. 236 * 237 * The combination of these three aspects is balanced only approximately. 238 * 239 * 1. Statement Type: 240 * ----------------- number 241 * 242 * V1 = V2 9 243 * (incl. V1 = F(..) 244 * V = Constant 12 245 * Assignment, 7 246 * with array element 247 * Assignment, 6 248 * with record component 249 * -- 250 * 34 34 251 * 252 * X = Y +|-|"&&"|"|" Z 5 253 * X = Y +|-|"==" Constant 6 254 * X = X +|- 1 3 255 * X = Y *|/ Z 2 256 * X = Expression, 1 257 * two operators 258 * X = Expression, 1 259 * three operators 260 * -- 261 * 18 18 262 * 263 * if .... 14 264 * with "else" 7 265 * without "else" 7 266 * executed 3 267 * not executed 4 268 * for ... 7 | counted every time 269 * while ... 4 | the loop condition 270 * do ... while 1 | is evaluated 271 * switch ... 1 272 * break 1 273 * declaration with 1 274 * initialization 275 * -- 276 * 34 34 277 * 278 * P (...) procedure call 11 279 * user procedure 10 280 * library procedure 1 281 * X = F (...) 282 * function call 6 283 * user function 5 284 * library function 1 285 * -- 286 * 17 17 287 * --- 288 * 103 289 * 290 * The average number of parameters in procedure or function calls 291 * is 1.82 (not counting the function values aX * 292 * 293 * 2. Operators 294 * ------------ 295 * number approximate 296 * percentage 297 * 298 * Arithmetic 32 50.8 299 * 300 * + 21 33.3 301 * - 7 11.1 302 * * 3 4.8 303 * / (int div) 1 1.6 304 * 305 * Comparison 27 42.8 306 * 307 * == 9 14.3 308 * /= 4 6.3 309 * > 1 1.6 310 * < 3 4.8 311 * >= 1 1.6 312 * <= 9 14.3 313 * 314 * Logic 4 6.3 315 * 316 * && (AND-THEN) 1 1.6 317 * | (OR) 1 1.6 318 * ! (NOT) 2 3.2 319 * 320 * -- ----- 321 * 63 100.1 322 * 323 * 324 * 3. Operand Type (counted once per operand reference): 325 * --------------- 326 * number approximate 327 * percentage 328 * 329 * Integer 175 72.3 % 330 * Character 45 18.6 % 331 * Pointer 12 5.0 % 332 * String30 6 2.5 % 333 * Array 2 0.8 % 334 * Record 2 0.8 % 335 * --- ------- 336 * 242 100.0 % 337 * 338 * When there is an access path leading to the final operand (e.g. a record 339 * component), only the final data type on the access path is counted. 340 * 341 * 342 * 4. Operand Locality: 343 * ------------------- 344 * number approximate 345 * percentage 346 * 347 * local variable 114 47.1 % 348 * global variable 22 9.1 % 349 * parameter 45 18.6 % 350 * value 23 9.5 % 351 * reference 22 9.1 % 352 * function result 6 2.5 % 353 * constant 55 22.7 % 354 * --- ------- 355 * 242 100.0 % 356 * 357 * 358 * The program does not compute anything meaningful, but it is syntactically 359 * and semantically correct. All variables have a value assigned to them 360 * before they are used as a source operand. 361 * 362 * There has been no explicit effort to account for the effects of a 363 * cache, or to balance the use of long or short displacements for code or 364 * data. 365 * 366 *************************************************************************** 367 */ 368 369 /* Compiler and system dependent definitions: */ 370 371 #ifndef TIME 372 #undef TIMES 373 #define TIMES 374 #endif 375 /* Use times(2) time function unless */ 376 /* explicitly defined otherwise */ 377 378 #ifdef MSC_CLOCK 379 #undef HZ 380 #undef TIMES 381 *&*&nclude subsys:cinserts_time*/ 382 /* ================================================================ */ 383 /* = EMAS C Header file = */ 384 /* = = */ 385 /* = time.h = */ 386 /* = = */ 387 /* = (C) Copyright EPCL 1987 = */ 388 /* ================================================================ */ 389 390 #define CLK_TCK 1.0 391 typedef double clock_t; 392 typedef double time_t; 393 struct tm{ 394 int tm_sec; 395 int tm_min; 396 int tm_hour; 397 int tm_mday; 398 int tm_mon; 399 int tm_year; 400 int tm_wday; 401 int tm_yday; 402 int tm_isdst; 403 }; 404 405 clock_t clock (); 406 time_t time (); 407 char *asctime (); 408 char *ctime (); 409 double difftime (); 410 struct tm *gmtime (); 411 struct tm *localtime (); 412 &*&*nd of include file */ 413 #define HZ CLK_TCK 414 #endif 415 /* Use Microsoft C hi-res clock */ 416 417 #ifdef TIMES ** WARNING ** Include file subsys:cinserts_sys/types does not exist 418 /*#include subsys:cinserts_sys/types*/ ** WARNING ** Include file subsys:cinserts_sys/times does not exist 419 /*#include subsys:cinserts_sys/times*/ 420 /* for "times" */ 421 #endif 422 423 #define Mic_secs_Per_Second 1000000.0 424 /* Berkeley UNIX C returns process times in seconds/HZ */ 425 426 #ifdef NOSTRUCTASSIGN 427 #define structassign(d, s) memcpy(&(d), &(s), sizeof(d)) 428 #else 429 #define structassign(d, s) d = s 430 #endif 431 432 #ifdef NOENUM 433 #define Ident_1 0 434 #define Ident_2 1 435 #define Ident_3 2 436 #define Ident_4 3 437 #define Ident_5 4 438 typedef int Enumeration; 439 #else 440 typedef enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5} 441 Enumeration; 442 #endif 443 /* for boolean and enumeration types in Ada, Pascal */ 444 445 /* General definitions: */ 446 447 *&*&nclude subsys:cinserts_stdio*/ 448 /* ================================================================ */ 449 /* = EMAS C Header file = */ 450 /* = = */ 451 /* = stdio.h = */ 452 /* = = */ 453 /* = (C) Copyright EPCL 1987 = */ 454 /* ================================================================ */ 455 456 *&*&nclude subsys:cinserts_stddef*/ 457 /* ================================================================ */ 458 /* = EMAS C Header file = */ 459 /* = = */ 460 /* = stddef.h = */ 461 /* = = */ 462 /* = (C) Copyright EPCL 1987 = */ 463 /* ================================================================ */ 464 465 typedef int ptrdiff_t; 466 typedef int size_t; 467 #define NULL 0 468 extern ICL9CAERRNO; 469 #define errno ICL9CAERRNO 470 &*&*nd of include file */ 471 472 #define _NFILE 255 473 #define NULL 0 474 typedef int FILE; 475 #define _IOFBF 2 476 #define _IOLBF 1 477 #define _IONBF 0 478 #define BUFSIZ 2036 479 #define EOF -1 480 #define L_tmpnam 27 481 #define SEEK_CUR 1 482 #define SEEK_END 2 483 #define SEEK_SET 0 484 #define SYS_OPEN 78 485 #define TMP_MAX 1000 486 #define stderr 2 487 #define stdin 0 488 #define stdout 1 489 490 491 int remove (); 492 int rename (); 493 FILE *tmpfile (); 494 char *tmpnam (); 495 496 int fclose (); 497 int fflush (); 498 499 FILE *fopen (); 500 FILE *freopen (); 501 502 int setvbuf (); 503 void setbuf (); 504 505 int fprintf (); 506 int printf (); 507 int sprintf (); 508 509 int fscanf (); 510 int scanf (); 511 int sscanf (); 512 513 int fgetc (); 514 int getc (); 515 int getchar (); 516 517 char *fgets (); 518 char *gets (); 519 520 int fputc (); 521 int putc (); 522 int putchar (); 523 524 int fputs (); 525 int puts (); 526 527 int ungetc (); 528 529 int fread (); 530 int fwrite (); 531 532 int fseek (); 533 long ftell (); 534 void rewind (); 535 536 void clearerr (); 537 int feof (); 538 int ferror (); 539 void perror (); 540 541 &*&*nd of include file */ 542 /* for strcpy, strcmp */ 543 544 #define Null 0 545 /* Value of a Null pointer */ 546 #define true 1 547 #define false 0 548 549 typedef int One_Thirty; 550 typedef int One_Fifty; 551 typedef char Capital_Letter; 552 typedef int Boolean; 553 typedef char Str_30 [31]; 554 typedef int Arr_1_Dim [50]; 555 typedef int Arr_2_Dim [50] [50]; 556 557 typedef struct record 558 { 559 struct record *Ptr_Comp; 560 Enumeration Discr; 561 union { 562 struct { 563 Enumeration Enum_Comp; 564 int Int_Comp; 565 char Str_Comp [31]; 566 } var_1; 567 struct { 568 Enumeration E_Comp_2; 569 char Str_2_Comp [31]; 570 } var_2; 571 struct { 572 char Ch_1_Comp; 573 char Ch_2_Comp; 574 } var_3; 575 } variant; 576 } Rec_Type, *Rec_Pointer; 577 578 579 &*&*nd of include file */ 580 581 #ifndef REG 582 #define REG 583 /* REG becomes defined as empty */ 584 /* i.e. no register variables */ 585 #endif 586 587 extern int Int_Glob; 588 extern char Ch_1_Glob; 589 590 591 Proc_6 (Enum_Val_Par, Enum_Ref_Par) 592 /*********************************/ 593 /* executed once */ 594 /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */ 595 596 Enumeration Enum_Val_Par; 597 Enumeration *Enum_Ref_Par; 598 { 599 *Enum_Ref_Par = Enum_Val_Par; 600 if (! Func_3 (Enum_Val_Par)) 601 /* then, not executed */ 602 *Enum_Ref_Par = Ident_4; 603 switch (Enum_Val_Par) 604 { 605 case Ident_1: 606 *Enum_Ref_Par = Ident_1; 607 break; 608 case Ident_2: 609 if (Int_Glob > 100) 610 /* then */ 611 *Enum_Ref_Par = Ident_1; 612 else *Enum_Ref_Par = Ident_4; 613 break; 614 case Ident_3: /* executed */ 615 *Enum_Ref_Par = Ident_2; 616 break; 617 case Ident_4: break; 618 case Ident_5: 619 *Enum_Ref_Par = Ident_3; 620 break; 621 } /* switch */ 622 } /* Proc_6 */ 623 624 625 Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref) 626 /**********************************************/ 627 /* executed three times */ 628 /* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */ 629 /* Int_Par_Ref becomes 7 */ 630 /* second call: Int_1_Par_Val == 10, Int_2_Par_Val == 5, */ 631 /* Int_Par_Ref becomes 17 */ 632 /* third call: Int_1_Par_Val == 6, Int_2_Par_Val == 10, */ 633 /* Int_Par_Ref becomes 18 */ 634 One_Fifty Int_1_Par_Val; 635 One_Fifty Int_2_Par_Val; 636 One_Fifty *Int_Par_Ref; 637 { 638 One_Fifty Int_Loc; 639 640 Int_Loc = Int_1_Par_Val + 2; 641 *Int_Par_Ref = Int_2_Par_Val + Int_Loc; 642 } /* Proc_7 */ 643 644 645 Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val) 646 /*********************************************************************/ 647 /* executed once */ 648 /* Int_Par_Val_1 == 3 */ 649 /* Int_Par_Val_2 == 7 */ 650 Arr_1_Dim Arr_1_Par_Ref; 651 Arr_2_Dim Arr_2_Par_Ref; 652 int Int_1_Par_Val; 653 int Int_2_Par_Val; 654 { 655 REG One_Fifty Int_Index; 656 REG One_Fifty Int_Loc; 657 658 Int_Loc = Int_1_Par_Val + 5; 659 Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val; 660 Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc]; 661 Arr_1_Par_Ref [Int_Loc+30] = Int_Loc; 662 for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index) 663 Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc; 664 Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1; 665 Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc]; 666 Int_Glob = 5; 667 } /* Proc_8 */ 668 669 670 Enumeration Func_1 (Ch_1_Par_Val, Ch_2_Par_Val) 671 /*************************************************/ 672 /* executed three times */ 673 /* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */ 674 /* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */ 675 /* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */ 676 677 Capital_Letter Ch_1_Par_Val; 678 Capital_Letter Ch_2_Par_Val; 679 { 680 Capital_Letter Ch_1_Loc; 681 Capital_Letter Ch_2_Loc; 682 683 Ch_1_Loc = Ch_1_Par_Val; 684 Ch_2_Loc = Ch_1_Loc; 685 if (Ch_2_Loc != Ch_2_Par_Val) 686 /* then, executed */ 687 return (Ident_1); 688 else /* not executed */ 689 { 690 Ch_1_Glob = Ch_1_Loc; 691 return (Ident_2); 692 } 693 } /* Func_1 */ 694 695 696 Boolean Func_2 (Str_1_Par_Ref, Str_2_Par_Ref) 697 /*************************************************/ 698 /* executed once */ 699 /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */ 700 /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */ 701 702 Str_30 Str_1_Par_Ref; 703 Str_30 Str_2_Par_Ref; 704 { 705 REG One_Thirty Int_Loc; 706 Capital_Letter Ch_Loc; 707 708 Int_Loc = 2; 709 while (Int_Loc <= 2) /* loop body executed once */ 710 if (Func_1 (Str_1_Par_Ref[Int_Loc], 711 Str_2_Par_Ref[Int_Loc+1]) == Ident_1) 712 /* then, executed */ 713 { 714 Ch_Loc = 'A'; 715 Int_Loc += 1; 716 } /* if, while */ 717 if (Ch_Loc >= 'W' && Ch_Loc < 'Z') 718 /* then, not executed */ 719 Int_Loc = 7; 720 if (Ch_Loc == 'R') 721 /* then, not executed */ 722 return (true); 723 else /* executed */ 724 { 725 if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0) 726 /* then, not executed */ 727 { 728 Int_Loc += 7; 729 Int_Glob = Int_Loc; 730 return (true); 731 } 732 else /* executed */ 733 return (false); 734 } /* if Ch_Loc */ 735 } /* Func_2 */ 736 737 738 Boolean Func_3 (Enum_Par_Val) 739 /***************************/ 740 /* executed once */ 741 /* Enum_Par_Val == Ident_3 */ 742 Enumeration Enum_Par_Val; 743 { 744 Enumeration Enum_Loc; 745 746 Enum_Loc = Enum_Par_Val; 747 if (Enum_Loc == Ident_3) 748 /* then, executed */ 749 return (true); 750 else /* not executed */ 751 return (false); 752 } /* Func_3 */ 753 PREPROCESSOR LISTING 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 typedef enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5} 19 Enumeration; 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 typedef int ptrdiff_t; 43 typedef int size_t; 44 extern ICL9CAERRNO; 45 46 47 typedef int FILE; 48 int remove (); 49 int rename (); 50 FILE *tmpfile (); 51 char *tmpnam (); 52 53 int fclose (); 54 int fflush (); 55 56 FILE *fopen (); 57 FILE *freopen (); 58 59 int setvbuf (); 60 void setbuf (); 61 62 int fprintf (); 63 int printf (); 64 int sprintf (); 65 66 int fscanf (); 67 int scanf (); 68 int sscanf (); 69 70 int fgetc (); 71 int getc (); 72 int getchar (); 73 74 char *fgets (); 75 char *gets (); 76 77 int fputc (); 78 int putc (); 79 int putchar (); 80 81 int fputs (); 82 int puts (); 83 84 int ungetc (); 85 86 int fread (); 87 int fwrite (); 88 89 int fseek (); 90 long ftell (); 91 void rewind (); 92 93 void clearerr (); 94 int feof (); 95 int ferror (); 96 void perror (); 97 98 99 100 101 102 typedef int One_Thirty; 103 typedef int One_Fifty; 104 typedef char Capital_Letter; 105 typedef int Boolean; 106 typedef char Str_30 [31]; 107 typedef int Arr_1_Dim [50]; 108 typedef int Arr_2_Dim [50] [50]; 109 110 typedef struct record 111 { 112 struct record *Ptr_Comp; 113 Enumeration Discr; 114 union { 115 struct { 116 Enumeration Enum_Comp; 117 int Int_Comp; 118 char Str_Comp [31]; 119 } var_1; 120 struct { 121 Enumeration E_Comp_2; 122 char Str_2_Comp [31]; 123 } var_2; 124 struct { 125 char Ch_1_Comp; 126 char Ch_2_Comp; 127 } var_3; 128 } variant; 129 } Rec_Type, *Rec_Pointer; 130 131 132 133 134 135 extern int Int_Glob; 136 extern char Ch_1_Glob; 137 138 139 Proc_6 (Enum_Val_Par, Enum_Ref_Par) 140 141 142 143 144 Enumeration Enum_Val_Par; 145 Enumeration *Enum_Ref_Par; 146 { 147 *Enum_Ref_Par = Enum_Val_Par; 148 if (! Func_3 (Enum_Val_Par)) 149 150 *Enum_Ref_Par = Ident_4; 151 switch (Enum_Val_Par) 152 { 153 case Ident_1: 154 *Enum_Ref_Par = Ident_1; 155 break; 156 case Ident_2: 157 if (Int_Glob > 100) 158 159 *Enum_Ref_Par = Ident_1; 160 else *Enum_Ref_Par = Ident_4; 161 break; 162 case Ident_3: 163 *Enum_Ref_Par = Ident_2; 164 break; 165 case Ident_4: break; 166 case Ident_5: 167 *Enum_Ref_Par = Ident_3; 168 break; 169 } 170 } 171 172 173 Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref) 174 175 176 177 178 179 180 181 182 One_Fifty Int_1_Par_Val; 183 One_Fifty Int_2_Par_Val; 184 One_Fifty *Int_Par_Ref; 185 { 186 One_Fifty Int_Loc; 187 188 Int_Loc = Int_1_Par_Val + 2; 189 *Int_Par_Ref = Int_2_Par_Val + Int_Loc; 190 } 191 192 193 Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val) 194 195 196 197 198 Arr_1_Dim Arr_1_Par_Ref; 199 Arr_2_Dim Arr_2_Par_Ref; 200 int Int_1_Par_Val; 201 int Int_2_Par_Val; 202 { 203 One_Fifty Int_Index; 204 One_Fifty Int_Loc; 205 Int_Loc = Int_1_Par_Val + 5; 206 Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val; 207 Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc]; 208 Arr_1_Par_Ref [Int_Loc+30] = Int_Loc; 209 for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index) 210 Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc; 211 Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1; 212 Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc]; 213 Int_Glob = 5; 214 } 215 216 217 Enumeration Func_1 (Ch_1_Par_Val, Ch_2_Par_Val) 218 219 220 221 222 223 224 Capital_Letter Ch_1_Par_Val; 225 Capital_Letter Ch_2_Par_Val; 226 { 227 Capital_Letter Ch_1_Loc; 228 Capital_Letter Ch_2_Loc; 229 230 Ch_1_Loc = Ch_1_Par_Val; 231 Ch_2_Loc = Ch_1_Loc; 232 if (Ch_2_Loc != Ch_2_Par_Val) 233 234 return (Ident_1); 235 else 236 { 237 Ch_1_Glob = Ch_1_Loc; 238 return (Ident_2); 239 } 240 } 241 242 243 Boolean Func_2 (Str_1_Par_Ref, Str_2_Par_Ref) 244 245 246 247 248 249 Str_30 Str_1_Par_Ref; 250 Str_30 Str_2_Par_Ref; 251 { 252 One_Thirty Int_Loc; 253 Capital_Letter Ch_Loc; 254 255 Int_Loc = 2; 256 while (Int_Loc <= 2) 257 if (Func_1 (Str_1_Par_Ref[Int_Loc], 258 Str_2_Par_Ref[Int_Loc+1]) == Ident_1) 259 260 { 261 Ch_Loc = 'A'; 262 Int_Loc += 1; 263 } 264 if (Ch_Loc >= 'W' && Ch_Loc < 'Z') 265 266 Int_Loc = 7; 267 if (Ch_Loc == 'R') 268 269 return (1); 270 else 271 { 272 if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0) 273 274 { 275 Int_Loc += 7; 276 Int_Glob = Int_Loc; 277 return (1); 278 } 279 else 280 return (0); 281 } 282 } 283 284 285 Boolean Func_3 (Enum_Par_Val) 286 287 288 289 Enumeration Enum_Par_Val; 290 { 291 Enumeration Enum_Loc; 292 293 Enum_Loc = Enum_Par_Val; 294 if (Enum_Loc == Ident_3) 295 296 return (1); 297 else 298 return (0); 299 } 300 301