Go to the source code of this file.
Data Structures | |
| struct | defs |
Functions | |
| array (a, size, start) | |
| clobber (int x, int *y) | |
| int * | fip (int x) |
| glork (int x) | |
| main (int n, char **args) | |
| McCarthy (int x) | |
| one () | |
| long | pow2 (long n) |
| regc () | |
| regi () | |
| regp () | |
| s22 (struct defs *pd0) | |
| s241 (struct defs *pd0) | |
| s243 (struct defs *pd0) | |
| s244 (struct defs *pd0) | |
| s25 (struct defs *pd0) | |
| s26 (struct defs *pd0) | |
| s4 (struct defs *pd0) | |
| s61 (struct defs *pd0) | |
| s626 (struct defs *pd0) | |
| s71 (struct defs *pd0) | |
| s714 (struct defs *pd0) | |
| s715 (struct defs *pd0) | |
| s715f (int x, int y, int z) | |
| s72 (struct defs *pd0) | |
| s757 (struct defs *pd0) | |
| s7813 (struct defs *pd0) | |
| s81 (struct defs *pd0) | |
| s84 (struct defs *pd0) | |
| s85 (struct defs *pd0) | |
| s86 (struct defs *pd0) | |
| s88 (struct defs *pd0) | |
| s9 (struct defs *pd0) | |
| setev () | |
| sumof (char *x) | |
| svtest (int n) | |
| testev () | |
| zero () | |
| zerofill (char *x) | |
Variables | |
| int | crc |
| int | dbits |
| float | dprec |
| int | extvar |
| int | fbits |
| int | flgd |
| int | flgl |
| int | flgm |
| int | flgs |
| float | fprec |
| int | lbits |
| int * | metricp |
| char | rfs [8] |
| int | rrc |
| int | ubits |
|
||||||||||||||||
|
Definition at line 4878 of file cq.c. Referenced by array(), bbcall(), bbentry(), bbvars(), compose(), dcllocal(), dclr(), doglobal(), gettok(), initializer(), mkstr(), prof_init(), s84(), swcode(), and uid2type(). 04880 {
04881 int i;
04882 for(i=0; i<size; i++)
04883 if(a[i] != i+start) return 1;
04884
04885 return 0;
04886 }
|
|
||||||||||||
|
Definition at line 1164 of file cq.c. Referenced by s71().
|
|
|
Definition at line 4887 of file cq.c. References y. Referenced by s84(). 04889 {
04890 static int y;
04891 y = x;
04892 return &y;
04893 }
|
|
|
Definition at line 4894 of file cq.c. Referenced by s84(). 04896 {return x;}
|
|
||||||||||||
|
Definition at line 19 of file cq.c. References defs::crc, defs::flgd, defs::flgl, defs::flgm, defs::flgs, int(), j, printf(), defs::rfs, defs::rrc, s22(), s241(), s243(), s244(), s25(), s26(), s4(), s61(), s626(), s71(), s714(), s715(), s72(), s757(), s7813(), s81(), s84(), s85(), s86(), s88(), and s9(). 00022 {
00023
00024 /* This program performs a series of tests on a C compiler,
00025 based on information in the
00026
00027 C REFERENCE MANUAL
00028
00029 which appears as Appendix A to the book "The C Programming
00030 Language" by Brian W. Kernighan and Dennis M. Ritchie
00031 (Prentice-Hall, 1978, $10.95). This Appendix is hereafter
00032 referred to as "the Manual".
00033
00034 The rules followed in writing this program are:
00035
00036 1. The entire program is written in legal C, according
00037 to the Manual. It should compile with no error messages,
00038 although some warning messages may be produced by some
00039 compilers. Failure to compile should be interpreted as
00040 a compiler error.
00041
00042 2. The program is clean, in that it does not make use
00043 of any features of the operating system on which it runs,
00044 with the sole exceptions of the printf() function, and an
00045 internal "options" routine, which is easily excised.
00046
00047 3. No global variables are used, except for the spec-
00048 ific purpose of testing the global variable facility.
00049
00050 The program is divided into modules having names of the
00051 form snnn... These modules correspond to those sections of the
00052 Manual, as identified by boldface type headings, in which
00053 there is something to test. For example, s241() corresponds
00054 to section 2.4.1 of the Manual (Integer constants) and tests
00055 the facilities described therein. The module numbering
00056 scheme is ambiguous, especially when it names modules
00057 referring to more than one section; module s7813, for ex-
00058 ample, deals with sections 7.8 through 7.13. Nonetheless,
00059 it is surprisingly easy to find a section in the Manual
00060 corresponding to a section of code, and vice versa.
00061
00062 Note also that there seem to be "holes" in the program,
00063 at least from the point of view that there exist sections in the
00064 Manual for which there is no corresponding code. Such holes
00065 arise from three causes: (a) there is nothing in that partic-
00066 ular section to test, (b) everything in that section is tested
00067 elsewhere, and (c) it was deemed advisable not to check cer-
00068 tain features like preprocessor or listing control features.
00069
00070 Modules are called by a main program main(). The mod-
00071 ules that are called, and the sequence in which they are
00072 called, are determined by two lists in main(), in which the
00073 module names appear. The first list (an extern statement)
00074 declares the module names to be external. The second (a stat-
00075 ic int statement) names the modules and defines the sequence
00076 in which they are called. There is no need for these lists
00077 to be in the same order, but it is probably a good idea to keep
00078 them that way in the interest of clarity. Since there are no
00079 cross-linkages between modules, new modules may be added,
00080 or old ones deleted, simply by editing the lists, with one
00081 exception: section s26, which pokes around at the hardware
00082 trying to figure out the characteristics of the machine that
00083 it is running on, saves information that is subsequently
00084 used by sections s626, s72, and s757. If this program is
00085 to be broken up into smallish pieces, say for running on
00086 a microcomputer, take care to see that s26 is called before
00087 calling any of the latter three sections. The size
00088 of the lists, i.e., the number of modules to be called, is
00089 not explicitly specified as a program parameter, but is
00090 determined dynamically using the sizeof operator.
00091
00092 Communication between the main program and the modules
00093 takes place in two ways. In all cases, a pointer to a structure
00094 is passed to the called module. The structure contains flags
00095 that will determine the type of information to be published
00096 by the module, and fields that may be written in by the
00097 module. The former include "flgm" and "flgd", which, if set
00098 to a nonzero value, specify that machine dependencies are to
00099 be announced or that error messages are to be printed, re-
00100 spectively. The called module's name, and the hardware char-
00101 acteristics probed in s26() comprise the latter.
00102
00103
00104 Also, in all cases, a return code is returned by the called
00105 module. A return code of zero indicates that all has gone well;
00106 nonzero indicates otherwise. Since more than one type of error
00107 may be detected by a module, the return code is a composite
00108 of error indicators, which, individually, are given as numbers
00109 that are powers of two. Thus, a return code of 10 indicates
00110 that two specific errors, 8 and 2, were detected. Whether or
00111 not the codes returned by the modules are printed by the main
00112 program is determined by setting "flgs" to 1 (resp. 0).
00113
00114 The entire logic of the main program is contained in the
00115 half-dozen or so lines at the end. The somewhat cryptic
00116 statement:
00117
00118 d0.rrc = (*sec[j])(pd0);
00119
00120 in the for loop calls the modules. The rest of the code is
00121 reasonably straightforward.
00122
00123 Finally, in each of the modules, there is the following
00124 prologue:
00125
00126 snnn(pd0)
00127 struct defs *pd0;
00128 {
00129 static char snnner[] = "snnn,er%d\n";
00130 static char qsnnn[8] = "snnn ";
00131 char *ps, *pt;
00132 int rc;
00133
00134 rc = 0;
00135 ps = qsnnn;
00136 pt = pd0->rfs;
00137 while(*pt++ = *ps++);
00138
00139 used for housekeeping, handshaking and module initialization.
00140
00141 */
00142 extern
00143 s22(),
00144 s241(),
00145 s243(),
00146 s244(),
00147 s25(),
00148 s26(),
00149 s4(),
00150 s61(),
00151 s626(),
00152 s71(),
00153 s72(),
00154 s757(),
00155 s7813(),
00156 s714(),
00157 s715(),
00158 s81(),
00159 s84(),
00160 s85(),
00161 s86(),
00162 s88(),
00163 s9()
00164 ;
00165
00166 int j;
00167 static int (*sec[])() = {
00168 s22,
00169 s241,
00170 s243,
00171 s244,
00172 s25,
00173 s26,
00174 s4,
00175 s61,
00176 s626,
00177 s71,
00178 s72,
00179 s757,
00180 s7813,
00181 s714,
00182 s715,
00183 s81,
00184 s84,
00185 s85,
00186 s86,
00187 s88,
00188 s9
00189 };
00190
00191 static struct defs d0, *pd0;
00192
00193 d0.flgs = 1; /* These flags dictate */
00194 d0.flgm = 1; /* the verbosity of */
00195 d0.flgd = 1; /* the program. */
00196 d0.flgl = 1;
00197
00198 pd0 = &d0;
00199
00200 for (j=0; j<sizeof(sec) / sizeof(sec[0]); j++) {
00201 d0.rrc = (*sec[j])(pd0);
00202 d0.crc = d0.crc+d0.rrc;
00203 if(d0.flgs != 0) printf("Section %s returned %d.\n",d0.rfs,d0.rrc);
00204 }
00205
00206 if(d0.crc == 0) printf("\nNo errors detected.\n");
00207 else printf("\nFailed.\n");
00208 return 0;
00209 }
|
Here is the call graph for this function:

