2 !!DESCRIPTION!! C-Manual Chapter 8.4: meaning of declarators
3 !!ORIGIN!! LCC 4.1 Testsuite
4 !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
10 int cbits; /* No. of bits per char */
12 int sbits; /* short */
14 int ubits; /* unsigned */
15 int fbits; /* float */
16 int dbits; /* double */
18 float fprec; /* Smallest number that can be */
19 float dprec; /* significantly added to 1. */
21 int flgs; /* Print return codes, by section */
22 int flgm; /* Announce machine dependencies */
23 int flgd; /* give explicit diagnostics */
24 int flgl; /* Report local return codes. */
25 int rrc; /* recent return code */
26 int crc; /* Cumulative return code */
27 char rfs[8]; /* Return from section */
31 int ubits; /* unsigned */
32 int fbits; /* float */
33 int dbits; /* double */
35 float fprec; /* Smallest number that can be */
36 float dprec; /* significantly added to 1. */
38 int flgs; /* Print return codes, by section */
39 int flgm; /* Announce machine dependencies */
40 int flgd; /* give explicit diagnostics */
41 int flgl; /* Report local return codes. */
42 int rrc; /* recent return code */
43 int crc; /* Cumulative return code */
44 char rfs[8]; /* Return from section */
46 #ifdef NO_SLOPPY_EXTERN
48 int array(int a[],int size,int start);
52 #ifndef NO_OLD_FUNC_DECL
53 s84(pd0) /* 8.4 Meaning of declarators */
57 int s84(struct defs *pd0){
59 #ifndef NO_SLOPPY_EXTERN
60 int *ip, i, *fip(), (*pfi)(), j, k, array(), glork();
62 int *ip, i, j, k,(*pfi)();
69 int array(int a[],int size,int start);
72 static int x3d[3][5][7];
74 float fa[17], *afp[17], sum;
76 signed fa[17], *afp[17], sum;
78 static char s84er[] = "s84,er%d\n";
79 static char qs84[8] = "s84 ";
85 while (*pt++ = *ps++);
87 /* The more common varieties of declarators have al-
88 ready been touched upon, some more than others. It
89 is useful to compare *fip() and (*pfi)().
94 if(pd0->flgd != 0) printf(s84er,1);
99 #if defined(FORCE_POINTERS) | defined(NO_OLD_FUNC_DECL)
101 if(pd0->flgd != 0) printf(s84er,2);
107 if(pd0->flgd != 0) printf(s84er,2);
112 /* Float fa[17] declares an array of floating point
113 numbers, and *afp[17] declares an array of pointers
127 for(j=0; j<17; j++) sum += *afp[j];
129 if(pd0->flgd != 0) printf(s84er,4);
133 /* static int x3d[3][5][7] declares a static three
134 dimensional array of integers, with rank 3x5x7.
135 In complete detail, x3d is an array of three items;
136 each item is an array of five arrays, and each of
137 the latter arrays is an array of seven integers.
138 Any of the expressions x3d, x3d[i], x3d[i][j],
139 and x3d[i][j][k] may reasonably appear in an express-
140 ion. The first three have type "array"; the last has
147 x3d[i][j][k] = i*35+j*7+k;
152 #if defined(FORCE_POINTERS) | defined(NO_OLD_FUNC_DECL)
153 if( array((int*)x3d,105,0)
154 +array((int*)x3d[i],35,35)
159 +array(x3d[i][j],7,49)
161 if(pd0->flgd != 0) printf(s84er,8);
168 #ifndef NO_OLD_FUNC_DECL
172 int array(int a[],int size,int start)
176 #ifndef NO_OLD_FUNC_DECL
182 #ifdef NO_TYPELESS_INT
185 #ifdef NO_TYPELESS_INT
189 #ifndef NO_OLD_FUNC_DECL
196 for(i=0; i<size; i++)
197 if(a[i] != i+start) return 1;
201 #ifndef NO_OLD_FUNC_DECL
212 #ifndef NO_OLD_FUNC_DECL
221 /*********************************************************************************************
222 the main loop that launches the sections
223 *********************************************************************************************/
225 #ifndef NO_TYPELESS_STRUCT_PTR
226 int section(int j,struct* pd0){
228 int section(int j,void* pd0){
231 case 0: return s84(pd0);
235 #define cq_sections 1
238 C REFERENCE MANUAL (main)
241 #ifndef NO_OLD_FUNC_DECL
247 int main(int n,char **args) {
251 static struct defs d0, *pd0;
253 d0.flgs = 1; /* These flags dictate */
254 d0.flgm = 1; /* the verbosity of */
255 d0.flgd = 1; /* the program. */
260 for (j=0; j<cq_sections; j++) {
261 d0.rrc=section(j,pd0);
262 d0.crc=d0.crc+d0.rrc;
263 if(d0.flgs != 0) printf("Section %s returned %d.\n",d0.rfs,d0.rrc);
266 if(d0.crc == 0) printf("\nNo errors detected.\n");
267 else printf("\nFailed.\n");