2 !!DESCRIPTION!! C-Manual Chapter 8.8: typedef
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 */
50 #ifndef NO_OLD_FUNC_DECL
51 s88(pd0) /* 8.8 Typedef */
55 int s88(struct defs *pd0){
57 static char s88er[] = "s88,er%d\n";
58 static char qs88[8] = "s88 ";
62 /* Declarations whose "storage class" is typdef do not
63 define storage, but instead define identifiers which
64 can later be used as if they were type keywords naming
65 fundamental or derived types.
68 typedef int MILES, *KLICKSP;
71 typedef struct {double re, im;} complex;
73 typedef struct {signed re, im;} complex;
77 #ifndef NO_SLOPPY_EXTERN
78 extern KLICKSP metricp;
89 /* Hopefully, all of this stuff will compile. After that,
90 we can only make some superficial tests.
92 The type of distance is int,
95 if(sizeof distance != sizeof(int)){
96 if(pd0->flgd != 0) printf(s88er,1);
100 /* that of metricp is "pointer to int", */
107 if(pd0->flgd != 0) printf(s88er,2);
111 /* and that of z is the specified structure. zp is a
112 pointer to such a structure.
130 if(pd0->flgd != 0) printf(s88er,4);
137 /*********************************************************************************************
138 the main loop that launches the sections
139 *********************************************************************************************/
141 #ifndef NO_TYPELESS_STRUCT_PTR
142 int section(int j,struct* pd0){
144 int section(int j,void* pd0){
147 case 0: return s88(pd0);
151 #define cq_sections 1
154 C REFERENCE MANUAL (main)
157 #ifndef NO_OLD_FUNC_DECL
163 int main(int n,char **args) {
167 static struct defs d0, *pd0;
169 d0.flgs = 1; /* These flags dictate */
170 d0.flgm = 1; /* the verbosity of */
171 d0.flgd = 1; /* the program. */
176 for (j=0; j<cq_sections; j++) {
177 d0.rrc=section(j,pd0);
178 d0.crc=d0.crc+d0.rrc;
179 if(d0.flgs != 0) printf("Section %s returned %d.\n",d0.rfs,d0.rrc);
182 if(d0.crc == 0) printf("\nNo errors detected.\n");
183 else printf("\nFailed.\n");