|
|
Definition at line 1158 of file cq.c. References x. Referenced by s71().
|
|
|
Definition at line 5176 of file cq.c. Referenced by s26(), s7813(), s86(), and VectorArrayNormalize(). 05176 {
05177 return 1;
05178 }
|
|
|
Definition at line 420 of file cq.c. Referenced by s241().
|
|
|
Definition at line 4266 of file cq.c. Referenced by s81(). 04266 { /* char to register assignment */
04267 /* Testing a variable whose storage class has been spec-
04268 ified as "register" is somewhat tricky, but it can be done in a
04269 fairly reliable fashion by taking advantage of our knowledge of the
04270 ways in which compilers operate. If we declare a collection of vari-
04271 ables of the same storage class, we would expect that, when storage
04272 for these variables is actually allocated, the variables will be
04273 bunched together and ordered according to one of the following
04274 criteria:
04275
04276 (a) the order in which they were defined.
04277 (b) the order in which they are used.
04278 (c) alphabetically.
04279 (d) the order in which they appear in the compiler's
04280 symbol table.
04281 (e) some other way.
04282
04283 Hence, if we define a sequence of variables in close alpha-
04284 betical order, and use them in the same order in which we define
04285 them, we would expect the differences between the addresses of
04286 successive variables to be constant, except in case (d) where the
04287 symbol table is a hash table, or in case (e). If a subsequence in
04288 the middle of this sequence is selected, and for this subsequence,
04289 every other variable is specified to be "register", and address
04290 differences are taken between adjacent nonregister variables, we would
04291 still expect to find constant differences if the "register" vari-
04292 ables were actually assigned to registers, and some other diff-
04293 erences if they were not. Specifically, if we had N variables
04294 specified as "register" of which the first n were actually ass-
04295 igned to registers, we would expect the sequence of differences
04296 to consist of a number of occurrences of some number, followed by
04297 N-n occurrences of some other number, followed by several occurr-
04298 ences of the first number. If we get a sequence like this, we can
04299 determine, by simple subtraction, how many (if any) variables are
04300 being assigned to registers. If we get some other sequence, we know
04301 that the test is invalid. */
04302
04303 char r00;
04304 char r01;
04305 char r02;
04306 char r03;
04307 register char r04;
04308 char r05;
04309 register char r06;
04310 char r07;
04311 register char r08;
04312 char r09;
04313 register char r10;
04314 char r11;
04315 register char r12;
04316 char r13;
04317 register char r14;
04318 char r15;
04319 register char r16;
04320 char r17;
04321 register char r18;
04322 char r19;
04323 register char r20;
04324 char r21;
04325 register char r22;
04326 char r23;
04327 register char r24;
04328 char r25;
04329 register char r26;
04330 char r27;
04331 register char r28;
04332 char r29;
04333 register char r30;
04334 char r31;
04335 register char r32;
04336 char r33;
04337 register char r34;
04338 char r35;
04339 char r36;
04340 char r37;
04341 char r38;
04342
04343 int s, n1, n2, nr, j, d[22];
04344 r00 = 0;
04345 r01 = 1;
04346 r02 = 2;
04347 r03 = 3;
04348 r04 = 4;
04349 r05 = 5;
04350 r06 = 6;
04351 r07 = 7;
04352 r08 = 8;
04353 r09 = 9;
04354 r10 = 10;
04355 r11 = 11;
04356 r12 = 12;
04357 r13 = 13;
04358 r14 = 14;
04359 r15 = 15;
04360 r16 = 16;
04361 r17 = 17;
04362 r18 = 18;
04363 r19 = 19;
04364 r20 = 20;
04365 r21 = 21;
04366 r22 = 22;
04367 r23 = 23;
04368 r24 = 24;
04369 r25 = 25;
04370 r26 = 26;
04371 r27 = 27;
04372 r28 = 28;
04373 r29 = 29;
04374 r30 = 30;
04375 r31 = 31;
04376 r32 = 32;
04377 r33 = 33;
04378 r34 = 34;
04379 r35 = 35;
04380 r36 = 36;
04381 r37 = 37;
04382 r38 = 38;
04383
04384 d[0] = &r01 - &r00;
04385 d[1] = &r02 - &r01;
04386 d[2] = &r03 - &r02;
04387 d[3] = &r05 - &r03;
04388 d[4] = &r07 - &r05;
04389 d[5] = &r09 - &r07;
04390 d[6] = &r11 - &r09;
04391 d[7] = &r13 - &r11;
04392 d[8] = &r15 - &r13;
04393 d[9] = &r17 - &r15;
04394 d[10] = &r19 - &r17;
04395 d[11] = &r21 - &r19;
04396 d[12] = &r23 - &r21;
04397 d[13] = &r25 - &r23;
04398 d[14] = &r27 - &r25;
04399 d[15] = &r29 - &r27;
04400 d[16] = &r31 - &r29;
04401 d[17] = &r33 - &r31;
04402 d[18] = &r35 - &r33;
04403 d[19] = &r36 - &r35;
04404 d[20] = &r37 - &r36;
04405 d[21] = &r38 - &r37;
04406
04407
04408 /* The following FSM analyzes the string of differences. It accepts
04409 strings of the form a+b+a+ and returns 16 minus the number of bs,
04410 which is the number of variables that actually got into registers.
04411 Otherwise it signals rejection by returning -1., indicating that the
04412 test is unreliable. */
04413
04414 n1 = d[0];
04415 s = 1;
04416
04417 for (j=0; j<22; j++)
04418 switch (s) {
04419 case 1: if (d[j] != n1) {
04420 n2 = d[j];
04421 s = 2;
04422 nr = 1;
04423 }
04424 break;
04425 case 2: if (d[j] == n1) {
04426 s = 3;
04427 break;
04428 }
04429 if (d[j] == n2) {
04430 nr = nr+1;
04431 break;
04432 }
04433 s = 4;
04434 break;
04435 case 3: if (d[j] != n1) s = 4;
04436 break;
04437 }
04438 ;
04439
04440 if (s == 3) return 16-nr;
04441 else return -1;
04442 }
|
|
|
Definition at line 4443 of file cq.c. Referenced by s81(). 04443 { /* int to register assignment */
04444 /* Testing a variable whose storage class has been spec-
04445 ified as "register" is somewhat tricky, but it can be done in a
04446 fairly reliable fashion by taking advantage of our knowledge of the
04447 ways in which compilers operate. If we declare a collection of vari-
04448 ables of the same storage class, we would expect that, when storage
04449 for these variables is actually allocated, the variables will be
04450 bunched together and ordered according to one of the following
04451 criteria:
04452
04453 (a) the order in which they were defined.
04454 (b) the order in which they are used.
04455 (c) alphabetically.
04456 (d) the order in which they appear in the compiler's
04457 symbol table.
04458 (e) some other way.
04459
04460 Hence, if we define a sequence of variables in close alpha-
04461 betical order, and use them in the same order in which we define
04462 them, we would expect the differences between the addresses of
04463 successive variables to be constant, except in case (d) where the
04464 symbol table is a hash table, or in case (e). If a subsequence in
04465 the middle of this sequence is selected, and for this subsequence,
04466 every other variable is specified to be "register", and address
04467 differences are taken between adjacent nonregister variables, we would
04468 still expect to find constant differences if the "register" vari-
04469 ables were actually assigned to registers, and some other diff-
04470 erences if they were not. Specifically, if we had N variables
04471 specified as "register" of which the first n were actually ass-
04472 igned to registers, we would expect the sequence of differences
04473 to consist of a number of occurrences of some number, followed by
04474 N-n occurrences of some other number, followed by several occurr-
04475 ences of the first number. If we get a sequence like this, we can
04476 determine, by simple subtraction, how many (if any) variables are
04477 being assigned to registers. If we get some other sequence, we know
04478 that the test is invalid. */
04479
04480
04481 int r00;
04482 int r01;
04483 int r02;
04484 int r03;
04485 register int r04;
04486 int r05;
04487 register int r06;
04488 int r07;
04489 register int r08;
04490 int r09;
04491 register int r10;
04492 int r11;
04493 register int r12;
04494 int r13;
04495 register int r14;
04496 int r15;
04497 register int r16;
04498 int r17;
04499 register int r18;
04500 int r19;
04501 register int r20;
04502 int r21;
04503 register int r22;
04504 int r23;
04505 register int r24;
04506 int r25;
04507 register int r26;
04508 int r27;
04509 register int r28;
04510 int r29;
04511 register int r30;
04512 int r31;
04513 register int r32;
04514 int r33;
04515 register int r34;
04516 int r35;
04517 int r36;
04518 int r37;
04519 int r38;
04520
04521 int s, n1, n2, nr, j, d[22];
04522
04523 r00 = 0;
04524 r01 = 1;
04525 r02 = 2;
04526 r03 = 3;
04527 r04 = 4;
04528 r05 = 5;
04529 r06 = 6;
04530 r07 = 7;
04531 r08 = 8;
04532 r09 = 9;
04533 r10 = 10;
04534 r11 = 11;
04535 r12 = 12;
04536 r13 = 13;
04537 r14 = 14;
04538 r15 = 15;
04539 r16 = 16;
04540 r17 = 17;
04541 r18 = 18;
04542 r19 = 19;
04543 r20 = 20;
04544 r21 = 21;
04545 r22 = 22;
04546 r23 = 23;
04547 r24 = 24;
04548 r25 = 25;
04549 r26 = 26;
04550 r27 = 27;
04551 r28 = 28;
04552 r29 = 29;
04553 r30 = 30;
04554 r31 = 31;
04555 r32 = 32;
04556 r33 = 33;
04557 r34 = 34;
04558 r35 = 35;
04559 r36 = 36;
04560 r37 = 37;
04561 r38 = 38;
04562
04563 d[0] = &r01 - &r00;
04564 d[1] = &r02 - &r01;
04565 d[2] = &r03 - &r02;
04566 d[3] = &r05 - &r03;
04567 d[4] = &r07 - &r05;
04568 d[5] = &r09 - &r07;
04569 d[6] = &r11 - &r09;
04570 d[7] = &r13 - &r11;
04571 d[8] = &r15 - &r13;
04572 d[9] = &r17 - &r15;
04573 d[10] = &r19 - &r17;
04574 d[11] = &r21 - &r19;
04575 d[12] = &r23 - &r21;
04576 d[13] = &r25 - &r23;
04577 d[14] = &r27 - &r25;
04578 d[15] = &r29 - &r27;
04579 d[16] = &r31 - &r29;
04580 d[17] = &r33 - &r31;
04581 d[18] = &r35 - &r33;
04582 d[19] = &r36 - &r35;
04583 d[20] = &r37 - &r36;
04584 d[21] = &r38 - &r37;
04585
04586
04587 /* The following FSM analyzes the string of differences. It accepts
04588 strings of the form a+b+a+ and returns 16 minus the number of bs,
04589 which is the number of variables that actually got into registers.
04590 Otherwise it signals rejection by returning -1., indicating that the
04591 test is unreliable. */
04592
04593 n1 = d[0];
04594 s = 1;
04595
04596 for (j=0; j<22; j++)
04597 switch (s) {
04598 case 1: if (d[j] != n1) {
04599 n2 = d[j];
04600 s = 2;
04601 nr = 1;
04602 }
04603 break;
04604 case 2: if (d[j] == n1) {
04605 s = 3;
04606 break;
04607 }
04608 if (d[j] == n2) {
04609 nr = nr+1;
04610 break;
04611 }
04612 s = 4;
04613 break;
04614 case 3: if (d[j] != n1) s = 4;
04615 break;
04616 }
04617 ;
04618
04619 if (s == 3) return 16-nr;
04620 else return -1;
04621 }
|
|
|
Definition at line 4622 of file cq.c. Referenced by s81(). 04622 { /* pointer to register assignment */
04623 /* Testing a variable whose storage class has been spec-
04624 ified as "register" is somewhat tricky, but it can be done in a
04625 fairly reliable fashion by taking advantage of our knowledge of the
04626 ways in which compilers operate. If we declare a collection of vari-
04627 ables of the same storage class, we would expect that, when storage
04628 for these variables is actually allocated, the variables will be
04629 bunched together and ordered according to one of the following
04630 criteria:
04631
04632 (a) the order in which they were defined.
04633 (b) the order in which they are used.
04634 (c) alphabetically.
04635 (d) the order in which they appear in the compiler's
04636 symbol table.
04637 (e) some other way.
04638
04639 Hence, if we define a sequence of variables in close alpha-
04640 betical order, and use them in the same order in which we define
04641 them, we would expect the differences between the addresses of
04642 successive variables to be constant, except in case (d) where the
04643 symbol table is a hash table, or in case (e). If a subsequence in
04644 the middle of this sequence is selected, and for this subsequence,
04645 every other variable is specified to be "register", and address
04646 differences are taken between adjacent nonregister variables, we would
04647 still expect to find constant differences if the "register" vari-
04648 ables were actually assigned to registers, and some other diff-
04649 erences if they were not. Specifically, if we had N variables
04650 specified as "register" of which the first n were actually ass-
04651 igned to registers, we would expect the sequence of differences
04652 to consist of a number of occurrences of some number, followed by
04653 N-n occurrences of some other number, followed by several occurr-
04654 ences of the first number. If we get a sequence like this, we can
04655 determine, by simple subtraction, how many (if any) variables are
04656 being assigned to registers. If we get some other sequence, we know
04657 that the test is invalid. */
04658
04659
04660 int *r00;
04661 int *r01;
04662 int *r02;
04663 int *r03;
04664 register int *r04;
04665 int *r05;
04666 register int *r06;
04667 int *r07;
04668 register int *r08;
04669 int *r09;
04670 register int *r10;
04671 int *r11;
04672 register int *r12;
04673 int *r13;
04674 register int *r14;
04675 int *r15;
04676 register int *r16;
04677 int *r17;
04678 register int *r18;
04679 int *r19;
04680 register int *r20;
04681 int *r21;
04682 register int *r22;
04683 int *r23;
04684 register int *r24;
04685 int *r25;
04686 register int *r26;
04687 int *r27;
04688 register int *r28;
04689 int *r29;
04690 register int *r30;
04691 int *r31;
04692 register int *r32;
04693 int *r33;
04694 register int *r34;
04695 int *r35;
04696 int *r36;
04697 int *r37;
04698 int *r38;
04699
04700 int s, n1, n2, nr, j, d[22];
04701
04702 r00 = (int *)&r00;
04703 r01 = (int *)&r01;
04704 r02 = (int *)&r02;
04705 r03 = (int *)&r03;
04706 r04 = (int *)&r05;
04707 r05 = (int *)&r05;
04708 r06 = (int *)&r07;
04709 r07 = (int *)&r07;
04710 r08 = (int *)&r09;
04711 r09 = (int *)&r09;
04712 r10 = (int *)&r11;
04713 r11 = (int *)&r11;
04714 r12 = (int *)&r13;
04715 r13 = (int *)&r13;
04716 r14 = (int *)&r15;
04717 r15 = (int *)&r15;
04718 r16 = (int *)&r17;
04719 r17 = (int *)&r17;
04720 r18 = (int *)&r19;
04721 r19 = (int *)&r19;
04722 r20 = (int *)&r21;
04723 r21 = (int *)&r21;
04724 r22 = (int *)&r23;
04725 r23 = (int *)&r23;
04726 r24 = (int *)&r25;
04727 r25 = (int *)&r25;
04728 r26 = (int *)&r27;
04729 r27 = (int *)&r27;
04730 r28 = (int *)&r29;
04731 r29 = (int *)&r29;
04732 r30 = (int *)&r31;
04733 r31 = (int *)&r31;
04734 r32 = (int *)&r33;
04735 r33 = (int *)&r33;
04736 r34 = (int *)&r35;
04737 r35 = (int *)&r35;
04738 r36 = (int *)&r36;
04739 r37 = (int *)&r37;
04740 r38 = (int *)&r38;
04741
04742 d[0] = &r01 - &r00;
04743 d[1] = &r02 - &r01;
04744 d[2] = &r03 - &r02;
04745 d[3] = &r05 - &r03;
04746 d[4] = &r07 - &r05;
04747 d[5] = &r09 - &r07;
04748 d[6] = &r11 - &r09;
04749 d[7] = &r13 - &r11;
04750 d[8] = &r15 - &r13;
04751 d[9] = &r17 - &r15;
04752 d[10] = &r19 - &r17;
04753 d[11] = &r21 - &r19;
04754 d[12] = &r23 - &r21;
04755 d[13] = &r25 - &r23;
04756 d[14] = &r27 - &r25;
04757 d[15] = &r29 - &r27;
04758 d[16] = &r31 - &r29;
04759 d[17] = &r33 - &r31;
04760 d[18] = &r35 - &r33;
04761 d[19] = &r36 - &r35;
04762 d[20] = &r37 - &r36;
04763 d[21] = &r38 - &r37;
04764
04765
04766 /* The following FSM analyzes the string of differences. It accepts
04767 strings of the form a+b+a+ and returns 16 minus the number of bs,
04768 which is the number of variables that actually got into registers.
04769 Otherwise it signals rejection by returning -1., indicating that the
04770 test is unreliable. */
04771
04772 n1 = d[0];
04773 s = 1;
04774 for (j=0; j<22; j++)
04775 switch (s) {
04776 case 1: if (d[j] != n1) {
04777 n2 = d[j];
04778 s = 2;
04779 nr = 1;
04780 }
04781 break;
04782 case 2: if (d[j] == n1) {
04783 s = 3;
04784 break;
04785 }
04786 if (d[j] == n2) {
04787 nr = nr+1;
04788 break;
04789 }
04790 s = 4;
04791 break;
04792 case 3: if (d[j] != n1) s = 4;
04793 break;
04794 }
04795 ;
04796
04797 if (s == 3) return 16-nr;
04798 else return -1;
04799 }
|
|
|
Definition at line 210 of file cq.c. References A, a, and printf(). Referenced by main(). 00212 {
00213 int a234, a;
00214 int _, _234, A, rc;
00215
00216 static char s22er[] = "s22,er%d\n";
00217 static char qs22[8] = "s22 ";
00218
00219 char *ps, *pt;
00220 /* Initialize */
00221
00222 rc = 0;
00223 ps = qs22;
00224 pt = pd0 -> rfs;
00225 while (*pt++ = *ps++);
00226
00227 /* An identifier is a sequence of letters and digits;
00228 the first character must be a letter. The under-
00229 score _ counts as a letter. */
00230
00231 a=1;
00232 _=2;
00233 _234=3;
00234 a234=4;
00235 if(a+_+_234+a234 != 10) {
00236 rc = rc+1;
00237 if(pd0->flgd != 0) printf(s22er,1);
00238 }
00239
00240 /* Upper and lower case letters are different. */
00241
00242 A = 2;
00243 if (A == a) {
00244 rc = rc+4;
00245 if (pd0->flgd != 0) printf(s22er,4);
00246 }
00247
00248 return(rc);
00249 }
|
Here is the call graph for this function:

