2 !!DESCRIPTION!! C-Manual Chapter 6.1: characters and integers
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 /*#include "cq26.c"*/ /* hardware check */
50 #ifndef NO_OLD_FUNC_DECL
51 s61(pd0) /* Characters and integers */
55 int s61(struct defs *pd0){
57 static char s61er[] = "s61,er%d\n";
58 static char s61ok[] = "s61,ok%d\n";
59 static char qs61[8] = "s61 ";
67 static char upper_alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
68 static char lower_alpha[] = "abcdefghijklmnopqrstuvwxyz";
69 static char numbers[] = "0123456789";
70 static char special_characters[] = "~!\"#%&()_=-^|{}[]+;*:<>,.?/";
71 static char extra_special_characters[] = "\n\t\b\r\f\\\'";
72 static char blank_and_NUL[] = " \0";
81 while (*pt++ = *ps++);
83 /* A character or a short integer may be used wherever
84 an integer may be used. In all cases, the value is converted
85 to integer. This principle is extensively used throughout this
86 program, and will not be explicitly tested here. */
88 /* Conversion of a shorter integer to a longer always
89 involves sign extension. */
96 if(pd0->flgd != 0) printf(s61er,1);
98 else if(pd0->flgd != 0) printf(s61ok,1);
100 /* It is guaranteed that a member of the standard char-
101 acter set is nonnegative. */
106 pc[3] = special_characters;
107 pc[4] = extra_special_characters;
108 pc[5] = blank_and_NUL;
112 while(*pc[j]) if(*pc[j]++ < 0) lrc =1;
116 if(pd0->flgd != 0) printf(s61er,2);
118 else if(pd0->flgd != 0) printf(s61ok,2);
120 /* When a longer integer is converted to a shorter or
121 to a char, it is truncated on the left; excess bits are
124 longint = 1048579; /* =2**20+3 */
128 if((shortint != longint && shortint != 3) ||
129 (charint != longint && charint != 3)) {
131 if(pd0->flgd != 0) printf(s61er,8);
133 else if(pd0->flgd != 0) printf(s61ok,8);
138 /*********************************************************************************************
139 the main loop that launches the sections
140 *********************************************************************************************/
142 #ifndef NO_TYPELESS_STRUCT_PTR
143 int section(int j,struct* pd0){
145 int section(int j,void* pd0){
148 /*case 0: return s26(pd0);*/
149 case 0: return s61(pd0);
153 #define cq_sections 1
156 C REFERENCE MANUAL (main)
159 #ifndef NO_OLD_FUNC_DECL
165 int main(int n,char **args) {
169 static struct defs d0, *pd0;
171 d0.flgs = 1; /* These flags dictate */
172 d0.flgm = 1; /* the verbosity of */
173 d0.flgd = 1; /* the program. */
178 for (j=0; j<cq_sections; j++) {
179 d0.rrc=section(j,pd0);
180 d0.crc=d0.crc+d0.rrc;
181 if(d0.flgs != 0) printf("Section %s returned %d.\n",d0.rfs,d0.rrc);
184 if(d0.crc == 0) printf("\nNo errors detected.\n");
185 else printf("\nFailed.\n");