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
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 /*#include "cq26.c"*/ /* hardware check */
48 #ifndef NO_OLD_FUNC_DECL
49 s61(pd0) /* Characters and integers */
53 int s61(struct defs *pd0){
55 static char s61er[] = "s61,er%d\n";
56 static char s61ok[] = "s61,ok%d\n";
57 static char qs61[8] = "s61 ";
65 static char upper_alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
66 static char lower_alpha[] = "abcdefghijklmnopqrstuvwxyz";
67 static char numbers[] = "0123456789";
68 static char special_characters[] = "~!\"#%&()_=-^|{}[]+;*:<>,.?/";
69 static char extra_special_characters[] = "\n\t\b\r\f\\\'";
70 static char blank_and_NUL[] = " \0";
79 while (*pt++ = *ps++);
81 /* A character or a short integer may be used wherever
82 an integer may be used. In all cases, the value is converted
83 to integer. This principle is extensively used throughout this
84 program, and will not be explicitly tested here. */
86 /* Conversion of a shorter integer to a longer always
87 involves sign extension. */
94 if(pd0->flgd != 0) printf(s61er,1);
96 else if(pd0->flgd != 0) printf(s61ok,1);
98 /* It is guaranteed that a member of the standard char-
99 acter set is nonnegative. */
104 pc[3] = special_characters;
105 pc[4] = extra_special_characters;
106 pc[5] = blank_and_NUL;
110 while(*pc[j]) if(*pc[j]++ < 0) lrc =1;
114 if(pd0->flgd != 0) printf(s61er,2);
116 else if(pd0->flgd != 0) printf(s61ok,2);
118 /* When a longer integer is converted to a shorter or
119 to a char, it is truncated on the left; excess bits are
122 longint = 1048579; /* =2**20+3 */
126 if((shortint != longint && shortint != 3) ||
127 (charint != longint && charint != 3)) {
129 if(pd0->flgd != 0) printf(s61er,8);
131 else if(pd0->flgd != 0) printf(s61ok,8);
136 /*********************************************************************************************
137 the main loop that launches the sections
138 *********************************************************************************************/
140 #ifndef NO_TYPELESS_STRUCT_PTR
141 int section(int j,struct* pd0){
143 int section(int j,void* pd0){
146 /*case 0: return s26(pd0);*/
147 case 0: return s61(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");