|
|
Definition at line 250 of file cq.c. References d, flgd, flgm, g(), j, L, l, pow2(), printf(), and x. Referenced by main(). 00253 {
00254 long pow2();
00255 static char s241er[] = "s241,er%d\n";
00256 static char qs241[8] = "s241 ";
00257 char *ps, *pt;
00258 int rc, j, lrc;
00259 static long g[39] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00260 0,6,0,8,0,12,0,16,0,18,0,20,0,24,
00261 0,28,0,30,0,32,0,36};
00262 long d[39], o[39], x[39];
00263
00264 rc = 0;
00265 lrc = 0;
00266 ps = qs241;
00267 pt = pd0 -> rfs;
00268 while (*pt++ = *ps++);
00269
00270 /* An integer constant consisting of a sequence of digits is
00271 taken to be octal if it begins with 0 (digit zero), decimal
00272 otherwise. */
00273
00274 if ( 8 != 010
00275 || 16 != 020
00276 || 24 != 030
00277 || 32 != 040
00278 || 40 != 050
00279 || 48 != 060
00280 || 56 != 070
00281 || 64 != 0100
00282 || 72 != 0110
00283 || 80 != 0120
00284 || 9 != 0011
00285 || 17 != 0021
00286 || 25 != 0031
00287 || 33 != 0041
00288 || 41 != 0051
00289 || 49 != 0061
00290 || 57 != 0071
00291 || 65 != 0101
00292 || 73 != 0111
00293 || 81 != 0121 ){
00294
00295 rc = rc+1;
00296 if( pd0->flgd != 0 ) printf(s241er,1);
00297 }
00298
00299 /* A sequence of digits preceded by 0x or 0X (digit zero)
00300 is taken to be a hexadecimal integer. The hexadecimal
00301 digits include a or A through f or F with values 10
00302 through 15. */
00303
00304 if ( 0x00abcdef != 0xabcdef
00305 || 0xabcdef != 0Xabcdef || 0Xabcdef != 0XAbcdef
00306 || 0XAbcdef != 0XABcdef || 0XABcdef != 0XABCdef
00307 || 0XABCdef != 0XABCDef || 0XABCDef != 0XABCDEf
00308 || 0XABCDEf != 0XABCDEF || 0xABCDEF != 11259375 ){
00309
00310 rc = rc+2;
00311 if( pd0->flgd != 0 ) printf(s241er,2);
00312 }
00313
00314 /* A decimal constant whose value exceeds the largest signed
00315 machine integer is taken to be long; an octal or hex con-
00316 stant which exceeds the largest unsigned machine integer
00317 is likewise taken to be long. */
00318
00319 if ( sizeof 010000000000 != sizeof(long) /* 2**30 */
00320 || sizeof 1073741824 != sizeof(long) /* ditto */
00321 || sizeof 0x40000000 != sizeof(long) ){ /* " */
00322
00323 rc = rc+4;
00324 if( pd0->flgd != 0 ) printf(s241er,4);
00325 }
00326
00327 /* A decimal, octal, or hexadecimal constant immediately followed
00328 by l (letter ell) or L is a long constant. */
00329
00330 if ( sizeof 67l != sizeof(long)
00331 || sizeof 67L != sizeof(long)
00332 || sizeof 067l != sizeof(long)
00333 || sizeof 067L != sizeof(long)
00334 || sizeof 0X67l != sizeof(long)
00335 || sizeof 0x67L != sizeof(long) ){
00336
00337 rc = rc+8;
00338 if( pd0 -> flgd != 0 ) printf(s241er,8);
00339 }
00340
00341 /* Finally, we test to see that decimal (d), octal (o),
00342 and hexadecimal (x) constants representing the same values
00343 agree among themselves, and with computed values, at spec-
00344 ified points over an appropriate range. The points select-
00345 ed here are those with the greatest potential for caus-
00346 ing trouble, i.e., zero, 1-16, and values of 2**n and
00347 2**n - 1 where n is some multiple of 4 or 6. Unfortunately,
00348 just what happens when a value is too big to fit in a
00349 long is undefined; however, it would be nice if what
00350 happened were at least consistent... */
00351
00352 for ( j=0; j<17; j++ ) g[j] = j;
00353 for ( j=18; j<39; ) {
00354 g[j] = pow2(g[j]);
00355 g[j-1] = g[j] - 1;
00356 j = j+2;
00357 }
00358
00359 d[0] = 0; o[0] = 00; x[0] = 0x0;
00360 d[1] = 1; o[1] = 01; x[1] = 0x1;
00361 d[2] = 2; o[2] = 02; x[2] = 0x2;
00362 d[3] = 3; o[3] = 03; x[3] = 0x3;
00363 d[4] = 4; o[4] = 04; x[4] = 0x4;
00364 d[5] = 5; o[5] = 05; x[5] = 0x5;
00365 d[6] = 6; o[6] = 06; x[6] = 0x6;
00366 d[7] = 7; o[7] = 07; x[7] = 0x7;
00367 d[8] = 8; o[8] = 010; x[8] = 0x8;
00368 d[9] = 9; o[9] = 011; x[9] = 0x9;
00369 d[10] = 10; o[10] = 012; x[10] = 0xa;
00370 d[11] = 11; o[11] = 013; x[11] = 0xb;
00371 d[12] = 12; o[12] = 014; x[12] = 0xc;
00372 d[13] = 13; o[13] = 015; x[13] = 0xd;
00373 d[14] = 14; o[14] = 016; x[14] = 0xe;
00374 d[15] = 15; o[15] = 017; x[15] = 0xf;
00375 d[16] = 16; o[16] = 020; x[16] = 0x10;
00376 d[17] = 63; o[17] = 077; x[17] = 0x3f;
00377 d[18] = 64; o[18] = 0100; x[18] = 0x40;
00378 d[19] = 255; o[19] = 0377; x[19] = 0xff;
00379 d[20] = 256; o[20] = 0400; x[20] = 0x100;
00380 d[21] = 4095; o[21] = 07777; x[21] = 0xfff;
00381 d[22] = 4096; o[22] = 010000; x[22] = 0x1000;
00382 d[23] = 65535; o[23] = 0177777; x[23] = 0xffff;
00383 d[24] = 65536; o[24] = 0200000; x[24] = 0x10000;
00384 d[25] = 262143; o[25] = 0777777; x[25] = 0x3ffff;
00385 d[26] = 262144; o[26] = 01000000; x[26] = 0x40000;
00386 d[27] = 1048575; o[27] = 03777777; x[27] = 0xfffff;
00387 d[28] = 1048576; o[28] = 04000000; x[28] = 0x100000;
00388 d[29] = 16777215; o[29] = 077777777; x[29] = 0xffffff;
00389 d[30] = 16777216; o[30] = 0100000000; x[30] = 0x1000000;
00390 d[31] = 268435455; o[31] = 01777777777; x[31] = 0xfffffff;
00391 d[32] = 268435456; o[32] = 02000000000; x[32] = 0x10000000;
00392 d[33] = 1073741823; o[33] = 07777777777; x[33] = 0x3fffffff;
00393 d[34] = 1073741824; o[34] = 010000000000; x[34] = 0x40000000;
00394 d[35] = 4294967295; o[35] = 037777777777; x[35] = 0xffffffff;
00395 d[36] = 4294967296; o[36] = 040000000000; x[36] = 0x100000000;
00396 d[37] = 68719476735; o[37] = 0777777777777; x[37] = 0xfffffffff;
00397 d[38] = 68719476736; o[38] = 01000000000000; x[38] = 0x1000000000;
00398
00399 /* WHEW! */
00400
00401 for (j=0; j<39; j++){
00402 if ( g[j] != d[j]
00403 || d[j] != o[j]
00404 || o[j] != x[j]) {
00405
00406 if( pd0 -> flgm != 0 ) {
00407 /* printf(s241er,16); save in case opinions change... */
00408 printf("Decimal and octal/hex constants sometimes give\n");
00409 printf(" different results when assigned to longs.\n");
00410 }
00411 /* lrc = 1; save... */
00412 }
00413 }
00414
00415 if (lrc != 0) rc =16;
00416
00417 return rc;
00418 }
|
Here is the call graph for this function:

