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
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 #ifdef NO_SLOPPY_EXTERN
46 int array(int a[],int size,int start);
50 #ifndef NO_OLD_FUNC_DECL
51 s84(pd0) /* 8.4 Meaning of declarators */
55 int s84(struct defs *pd0){
57 #ifndef NO_SLOPPY_EXTERN
58 int *ip, i, *fip(), (*pfi)(), j, k, array(), glork();
60 int *ip, i, j, k,(*pfi)();
67 int array(int a[],int size,int start);
70 static int x3d[3][5][7];
72 float fa[17], *afp[17], sum;
74 signed fa[17], *afp[17], sum;
76 static char s84er[] = "s84,er%d\n";
77 static char qs84[8] = "s84 ";
83 while (*pt++ = *ps++);
85 /* The more common varieties of declarators have al-
86 ready been touched upon, some more than others. It
87 is useful to compare *fip() and (*pfi)().
92 if(pd0->flgd != 0) printf(s84er,1);
97 #if defined(FORCE_POINTERS) | defined(NO_OLD_FUNC_DECL)
99 if(pd0->flgd != 0) printf(s84er,2);
105 if(pd0->flgd != 0) printf(s84er,2);
110 /* Float fa[17] declares an array of floating point
111 numbers, and *afp[17] declares an array of pointers
125 for(j=0; j<17; j++) sum += *afp[j];
127 if(pd0->flgd != 0) printf(s84er,4);
131 /* static int x3d[3][5][7] declares a static three
132 dimensional array of integers, with rank 3x5x7.
133 In complete detail, x3d is an array of three items;
134 each item is an array of five arrays, and each of
135 the latter arrays is an array of seven integers.
136 Any of the expressions x3d, x3d[i], x3d[i][j],
137 and x3d[i][j][k] may reasonably appear in an express-
138 ion. The first three have type "array"; the last has
145 x3d[i][j][k] = i*35+j*7+k;
150 #if defined(FORCE_POINTERS) | defined(NO_OLD_FUNC_DECL)
151 if( array((int*)x3d,105,0)
152 +array((int*)x3d[i],35,35)
157 +array(x3d[i][j],7,49)
159 if(pd0->flgd != 0) printf(s84er,8);
166 #ifndef NO_OLD_FUNC_DECL
170 int array(int a[],int size,int start)
174 #ifndef NO_OLD_FUNC_DECL
180 #ifdef NO_TYPELESS_INT
183 #ifdef NO_TYPELESS_INT
187 #ifndef NO_OLD_FUNC_DECL
194 for(i=0; i<size; i++)
195 if(a[i] != i+start) return 1;
199 #ifndef NO_OLD_FUNC_DECL
210 #ifndef NO_OLD_FUNC_DECL
219 /*********************************************************************************************
220 the main loop that launches the sections
221 *********************************************************************************************/
223 #ifndef NO_TYPELESS_STRUCT_PTR
224 int section(int j,struct* pd0){
226 int section(int j,void* pd0){
229 case 0: return s84(pd0);
233 #define cq_sections 1
236 C REFERENCE MANUAL (main)
239 #ifndef NO_OLD_FUNC_DECL
245 int main(int n,char **args) {
249 static struct defs d0, *pd0;
251 d0.flgs = 1; /* These flags dictate */
252 d0.flgm = 1; /* the verbosity of */
253 d0.flgd = 1; /* the program. */
258 for (j=0; j<cq_sections; j++) {
259 d0.rrc=section(j,pd0);
260 d0.crc=d0.crc+d0.rrc;
261 if(d0.flgs != 0) printf("Section %s returned %d.\n",d0.rfs,d0.rrc);
264 if(d0.crc == 0) printf("\nNo errors detected.\n");
265 else printf("\nFailed.\n");