2 !!DESCRIPTION!! C-Manual Chapter 2.5: strings
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 #ifndef NO_OLD_FUNC_DECL
49 int s25(struct defs *pd0) {
53 static char s25er[] = "s25,er%d\n";
54 static char qs25[8] = "s25 ";
62 /* A string is a sequence of characters surrounded by double
63 quotes, as in "...". */
67 /* A string has type "array of characters" and storage class
68 static and is initialized with the given characters. */
70 if ( s[0] != s[1] || s[1] != s[2]
73 if(pd0->flgd != 0) printf(s25er,1);
76 /* The compiler places a null byte \0 at the end of each string
77 so the program which scans the string can find its end. */
81 if(pd0->flgd != 0) printf(s25er,4);
84 /* In a string, the double quote character " must be preceded
87 if( ".\"."[1] != '"' ){
89 if(pd0->flgd != 0) printf(s25er,8);
92 /* In addition, the same escapes described for character constants
105 if( pd0->flgd != 0) printf(s25er,16);
108 /* Finally, a \ and an immediately following newline are ignored */
114 for (j=0; j<sizeof "queep!"; j++) if(s[j] != s2[j]) lrc = 1;
117 if(pd0->flgd != 0) printf(s25er,32);
122 /*********************************************************************************************
123 the main loop that launches the sections
124 *********************************************************************************************/
126 #define cq_sections 1
128 #ifndef NO_TYPELESS_STRUCT_PTR
129 int section(int j,struct* pd0){
131 int section(int j,void* pd0){
134 case 0: return s25(pd0);
139 C REFERENCE MANUAL (main)
142 #ifndef NO_OLD_FUNC_DECL
148 int main(int n,char **args) {
152 static struct defs d0, *pd0;
154 d0.flgs = 1; /* These flags dictate */
155 d0.flgm = 1; /* the verbosity of */
156 d0.flgd = 1; /* the program. */
161 for (j=0; j<cq_sections; j++) {
162 d0.rrc=section(j,pd0);
163 d0.crc=d0.crc+d0.rrc;
164 if(d0.flgs != 0) printf("Section %s returned %d.\n",d0.rfs,d0.rrc);
167 if(d0.crc == 0) printf("\nNo errors detected.\n");
168 else printf("\nFailed.\n");