|
|
Definition at line 428 of file cq.c. References printf(), defs::rfs, sumof(), and zerofill(). Referenced by main(). 00430 {
00431 static char s243er[] = "s243,er%d\n";
00432 static char qs243[8] = "s243 ";
00433 char *ps, *pt;
00434 int rc;
00435 char chars[256];
00436
00437 rc = 0;
00438 ps = qs243;
00439 pt = pd0->rfs;
00440 while(*pt++ = *ps++);
00441
00442 /* One of the problems that arises when testing character constants
00443 is that of definition: What, exactly, is the character set?
00444 In order to guarantee a certain amount of machine independence,
00445 the character set we will use here is the set of characters writ-
00446 able as escape sequences in C, plus those characters used in writ-
00447 ing C programs, i.e.,
00448
00449 letters:
00450 ABCDEFGHIJKLMNOPQRSTUVWXYZ 26
00451 abcdefghijklmnopqrstuvwxyz 26
00452 numbers:
00453 0123456789 10
00454 special characters:
00455 ~!"#%&()_=-^|{}[]+;*:<>,.?/ 27
00456 extra special characters:
00457 newline \n
00458 horizontal tab \t
00459 backspace \b
00460 carriage return \r
00461 form feed \f
00462 backslash \\
00463 single quote \' 7
00464 blank & NUL 2
00465 ---
00466 98
00467
00468 Any specific implementation of C may of course support additional
00469 characters. */
00470
00471 /* Since the value of a character constant is the numerical value
00472 of the character in the machine's character set, there should
00473 be a one-to-one correspondence between characters and values. */
00474
00475 zerofill(chars);
00476
00477 chars['a'] = 1; chars['A'] = 1; chars['~'] = 1; chars['0'] = 1;
00478 chars['b'] = 1; chars['B'] = 1; chars['!'] = 1; chars['1'] = 1;
00479 chars['c'] = 1; chars['C'] = 1; chars['"'] = 1; chars['2'] = 1;
00480 chars['d'] = 1; chars['D'] = 1; chars['#'] = 1; chars['3'] = 1;
00481 chars['e'] = 1; chars['E'] = 1; chars['%'] = 1; chars['4'] = 1;
00482 chars['f'] = 1; chars['F'] = 1; chars['&'] = 1; chars['5'] = 1;
00483 chars['g'] = 1; chars['G'] = 1; chars['('] = 1; chars['6'] = 1;
00484 chars['h'] = 1; chars['H'] = 1; chars[')'] = 1; chars['7'] = 1;
00485 chars['i'] = 1; chars['I'] = 1; chars['_'] = 1; chars['8'] = 1;
00486 chars['j'] = 1; chars['J'] = 1; chars['='] = 1; chars['9'] = 1;
00487 chars['k'] = 1; chars['K'] = 1; chars['-'] = 1;
00488 chars['l'] = 1; chars['L'] = 1; chars['^'] = 1;
00489 chars['m'] = 1; chars['M'] = 1; chars['|'] = 1; chars['\n'] = 1;
00490 chars['n'] = 1; chars['N'] = 1; chars['\t'] = 1;
00491 chars['o'] = 1; chars['O'] = 1; chars['{'] = 1; chars['\b'] = 1;
00492 chars['p'] = 1; chars['P'] = 1; chars['}'] = 1; chars['\r'] = 1;
00493 chars['q'] = 1; chars['Q'] = 1; chars['['] = 1; chars['\f'] = 1;
00494 chars['r'] = 1; chars['R'] = 1; chars[']'] = 1;
00495 chars['s'] = 1; chars['S'] = 1; chars['+'] = 1; chars['\\'] = 1;
00496 chars['t'] = 1; chars['T'] = 1; chars[';'] = 1; chars['\''] = 1;
00497 chars['u'] = 1; chars['U'] = 1; chars['*'] = 1;
00498 chars['v'] = 1; chars['V'] = 1; chars[':'] = 1; chars['\0'] = 1;
00499 chars['w'] = 1; chars['W'] = 1; chars['<'] = 1; chars[' '] = 1;
00500 chars['x'] = 1; chars['X'] = 1; chars['>'] = 1;
00501 chars['y'] = 1; chars['Y'] = 1; chars[','] = 1;
00502 chars['z'] = 1; chars['Z'] = 1; chars['.'] = 1;
00503 chars['?'] = 1;
00504 chars['/'] = 1;
00505
00506 if(sumof(chars) != 98){
00507 rc = rc+1;
00508 if(pd0->flgd != 0) printf(s243er,1);
00509 }
00510
00511 /* Finally, the escape \ddd consists of the backslash followed
00512 by 1, 2, or 3 octal digits which are taken to specify the
00513 desired character. */
00514
00515 if( '\0' != 0 || '\01' != 1 || '\02' != 2
00516 || '\03' != 3 || '\04' != 4 || '\05' != 5
00517 || '\06' != 6 || '\07' != 7 || '\10' != 8
00518 || '\17' != 15 || '\20' != 16 || '\77' != 63
00519 || '\100' != 64 || '\177' != 127 ){
00520
00521 rc = rc+8;
00522 if(pd0->flgd != 0) printf(s243er,8);
00523 }
00524
00525 return rc;
00526 }
|
Here is the call graph for this function:

