2 !!DESCRIPTION!! C-Manual Chapter 4: what's in a name?
3 !!ORIGIN!! LCC 4.1 Testsuite
4 !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
8 int cbits; /* No. of bits per char */
10 int sbits; /* short */
12 int ubits; /* unsigned */
13 int fbits; /* float */
14 int dbits; /* double */
16 float fprec; /* Smallest number that can be */
17 float dprec; /* significantly added to 1. */
19 int flgs; /* Print return codes, by section */
20 int flgm; /* Announce machine dependencies */
21 int flgd; /* give explicit diagnostics */
22 int flgl; /* Report local return codes. */
23 int rrc; /* recent return code */
24 int crc; /* Cumulative return code */
25 char rfs[8]; /* Return from section */
29 int ubits; /* unsigned */
30 int fbits; /* float */
31 int dbits; /* double */
33 float fprec; /* Smallest number that can be */
34 float dprec; /* significantly added to 1. */
36 int flgs; /* Print return codes, by section */
37 int flgm; /* Announce machine dependencies */
38 int flgd; /* give explicit diagnostics */
39 int flgl; /* Report local return codes. */
40 int rrc; /* recent return code */
41 int crc; /* Cumulative return code */
42 char rfs[8]; /* Return from section */
44 /*#include "cq26.c"*/ /* hardware check */
48 #ifdef NO_IMPLICIT_FUNC_PROTOTYPES
49 int s4(struct defs *pd0);
56 #ifndef NO_OLD_FUNC_DECL
57 s4(pd0) /* 4. What's in a name? */
61 int s4(struct defs *pd0) {
63 static char s4er[] = "s4,er%d\n";
64 static char qs4[8] = "s4 ";
68 short sint; /* short integer, for size test */
80 /* There are four declarable storage classes: automatic,
81 static, external, and register. Automatic variables have
82 been dealt with extensively thus far, and will not be specif-
83 ically treated in this section. Register variables are treated
86 Static variables are local to a block, but retain their
87 values upon reentry to a block, even after control has left
91 if(svtest(j) != zero()){
93 if(pd0->flgd != 0) printf(s4er,1);
97 /* External variables exist and retain their values throughout
98 the execution of the entire program, and may be used for comm-
99 unication between functions, even separately compiled functions.
105 if(pd0->flgd != 0) printf(s4er,2);
108 Characters have been tested elsewhere (in s243).
110 Up to three sizes of integer, declared short int, int, and
111 long int, are available. Longer integers provide no less storage
112 than shorter ones, but implementation may make either short
113 integers, or long integers, or both, equivalent to plain
117 if(sizeof lint < sizeof pint || sizeof pint < sizeof sint){
119 if(pd0->flgd != 0) printf(s4er,4);
122 /* Unsigned integers, declared unsigned, obey the laws of
123 arithmetic modulo 2**n, where n is the number of bits in the
129 for(j=0; j<(sizeof target)*pd0->cbits; j++){
134 if(mask != 1 || target != 0){
136 if(pd0->flgd != 0) printf(s4er,8);
142 #ifndef NO_OLD_FUNC_DECL
157 case 1: if(k != 1978) rc = 1;
164 case 2: if(k != 1929) rc = 1;
170 zero(){ /* Returns a value of zero, possibly */
171 static k; /* with side effects, as it's called */
172 int rc; /* alternately with svtest, above, */
173 k = 2; /* and has the same internal storage */
174 rc = 0; /* requirements. */
178 if(extvar != 1066) return 1;
182 /* Sets an external variable. Used */
183 /* by s4, and should be compiled */
184 /* separately from s4. */
187 #ifndef NO_SLOPPY_EXTERN
193 /*********************************************************************************************
194 the main loop that launches the sections
195 *********************************************************************************************/
197 #ifndef NO_TYPELESS_STRUCT_PTR
198 int section(int j,struct* pd0){
200 int section(int j,void* pd0){
203 case 0: return s4(pd0);
207 #define cq_sections 1
210 C REFERENCE MANUAL (main)
213 #ifndef NO_OLD_FUNC_DECL
219 int main(int n,char **args) {
223 static struct defs d0, *pd0;
225 d0.flgs = 1; /* These flags dictate */
226 d0.flgm = 1; /* the verbosity of */
227 d0.flgd = 1; /* the program. */
232 for (j=0; j<cq_sections; j++) {
233 d0.rrc=section(j,pd0);
234 d0.crc=d0.crc+d0.rrc;
235 if(d0.flgs != 0) printf("Section %s returned %d.\n",d0.rfs,d0.rrc);
238 if(d0.crc == 0) printf("\nNo errors detected.\n");
239 else printf("\nFailed.\n");