|
|
Definition at line 546 of file cq.c. References a, e, j, printf(), and defs::rfs. Referenced by main(). 00548 {
00549 double a[8];
00550 int rc, lrc, j;
00551 static char s244er[] = "s244,er%d\n";
00552 static char qs244[8] = "s244 ";
00553 char *ps, *pt;
00554
00555 ps = qs244;
00556 pt = pd0->rfs;
00557 while(*pt++ = *ps++);
00558 rc = 0;
00559 lrc = 0;
00560
00561 /* Unfortunately, there's not a lot we can do with floating constants.
00562 We can check to see that the various representations can be com-
00563 piled, that the conversion is such that they yield the same hard-
00564 ware representations in all cases, and that all representations
00565 thus checked are double precision. */
00566
00567 a[0] = .1250E+04;
00568 a[1] = 1.250E3;
00569 a[2] = 12.50E02;
00570 a[3] = 125.0e+1;
00571 a[4] = 1250e00;
00572 a[5] = 12500.e-01;
00573 a[6] = 125000e-2;
00574 a[7] = 1250.;
00575
00576 lrc = 0;
00577 for (j=0; j<7; j++) if(a[j] != a[j+1]) lrc = 1;
00578
00579 if(lrc != 0) {
00580 if(pd0->flgd != 0) printf(s244er,1);
00581 rc = rc+1;
00582 }
00583
00584 if ( (sizeof .1250E+04 ) != sizeof(double)
00585 || (sizeof 1.250E3 ) != sizeof(double)
00586 || (sizeof 12.50E02 ) != sizeof(double)
00587 || (sizeof 1.250e+1 ) != sizeof(double)
00588 || (sizeof 1250e00 ) != sizeof(double)
00589 || (sizeof 12500.e-01) != sizeof(double)
00590 || (sizeof 125000e-2 ) != sizeof(double)
00591 || (sizeof 1250. ) != sizeof(double)){
00592
00593 if(pd0->flgd != 0) printf(s244er,2);
00594 rc = rc+2;
00595 }
00596
00597 return rc;
00598 }
|
Here is the call graph for this function:

|
|
Definition at line 599 of file cq.c. References j, printf(), defs::rfs, and s. Referenced by main(). 00601 {
00602 char *s, *s2;
00603 int rc, lrc, j;
00604 static char s25er[] = "s25,er%d\n";
00605 static char qs25[8] = "s25 ";
00606 char *ps, *pt;
00607
00608 ps = qs25;
00609 pt = pd0->rfs;
00610 while(*pt++ = *ps++);
00611 rc = 0;
00612
00613 /* A string is a sequence of characters surrounded by double
00614 quotes, as in "...". */
00615
00616 s = "...";
00617
00618 /* A string has type "array of characters" and storage class
00619 static and is initialized with the given characters. */
00620
00621 if ( s[0] != s[1] || s[1] != s[2]
00622 || s[2] != '.' ) {
00623
00624 rc = rc+1;
00625 if(pd0->flgd != 0) printf(s25er,1);
00626 }
00627
00628 /* The compiler places a null byte \0 at the end of each string
00629 so the program which scans the string can find its end. */
00630
00631 if( s[3] != '\0' ){
00632 rc = rc+4;
00633 if(pd0->flgd != 0) printf(s25er,4);
00634 }
00635
00636 /* In a string, the double quote character " must be preceded
00637 by a \. */
00638
00639 if( ".\"."[1] != '"' ){
00640 rc = rc+8;
00641 if(pd0->flgd != 0) printf(s25er,8);
00642 }
00643
00644 /* In addition, the same escapes described for character constants
00645 may be used. */
00646
00647 s = "\n\t\b\r\f\\\'";
00648
00649 if( s[0] != '\n'
00650 || s[1] != '\t'
00651 || s[2] != '\b'
00652 || s[3] != '\r'
00653 || s[4] != '\f'
00654 || s[5] != '\\'
00655 || s[6] != '\'' ){
00656
00657 rc = rc+16;
00658 if( pd0->flgd != 0) printf(s25er,16);
00659 }
00660
00661 /* Finally, a \ and an immediately following newline are ignored */
00662
00663 s2 = "queep!";
00664 s = "queep!";
00665
00666 lrc = 0;
00667 for (j=0; j<sizeof "queep!"; j++) if(s[j] != s2[j]) lrc = 1;
00668 if (lrc != 0){
00669 rc = rc+32;
00670 if(pd0->flgd != 0) printf(s25er,32);
00671 }
00672 return rc;
00673 }
|
Here is the call graph for this function:

|
|
Definition at line 674 of file cq.c. References defs::cbits, defs::dbits, defs::dprec, defs::fbits, defs::fprec, defs::ibits, defs::lbits, one(), printf(), defs::rfs, s, defs::sbits, and defs::ubits. Referenced by main(). 00676 {
00677 static char qs26[8] = "s26 ";
00678 char *ps, *pt;
00679 char c0, c1;
00680 float temp, one, delta;
00681 double tempd, oned;
00682 static char s[] = "%3d bits in %ss.\n";
00683 static char s2[] = "%e is the least number that can be added to 1. (%s).\n";
00684
00685 ps = qs26;
00686 pt = pd0->rfs;
00687
00688 while(*pt++ = *ps++);
00689
00690 /* Here, we shake the machinery a little to see what falls
00691 out. First, we find out how many bits are in a char. */
00692
00693 pd0->cbits = 0;
00694 c0 = 0;
00695 c1 = 1;
00696
00697 while(c0 != c1) {
00698 c1 = c1<<1;
00699 pd0->cbits = pd0->cbits+1;
00700 }
00701 /* That information lets us determine the size of everything else. */
00702
00703 pd0->ibits = pd0->cbits * sizeof(int);
00704 pd0->sbits = pd0->cbits * sizeof(short);
00705 pd0->lbits = pd0->cbits * sizeof(long);
00706 pd0->ubits = pd0->cbits * sizeof(unsigned);
00707 pd0->fbits = pd0->cbits * |