mirror of
https://github.com/SEPPDROID/Digital-Research-Source-Code.git
synced 2025-10-24 08:54:17 +00:00
Upload
Digital Research
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
.text
|
||||
movec usp,d6
|
||||
movec d6,usp
|
||||
movec sfc,d6
|
||||
movec d6,sfc
|
||||
movec vsr,d6
|
||||
movec d6,vsr
|
||||
movec dfc,d6
|
||||
movec d6,dfc
|
||||
rtd #$7f
|
||||
rtd #$31f
|
||||
rtd #$e000
|
||||
moves r5,(a7)
|
||||
moves (a7),r5
|
||||
moves r9,(a1)
|
||||
moves (a1),r9
|
||||
moves r1,(a2)
|
||||
moves (a2),r1
|
||||
moves r3,(a4)
|
||||
moves (a4),r3
|
||||
move ccr,d3
|
||||
move ccr,(a3)
|
||||
move ccr,3(a7)
|
||||
@@ -0,0 +1,23 @@
|
||||
.text
|
||||
movec usp,d6
|
||||
movec d6,usp
|
||||
movec sfc,d6
|
||||
movec d6,sfc
|
||||
movec vsr,d6
|
||||
movec d6,vsr
|
||||
movec dfc,d6
|
||||
movec d6,dfc
|
||||
rtd #$7f
|
||||
rtd #$31f
|
||||
rtd #$e000
|
||||
moves r5,(a7)
|
||||
moves (a7),r5
|
||||
moves r9,(a1)
|
||||
moves (a1),r9
|
||||
moves r1,(a2)
|
||||
moves (a2),r1
|
||||
moves r3,(a4)
|
||||
moves (a4),r3
|
||||
move ccr,d3
|
||||
move ccr,(a3)
|
||||
move ccr,3(a7)
|
||||
@@ -0,0 +1,5 @@
|
||||
c68 test.c -o test -l6
|
||||
c68 test2.c -o test2
|
||||
c68 test3.c -o test3
|
||||
c68 -e fptest.c -o etest
|
||||
c68 -f fptest.c -o ftest
|
||||
105
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v103/test/fptest.c
Normal file
105
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v103/test/fptest.c
Normal file
@@ -0,0 +1,105 @@
|
||||
#include <math.h>
|
||||
|
||||
float *f1();
|
||||
float f2();
|
||||
float ret_0();
|
||||
|
||||
struct type {
|
||||
float ft;
|
||||
double dt;
|
||||
float *pft;
|
||||
} fstruc;
|
||||
|
||||
char *fstr = "-2.3E-4";
|
||||
char *astr = "8.6324";
|
||||
float ar[10];
|
||||
float global_f;
|
||||
|
||||
int err = 0;
|
||||
|
||||
main()
|
||||
{
|
||||
double d;
|
||||
float f, fp2, *fp;
|
||||
char *s, buf[20];
|
||||
long l;
|
||||
int i;
|
||||
|
||||
if ((fp = f1()) != fstruc.pft) error(0xf1);
|
||||
if ((f = f2()) != 2.0) error(0xf2);
|
||||
d = f;
|
||||
if (d != f) error(0xf3);
|
||||
f = atof(fstr);
|
||||
s = ftoa(f,buf,6);
|
||||
printf("%s => %f => %s\n",fstr,f,s);
|
||||
f = 3.4;
|
||||
l = f;
|
||||
if (l != 3L) { error(0xf4); printf("%f => %ld != 3L\n",f,l); }
|
||||
i = f;
|
||||
if (i != 3) { error(0xf5); printf("%f => %d != 3\n",f,i); }
|
||||
l = 7L;
|
||||
f = l;
|
||||
if (f < 6.8 || f > 7.2) { error(0xf6); printf("%ld => %f != 7.0\n",l,f); }
|
||||
i = 7;
|
||||
f = i;
|
||||
if (f < 6.8 || f > 7.2) { error(0xf6); printf("%d => %f != 7.0\n",i,f); }
|
||||
f = atof(astr);
|
||||
printf("%s ==> ~ %f or %e\n",astr,f,f);
|
||||
f = 0;
|
||||
if (f != 0.0) error(0xf7);
|
||||
i = 3;
|
||||
ar[i] = 3.0;
|
||||
f = 4.0;
|
||||
fp2 = 10.0;
|
||||
printf("%f += %f * %f ==> ",ar[i],f,fp2);
|
||||
ar[i] += f * fp2;
|
||||
printf("%f\n",ar[i]);
|
||||
global_f = 0.0;
|
||||
f = 0.0;
|
||||
if_test(f);
|
||||
if (!err)
|
||||
printf("Far Freaking Out....\n");
|
||||
else
|
||||
printf("Tough Luck...\n");
|
||||
}
|
||||
|
||||
float *
|
||||
f1()
|
||||
{
|
||||
return(fstruc.pft);
|
||||
}
|
||||
|
||||
float
|
||||
f2()
|
||||
{
|
||||
return(2.0);
|
||||
}
|
||||
|
||||
float
|
||||
ret_0()
|
||||
{
|
||||
return(0.0);
|
||||
}
|
||||
|
||||
if_test(pf)
|
||||
float pf;
|
||||
{
|
||||
float af, *ptr;
|
||||
|
||||
ar[2] = 0.0;
|
||||
af = 0.0;
|
||||
ptr = ⁡
|
||||
if (global_f) error(0x10);
|
||||
if (ar[2]) error(0x11);
|
||||
if (af) error(0x12);
|
||||
if (pf) error(0x13);
|
||||
if (*ptr) error(0x14);
|
||||
if (ret_0()) error(0x14);
|
||||
}
|
||||
|
||||
error(enum)
|
||||
int enum;
|
||||
{
|
||||
printf("error: %x\n",enum);
|
||||
err++;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
CC = c68
|
||||
CFLAGS = -a
|
||||
|
||||
all:
|
||||
${CC} ${CFLAGS} test.c -o test -l6
|
||||
${CC} ${CFLAGS} test2.c -o test2
|
||||
${CC} ${CFLAGS} test3.c -o test3
|
||||
${CC} ${CFLAGS} -e fptest.c -o etest
|
||||
${CC} ${CFLAGS} -f fptest.c -o ftest
|
||||
|
||||
ar:
|
||||
rm -f t.a
|
||||
ar68 rv t.a test test2 test3 etest ftest
|
||||
|
||||
clean:
|
||||
@rm -f test test2 test3 ftest etest
|
||||
@rm -f t.a core a.out c.out
|
||||
1119
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v103/test/test.c
Normal file
1119
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v103/test/test.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
#define test2x
|
||||
625
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v103/test/test2.c
Normal file
625
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v103/test/test2.c
Normal file
@@ -0,0 +1,625 @@
|
||||
/* Compiler Test Program Part II - version 4.0 plus */
|
||||
|
||||
#define DOHIST '\!'
|
||||
#define QUOTED 128
|
||||
|
||||
struct lbits {
|
||||
unsigned b1 : 4;
|
||||
unsigned b2 : 12;
|
||||
} low;
|
||||
|
||||
struct hbits {
|
||||
unsigned b1 : 12;
|
||||
unsigned b2 : 4;
|
||||
} ;
|
||||
|
||||
struct hbits high; /* be sure global decl ok... */
|
||||
|
||||
int err;
|
||||
int globali = -32768;
|
||||
unsigned globalu = 44000;
|
||||
|
||||
char ca[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
|
||||
|
||||
long lconst1 = 5 * 9;
|
||||
long lconst2 = 5L * 9;
|
||||
long lconst3 = 5 * 9L;
|
||||
long lconst4 = 5L * 9L;
|
||||
long lconst5 = (long)(5 * 9);
|
||||
|
||||
char c0[] = {
|
||||
0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15,
|
||||
};
|
||||
|
||||
int i0[] = {
|
||||
0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15,
|
||||
};
|
||||
|
||||
long l0[] = {
|
||||
0, 1, 2, 3, 4,
|
||||
5, 6, 7, 8, 9,
|
||||
10, 11, 12, 13, 14, 15,
|
||||
};
|
||||
|
||||
struct Proto {
|
||||
char P_id;
|
||||
int (*P_turnon)();
|
||||
int (*P_rdmsg)();
|
||||
int (*P_wrmsg)();
|
||||
int (*P_rddata)();
|
||||
int (*P_wrdata)();
|
||||
int (*P_turnoff)();
|
||||
};
|
||||
|
||||
extern int gturnon(), gturnoff();
|
||||
extern int grdmsg(), grddata();
|
||||
extern int gwrmsg(), gwrdata();
|
||||
|
||||
struct Proto Ptbl[] = {
|
||||
'g', gturnon, grdmsg, gwrmsg, grddata, gwrdata, gturnoff,
|
||||
'\0'
|
||||
};
|
||||
|
||||
struct nroff {
|
||||
int a;
|
||||
char *p;
|
||||
char *ctag[5];
|
||||
char *zz;
|
||||
};
|
||||
|
||||
struct nroff star = {
|
||||
1,
|
||||
"pstring...",
|
||||
"zero",
|
||||
"one",
|
||||
"two",
|
||||
"three",
|
||||
"four",
|
||||
"zzstring"
|
||||
};
|
||||
|
||||
struct {
|
||||
int a[2];
|
||||
char b[2];
|
||||
long c[2];
|
||||
char *d[2];
|
||||
} sa = {
|
||||
1, 2,
|
||||
'a', 'b',
|
||||
3, 4,
|
||||
"abc", "def"
|
||||
};
|
||||
|
||||
int gturnon() {}
|
||||
int gturnoff() {}
|
||||
int grdmsg() {}
|
||||
int grddata() {}
|
||||
int gwrmsg() {}
|
||||
int gwrdata() {}
|
||||
|
||||
main()
|
||||
{
|
||||
l_vs_i();
|
||||
rl_vs_i();
|
||||
l_vs_ri();
|
||||
rl_vs_ri();
|
||||
v40();
|
||||
v41();
|
||||
v42();
|
||||
v42_a();
|
||||
if (!err)
|
||||
printf("Far Freaking Out\n");
|
||||
else
|
||||
printf("Tough Luck.....\n");
|
||||
}
|
||||
|
||||
l_vs_i() /* longs versus ints... v. 4.0 addition */
|
||||
{
|
||||
long autol, autol1;
|
||||
int i;
|
||||
|
||||
i = 3;
|
||||
autol = autol1 = 100;
|
||||
autol1 *= i;
|
||||
autol =autol * i;
|
||||
if (autol1 != autol) error(0x00);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 /= i;
|
||||
autol =autol / i;
|
||||
if (autol1 != autol) error(0x01);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 += i;
|
||||
autol =autol + i;
|
||||
if (autol1 != autol) error(0x02);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 -= i;
|
||||
autol =autol - i;
|
||||
if (autol1 != autol) error(0x03);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 %= i;
|
||||
autol =autol % i;
|
||||
if (autol1 != autol) error(0x04);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 <<= i;
|
||||
autol =autol << i;
|
||||
if (autol1 != autol) error(0x05);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 >>= i;
|
||||
autol =autol >> i;
|
||||
if (autol1 != autol) error(0x06);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 &= i;
|
||||
autol =autol & i;
|
||||
if (autol1 != autol) error(0x07);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 |= i;
|
||||
autol =autol | i;
|
||||
if (autol1 != autol) error(0x08);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 ^= i;
|
||||
autol =autol ^ i;
|
||||
if (autol1 != autol) error(0x09);
|
||||
}
|
||||
|
||||
rl_vs_i() /* register longs versus ints... v. 4.0 addition */
|
||||
{
|
||||
register long regl, regl1;
|
||||
int i;
|
||||
|
||||
i = 3;
|
||||
regl = regl1 = 100;
|
||||
regl1 *= i;
|
||||
regl = regl * i;
|
||||
if (regl1 != regl) error(0x10);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 /= i;
|
||||
regl = regl / i;
|
||||
if (regl1 != regl) error(0x11);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 += i;
|
||||
regl = regl + i;
|
||||
if (regl1 != regl) error(0x12);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 -= i;
|
||||
regl = regl - i;
|
||||
if (regl1 != regl) error(0x13);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 %= i;
|
||||
regl = regl % i;
|
||||
if (regl1 != regl) error(0x14);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 <<= i;
|
||||
regl = regl << i;
|
||||
if (regl1 != regl) error(0x15);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 >>= i;
|
||||
regl = regl >> i;
|
||||
if (regl1 != regl) error(0x16);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 &= i;
|
||||
regl = regl & i;
|
||||
if (regl1 != regl) error(0x17);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 |= i;
|
||||
regl = regl | i;
|
||||
if (regl1 != regl) error(0x18);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 ^= i;
|
||||
regl = regl ^ i;
|
||||
if (regl1 != regl) error(0x19);
|
||||
}
|
||||
|
||||
l_vs_ri() /* longs versus register ints... v. 4.0 addition */
|
||||
{
|
||||
long autol, autol1;
|
||||
register int i;
|
||||
|
||||
i = 2;
|
||||
autol = autol1 = 100;
|
||||
autol1 *= i;
|
||||
autol =autol * i;
|
||||
if (autol1 != autol) error(0x20);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 /= i;
|
||||
autol =autol / i;
|
||||
if (autol1 != autol) error(0x21);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 += i;
|
||||
autol =autol + i;
|
||||
if (autol1 != autol) error(0x22);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 -= i;
|
||||
autol =autol - i;
|
||||
if (autol1 != autol) error(0x23);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 %= i;
|
||||
autol =autol % i;
|
||||
if (autol1 != autol) error(0x24);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 <<= i;
|
||||
autol =autol << i;
|
||||
if (autol1 != autol) error(0x25);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 >>= i;
|
||||
autol =autol >> i;
|
||||
if (autol1 != autol) error(0x26);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 &= i;
|
||||
autol =autol & i;
|
||||
if (autol1 != autol) error(0x27);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 |= i;
|
||||
autol =autol | i;
|
||||
if (autol1 != autol) error(0x28);
|
||||
|
||||
autol = autol1 = 100;
|
||||
autol1 ^= i;
|
||||
autol =autol ^ i;
|
||||
if (autol1 != autol) error(0x29);
|
||||
}
|
||||
|
||||
rl_vs_ri() /* reg longs versus reg ints... v. 4.0 addition */
|
||||
{
|
||||
register long regl, regl1;
|
||||
register int i;
|
||||
|
||||
i = 3;
|
||||
regl = regl1 = 100;
|
||||
regl1 *= i;
|
||||
regl = regl * i;
|
||||
if (regl1 != regl) error(0x30);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 /= i;
|
||||
regl = regl / i;
|
||||
if (regl1 != regl) error(0x31);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 += i;
|
||||
regl = regl + i;
|
||||
if (regl1 != regl) error(0x32);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 -= i;
|
||||
regl = regl - i;
|
||||
if (regl1 != regl) error(0x33);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 %= i;
|
||||
regl = regl % i;
|
||||
if (regl1 != regl) error(0x34);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 <<= i;
|
||||
regl = regl << i;
|
||||
if (regl1 != regl) error(0x35);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 >>= i;
|
||||
regl = regl >> i;
|
||||
if (regl1 != regl) error(0x36);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 &= i;
|
||||
regl = regl & i;
|
||||
if (regl1 != regl) error(0x37);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 |= i;
|
||||
regl = regl | i;
|
||||
if (regl1 != regl) error(0x38);
|
||||
|
||||
regl = regl1 = 100;
|
||||
regl1 ^= i;
|
||||
regl = regl ^ i;
|
||||
if (regl1 != regl) error(0x39);
|
||||
}
|
||||
|
||||
v40() /* 4.0 fixed and tested */
|
||||
{
|
||||
long l, l1;
|
||||
register int i;
|
||||
|
||||
/* bit assignments */
|
||||
low.b1 = high.b2;
|
||||
high.b1 = low.b2;
|
||||
|
||||
l = l1 = 45L;
|
||||
/* non-code-generating simple expressions */
|
||||
l *= 1L;
|
||||
if (l != l1) error(0x40);
|
||||
l += 0L;
|
||||
if (l != l1) error(0x41);
|
||||
l -= 0L;
|
||||
if (l != l1) error(0x42);
|
||||
l *= 0L;
|
||||
if (l != 0L) error(0x43);
|
||||
l1 %= 1L;
|
||||
if (l1 != 0L) error(0x44);
|
||||
|
||||
/*SMC Bug - not properly extending i register on stack*/
|
||||
i = 2;
|
||||
ca[i] = f();
|
||||
if( ca[i] != f() ) error(0x45);
|
||||
}
|
||||
|
||||
f()
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
struct xyzzytype {
|
||||
long x, y, z;
|
||||
char *xyz, xyzzy;
|
||||
} saray1[3], saray2[4];
|
||||
|
||||
#define max(x,y) ((x > y) ? 'x' : 'y')
|
||||
#define strings(s1,s2) "s1s2"
|
||||
#define substitute(x) "x,"
|
||||
v40a() /* bug fixes and enhancements for v 4.0 ammended */
|
||||
{
|
||||
char ch, *s, *t;
|
||||
|
||||
ch = max(3,9);
|
||||
if(ch != '9') error(0x50);
|
||||
s = strings(s,t);
|
||||
if (strcmp(s,"s1s2") != 0) error(0x51);
|
||||
s = substitute(5);
|
||||
if (strcmp(s,"5,") != 0) error(0x52);
|
||||
saray2[0].y = 4L; saray2[0].xyzzy = 'p'; saray2[0].x = 450L;
|
||||
saray1[2] = saray2[0];
|
||||
}
|
||||
|
||||
int v41_testvalue;
|
||||
v41()
|
||||
{
|
||||
register char *p;
|
||||
register int i;
|
||||
register int j;
|
||||
int form;
|
||||
long m, n;
|
||||
long al[10];
|
||||
int aray[3][4][5];
|
||||
|
||||
aray[2][3][4] = 4; /* multi dimensional arrays */
|
||||
if (aray[2][3][4] != 4) error(0x53);
|
||||
if (lconst1 != 45) error(0x54); /* long constant initialization */
|
||||
if (lconst2 != 45) error(0x55);
|
||||
if (lconst3 != 45) error(0x56);
|
||||
if (lconst4 != 45) error(0x57);
|
||||
if (lconst5 != 45) error(0x58);
|
||||
|
||||
m = 12; n = -1; /* arrays involving long mult for indices */
|
||||
al[2] = 33L;
|
||||
n = al[m + n * 10];
|
||||
if (n != 33L) error(0x59);
|
||||
al[2L] = 31L; /* arrays involving long indices */
|
||||
n = al[2];
|
||||
if (n != 31L) error(0x5a);
|
||||
|
||||
1 ? 0 : 2;
|
||||
1 ? (form = 0) : (form = 1);
|
||||
if (form != 0) error(0x5b);
|
||||
form = 3;
|
||||
0 ? (form = form | ( 1 << 0)) : (form = form & ~(1<<0));
|
||||
if (form != 2) error(0x5c);
|
||||
form = 3;
|
||||
0 ? (form |= (1 << 0)) : (form &= ~(1 << 0));
|
||||
if (form != 2) error(0x5d);
|
||||
|
||||
for( i = 0; i < sizeof(ca); i++ )
|
||||
ca[i] = i;
|
||||
i = 0;
|
||||
p = ca;
|
||||
if( ca[*p++]++ != 0 ) error(0x61);
|
||||
if( p != &ca[1] ) error(0x62);
|
||||
if( ca[0] != 1 ) error(0x63);
|
||||
if( ca[i+=1]++ != 1 ) error(0x64);
|
||||
if( i != 1 ) error(0x65);
|
||||
if( ca[1] != 2 ) error(0x66);
|
||||
if( ca[i+= *p++]++ != 3 ) error(0x67);
|
||||
if( i != 3 ) error(0x68);
|
||||
if( p != &ca[2] ) error(0x69);
|
||||
if( ca[3] != 4 ) error(0x6a);
|
||||
j = 1;
|
||||
i = j++ && j++;
|
||||
if( j != 3 ) error(0x6b);
|
||||
if( i != 1 ) error(0x6c);
|
||||
j = 0;
|
||||
i = j++ && j++;
|
||||
if( j != 1 ) error(0x6d);
|
||||
if( i != 0 ) error(0x6e);
|
||||
j = 1;
|
||||
i = --j || --j;
|
||||
if( j != -1 ) error(0x6f);
|
||||
if( i != 1 ) error(0x70);
|
||||
j = 1;
|
||||
i = j ? --j : --j;
|
||||
if( j != 0 ) error(0x71);
|
||||
if( i != 0 ) error(0x72);
|
||||
|
||||
v41_testvalue = 128;
|
||||
if (v41_testvalue != ((long) 128)) error(0x73);
|
||||
if (v41_testvalue != ((int)(long) 128)) error(0x74);
|
||||
if (v41_testvalue != (int)((long) 128)) error(0x75);
|
||||
v41_testvalue = 128 * 3;
|
||||
if (v41_testvalue != (int)((long) 128*3)) error(0x76);
|
||||
|
||||
if ((long)p & 0x80000000);
|
||||
}
|
||||
|
||||
struct qtest {
|
||||
int sar[10];
|
||||
};
|
||||
|
||||
struct zip {
|
||||
int i; char c[6]; int j;
|
||||
} zippo[] = {
|
||||
0, "zero", 00,
|
||||
1, "one", 11,
|
||||
2, "two", 22,
|
||||
3, "three", 33,
|
||||
4, 'fo', "ur", 44,
|
||||
5, "five", 55,
|
||||
6, 'si', 'x', 0, 0, 0, 66,
|
||||
7, 'se', 've', 'n\0', 77,
|
||||
0
|
||||
};
|
||||
|
||||
struct Abit {
|
||||
char x0;
|
||||
char x1:1;
|
||||
int x2:1;
|
||||
int x3:1;
|
||||
} bit1;
|
||||
|
||||
struct Bbit {
|
||||
char bx1;
|
||||
int bx2:1;
|
||||
int bx3:1;
|
||||
} bit2;
|
||||
|
||||
v42()
|
||||
{
|
||||
int case_val, index, tmp;
|
||||
int aar[10];
|
||||
struct qtest a;
|
||||
|
||||
v41_testvalue = 128 * 3;
|
||||
if (v41_testvalue != ((int)(long) 128*3)) error(0x80);
|
||||
case_val = 0200| 'P';
|
||||
switch(case_val) {
|
||||
case (0200|'P'): break;
|
||||
default: error(0x81); break;
|
||||
}
|
||||
if (sizeof(a.sar) != sizeof(aar)) error(0x82);
|
||||
index = 2;
|
||||
aar[index+1] = 'c';
|
||||
if (aar[index+'\01'] != 'c') error(0x83);
|
||||
if (c0[3] != 3) error(0x84);
|
||||
if (i0[5] != 5) error(0x85);
|
||||
if (l0[12] != 12) error(0x86);
|
||||
|
||||
if (eqstr(zippo[1].c,"one")==0) error(0x87);
|
||||
if (eqstr(zippo[4].c,"four")==0) error(0x88);
|
||||
if (eqstr(zippo[6].c,"six")==0) error(0x89);
|
||||
if (eqstr(zippo[7].c,"seven")==0) error(0x8a);
|
||||
|
||||
tmp = 'd';
|
||||
index = tmp - 'a';
|
||||
if (ca[index] != ca[tmp - 'a']) error(0x8b);
|
||||
|
||||
if (sizeof(struct Proto) != 26) error(0x8c);
|
||||
if ((sizeof(struct Proto)*2) != sizeof(Ptbl)) error(0x8d);
|
||||
tmp = 0x7000;
|
||||
switch(tmp & 0xf000) {
|
||||
default:
|
||||
case_val = tmp&0xf000; error(0x8e); printf("val == %x\n",case_val);
|
||||
case 0x7000:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
struct termio {
|
||||
int c_iflag;
|
||||
int c_oflag;
|
||||
int c_cflag;
|
||||
int c_lflag;
|
||||
int c_line;
|
||||
char c_cc[8];
|
||||
};
|
||||
|
||||
struct termio ttys;
|
||||
int ttysave;
|
||||
|
||||
v42_a()
|
||||
{
|
||||
long l;
|
||||
|
||||
bit1.x2 = 1;
|
||||
bit1.x3 = 0;
|
||||
bit2.bx2 = 1;
|
||||
bit2.bx3 = 0;
|
||||
if( bit1.x2 != bit2.bx2) error(0x90);
|
||||
if( bit1.x3 != bit2.bx3) error(0x91);
|
||||
|
||||
if (ch_test() != (DOHIST|QUOTED)) error(0x92);
|
||||
|
||||
l = 0x8000L;
|
||||
if (!(l & 0x8000)) error(0x93);
|
||||
|
||||
if (iox(0, (('T'<<8)|1), &ttys) >= 0)
|
||||
ttysave = ttys.c_oflag;
|
||||
|
||||
if (eqstr(star.ctag[3],"three")==0) error(0x94);
|
||||
if (sa.a[1] != 2) error(0x95);
|
||||
if (sa.b[1] != 'b') error(0x96);
|
||||
if (sa.c[1] != 4) error(0x97);
|
||||
if (eqstr(sa.d[1],"def")==0) error(0x98);
|
||||
}
|
||||
|
||||
iox(i,j,k)
|
||||
int i, j;
|
||||
long k;
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
eqstr(ap1,ap2)
|
||||
char *ap1, *ap2;
|
||||
{
|
||||
register char *p1, *p2;
|
||||
|
||||
p1 = ap1;
|
||||
p2 = ap2;
|
||||
while(*p1) {
|
||||
if(*p1++ != *p2++)
|
||||
return(0);
|
||||
}
|
||||
if(*p2)
|
||||
return(0);
|
||||
return(1);
|
||||
}
|
||||
|
||||
ch_test()
|
||||
{
|
||||
return(DOHIST|QUOTED);
|
||||
}
|
||||
|
||||
error(ernum)
|
||||
int ernum;
|
||||
{
|
||||
printf("error %x\n",ernum);
|
||||
err++;
|
||||
}
|
||||
|
||||
470
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v103/test/test3.c
Normal file
470
CPM OPERATING SYSTEMS/CPM 68K/1.0X SOURCES/v103/test/test3.c
Normal file
@@ -0,0 +1,470 @@
|
||||
|
||||
/* Compiler Test Program Part III - version 4.2 plus */
|
||||
|
||||
int x1[5] = { 0, 1, 2, 3, 4, };
|
||||
int x2[5] = { 0, 1, 2, 3, 4 };
|
||||
int x3[5] = { 0, 1, 2, 3, };
|
||||
|
||||
unsigned u = -1;
|
||||
|
||||
char arc[5][3] = {
|
||||
0x1111, 0x1111, 0x1111, 0x1111, 0x1111,
|
||||
0xffff, 0x1ffff, 0xffff, 0xffff, 0xffff /* should have warnings on init */
|
||||
};
|
||||
|
||||
int ari[5][3] = {
|
||||
0x1111, 0x1111, 0x1111, 0x1111, 0x1111,
|
||||
0xffff, 0x1ffff, 0xffff, 0xffff, 0xffff /* should have 1 warning on init */
|
||||
};
|
||||
|
||||
unsigned int aru[5][3] = {
|
||||
0x1111, 0x1111, 0x1111, 0x1111, 0x1111,
|
||||
0xffff, 0x1ffff, 0xffff, 0xffff, 0xffff /* should have 1 warning on init */
|
||||
};
|
||||
|
||||
long arl[5][3] = {
|
||||
0x1111, 0x1111, 0x1111, 0x1111, 0x1111,
|
||||
0xffff, 0x1ffff, 0xffff, 0xffff, 0xffff
|
||||
};
|
||||
|
||||
short ars[2][2] = {
|
||||
0|0100000, 1|0100000, 0xffff, 0x8000|0x040
|
||||
};
|
||||
|
||||
struct Mstruct {
|
||||
int ar[3];
|
||||
char c;
|
||||
} *mtab[] = {
|
||||
0, 1, 2, 'c'
|
||||
};
|
||||
|
||||
typedef int tdefa[(5)];
|
||||
typedef int tdefb [10+(2)];
|
||||
|
||||
tdefa a;
|
||||
tdefb b;
|
||||
|
||||
int ff[(5)];
|
||||
|
||||
struct atype {
|
||||
int a;
|
||||
long b;
|
||||
int c;
|
||||
} A[] = {
|
||||
{ 1, 1, 1 },
|
||||
{ 2, 2, 2 },
|
||||
{ 3, 3, 3 },
|
||||
};
|
||||
|
||||
struct atype *mikeC[] = { /* better not have any warnings on init... */
|
||||
0xf1e010,
|
||||
0xf1e011,
|
||||
0xf1e012,
|
||||
0xf1e013,
|
||||
0,
|
||||
};
|
||||
|
||||
struct btype {
|
||||
char *p1;
|
||||
int i;
|
||||
char c;
|
||||
} B = {
|
||||
"This is a string.....",
|
||||
35,
|
||||
'p'
|
||||
};
|
||||
|
||||
|
||||
int err;
|
||||
char string[] = "9876543210";
|
||||
|
||||
int fun1(), fun2();
|
||||
struct {
|
||||
int sz;
|
||||
int (*func)();
|
||||
} fun[2] = { 1, fun1, 2, fun2 };
|
||||
int fglobal;
|
||||
int global1 = 4, global2 = 5;
|
||||
|
||||
main()
|
||||
{
|
||||
v42();
|
||||
test();
|
||||
test2();
|
||||
aray();
|
||||
do_stass();
|
||||
do_sizeof();
|
||||
|
||||
if (err)
|
||||
printf("Tough Luck...\n");
|
||||
else
|
||||
printf("Far Freaking Out...\n");
|
||||
}
|
||||
|
||||
short mstype;
|
||||
typedef struct MODES {
|
||||
short imap;
|
||||
} MODER, *pMODER;
|
||||
static MODER amode;
|
||||
pMODER vmode;
|
||||
|
||||
v42()
|
||||
{
|
||||
int i;
|
||||
struct test {
|
||||
int a;
|
||||
long b;
|
||||
struct {
|
||||
char c;
|
||||
int d;
|
||||
}y;
|
||||
} x;
|
||||
|
||||
if (A[0].b != 1) error(0x1);
|
||||
if (A[1].c != 2) error(0x2);
|
||||
if (A[2].a != 3) error(0x3);
|
||||
x.y.d = 3;
|
||||
x.a = 0;
|
||||
{
|
||||
if (!x.y.d) error(0x4);
|
||||
}
|
||||
if (x.a) error(0x5);
|
||||
|
||||
{
|
||||
char *s = &string;
|
||||
int i;
|
||||
|
||||
i = *s - '0';
|
||||
if (i != 9) error(0x5);
|
||||
}
|
||||
{
|
||||
register int regi;
|
||||
int i;
|
||||
|
||||
if ((i=f(3)) > f(1)) ; else error(0x6);
|
||||
if ((regi=f(3)) > f(1)) ; else error(0x7);
|
||||
}
|
||||
if (1) {
|
||||
short count = 0;
|
||||
|
||||
mstype = 33;
|
||||
}
|
||||
if (mstype != 33) error(0x8);
|
||||
ff[i=0] = 33;
|
||||
if (ff[0] != 33) error(0x9);
|
||||
if(!main) error(0x10);
|
||||
vmode = &amode;
|
||||
}
|
||||
|
||||
f(val)
|
||||
int val;
|
||||
{
|
||||
return(val);
|
||||
}
|
||||
|
||||
struct fi_index {
|
||||
long fi_flags;
|
||||
unsigned fi_count;
|
||||
char fi_groupid;
|
||||
char fi_nlinks;
|
||||
int fi_ownerid;
|
||||
long fi_fsize;
|
||||
long fi_findblk;
|
||||
int fi_dev;
|
||||
int fi_lock;
|
||||
int fi_spdev;
|
||||
char *fi_rlocks;
|
||||
};
|
||||
|
||||
char ca[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
int ica[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
char cb[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
|
||||
char cc[10] = { '01', '23', '45', '67', '89' };
|
||||
|
||||
struct A {
|
||||
int a;
|
||||
long b;
|
||||
} atype[] = {
|
||||
0, 3,
|
||||
1, 4,
|
||||
2, 5
|
||||
};
|
||||
|
||||
int three[3][3][3] = {
|
||||
0,0,0,0,0,0,0,0,0,
|
||||
1,1,1,1,1,1,1,1,1,
|
||||
2,2,2,2,2,2,2,2,2
|
||||
};
|
||||
|
||||
/*char ar_test[0xf0000];*/
|
||||
aray()
|
||||
{
|
||||
register int n;
|
||||
register char c, *bp;
|
||||
register struct fi_index *fip;
|
||||
struct fi_index xxx;
|
||||
|
||||
fip = &xxx;
|
||||
xxx.fi_fsize = 3;
|
||||
n = 5000;
|
||||
if( n > (4096 - fip->fi_fsize) ) {
|
||||
n = 4096 - fip->fi_fsize;
|
||||
if (n != (4096 - fip->fi_fsize)) error(0x20);
|
||||
}
|
||||
else
|
||||
error(0x21);
|
||||
|
||||
if (ca[3] != 3) error(0x22);
|
||||
if (ica[7] != 7) error(0x23);
|
||||
if (cb[5] != '5') error(0x24);
|
||||
if (cc[8] != '8') error(0x25);
|
||||
if (atype[2].a != 2) error(0x26);
|
||||
if (atype[0].b != 3) error(0x27);
|
||||
if (three[0][0][2] != 0) error(0x28);
|
||||
if (three[1][1][1] != 1) error(0x29);
|
||||
if (three[2][2][0] != 2) error(0x2a);
|
||||
|
||||
/*
|
||||
ar_test[0xa000L] = '7'; bp = &ar_test[0];
|
||||
c = bp[0xa000L];
|
||||
if (c != '7') error(0x2b);
|
||||
ar_test[0x10000] = 'T';
|
||||
c = bp[0x10000];
|
||||
if (c != 'T') error(0x2c);
|
||||
*/
|
||||
}
|
||||
|
||||
struct {
|
||||
int _a, _a1, _a2, _a3, _a4;
|
||||
long _b, _b1, _b2, _b3, _b4;
|
||||
char _c, _c2, _c3, _c4;
|
||||
} st, *pt, st2, *pt2, sa[3];
|
||||
|
||||
do_stass()
|
||||
{
|
||||
pt = &st; pt2 = &st2;
|
||||
st._b4 = 3; st2._b4 = 9;
|
||||
st = st2;
|
||||
if (st._b4 != st2._b4) error(0x28);
|
||||
pt->_b1 = 55; pt2->_b1 = 34;
|
||||
*pt = *pt2;
|
||||
if (pt->_b1 != pt2->_b1) error(0x29);
|
||||
st = *pt;
|
||||
*pt = st;
|
||||
sa[0]._c4 = 'd'; sa[1]._c4 = '8';
|
||||
sa[1] = sa[0];
|
||||
if (sa[0]._c4 != sa[1]._c4) error(0x2a);
|
||||
}
|
||||
|
||||
|
||||
struct sz_struc {
|
||||
int a[10];
|
||||
char c;
|
||||
int b[3];
|
||||
struct xxx {
|
||||
char d[5];
|
||||
int e[2];
|
||||
}f;
|
||||
} *s, t;
|
||||
int szaray[10];
|
||||
|
||||
typedef struct TDS {
|
||||
char st;
|
||||
unsigned fConstant : 1;
|
||||
unsigned width : 7;
|
||||
unsigned bt : 4;
|
||||
unsigned tq1 : 2;
|
||||
unsigned tq2 : 2;
|
||||
unsigned tq3 : 2;
|
||||
unsigned tq4 : 2;
|
||||
unsigned tq5 : 2;
|
||||
unsigned tq6 : 2;
|
||||
} TDR, *pTDR;
|
||||
|
||||
typedef struct {
|
||||
char sbVar[8];
|
||||
TDR td;
|
||||
long valTy;
|
||||
} TYR, *pTYR;
|
||||
|
||||
TYR vrgTySpc[] = { /* test of short element initialization */
|
||||
{"$cBad", '\0', '\0', '\0', '\0', 0},
|
||||
0
|
||||
};
|
||||
|
||||
struct one {
|
||||
struct two *p2;
|
||||
struct one *p1;
|
||||
};
|
||||
|
||||
struct two {
|
||||
int atwo, btwo, ctwo, dtwo;
|
||||
};
|
||||
|
||||
struct one xyzzy[] = {
|
||||
0, 0
|
||||
};
|
||||
|
||||
char szof[10];
|
||||
|
||||
do_sizeof()
|
||||
{
|
||||
char nx[sizeof szof];
|
||||
char ny[sizeof (szof)];
|
||||
int i;
|
||||
long l;
|
||||
char *p;
|
||||
int *pi;
|
||||
|
||||
if ( sizeof(vrgTySpc) != (2 * sizeof(TYR)) ) error(0x30);
|
||||
if ( sizeof(s->a) != 20 ) error(0x31);
|
||||
if ( sizeof(s->b) != 6 ) error(0x32);
|
||||
if ( sizeof(s->f) != 10 ) error(0x33);
|
||||
if ( sizeof(s->f.e) != 4 ) error(0x34);
|
||||
if ( sizeof(szaray) != 20 ) error(0x35);
|
||||
if ( sizeof(t.a) != 20 ) error(0x36);
|
||||
if ( sizeof(s->a[4]) != 2 ) error(0x37);
|
||||
if ( sizeof(t.c) != 1 ) error(0x38);
|
||||
if ( sizeof(p) != 4 ) error(0x39);
|
||||
if ( sizeof(pi) != 4 ) error(0x3a);
|
||||
if ( sizeof(xyzzy) != 8 ) error(0x3b);
|
||||
if ( sizeof(l) != 4 ) error(0x3c);
|
||||
if ( sizeof(*p) != 1 ) error(0x3d);
|
||||
if ( sizeof(*pi) != 2 ) error(0x3e);
|
||||
if ( sizeof(szaray[4]) != 2 ) error(0x3f);
|
||||
if ( sizeof(struct one) != 8) error(0x40);
|
||||
if ( sizeof(nx) != sizeof ny) error(0x41);
|
||||
if ( sizeof(ny) != 10) error(0x42);
|
||||
}
|
||||
|
||||
|
||||
typedef long ADRT;
|
||||
|
||||
ADRT vfp;
|
||||
|
||||
int PutState()
|
||||
{
|
||||
vfp = 1; /* just needs to compile.... */
|
||||
}
|
||||
|
||||
struct saxer {
|
||||
struct saxer *ptr;
|
||||
unsigned int u_incr;
|
||||
int i_incr;
|
||||
} john[4];
|
||||
|
||||
typedef long X;
|
||||
X typey;
|
||||
#define STL 0x400L
|
||||
|
||||
struct xx {
|
||||
int a, b;
|
||||
};
|
||||
|
||||
test()
|
||||
{
|
||||
register struct saxer *p, *q;
|
||||
register short mask;
|
||||
int dp, z, *zp;
|
||||
long l, lo;
|
||||
register char rc;
|
||||
register int ri;
|
||||
char c;
|
||||
int i;
|
||||
struct xx xa[8/sizeof(struct xx)];
|
||||
struct xx xd[8/4];
|
||||
|
||||
dp = 0x720;
|
||||
mask = ((dp&0xff)<<1) -1;
|
||||
if (mask != 0x3f) error(0x50);
|
||||
|
||||
l = 0x7777ff30;
|
||||
casttest(((int)l)&0xff); /* error 0x51 */
|
||||
lo = 0;
|
||||
l = STL - lo;
|
||||
if (l != 0x400L) error(0x52);
|
||||
l = 0xffffffff;
|
||||
if (!(l & 0x80000000)) error(0x53);
|
||||
l &= 0x80000000;
|
||||
if (l != 0x80000000) error(0x54);
|
||||
|
||||
mask = 1;
|
||||
l = 0xf;
|
||||
mask += (l&1);
|
||||
if (mask != 2) error(0x55);
|
||||
|
||||
z = 1;
|
||||
(*fun[z].func)();
|
||||
if (fglobal != 3) error(0x56);
|
||||
|
||||
typey = 0x71234;
|
||||
fun1(typey); /* error 0x57 */
|
||||
z = 34;
|
||||
z &= 0;
|
||||
if (z) error(0x58);
|
||||
p = &john[0]; q = &john[0];
|
||||
p->u_incr = 2;
|
||||
p->i_incr = 2;
|
||||
p += p->u_incr;
|
||||
q += q->i_incr;
|
||||
if (p != q) error(0x59);
|
||||
if (sizeof(xa) != sizeof(xd)) error(0x5a);
|
||||
zp = &z;
|
||||
*zp = 34;
|
||||
*zp != 0;
|
||||
if (*zp != 34) error(0x5b);
|
||||
if (global1 != 4) error(0x5c);
|
||||
if (global2 != 5) error(0x5d);
|
||||
rc = 6; c = 8; ri = 2; i = 4;
|
||||
c /= ri;
|
||||
if (c != 4) error(0x5e);
|
||||
c /= i;
|
||||
if (c != 1) error(0x5f);
|
||||
rc /= 2;
|
||||
if (rc != 3) error(0x60);
|
||||
}
|
||||
|
||||
casttest(i)
|
||||
int i;
|
||||
{
|
||||
if (i != 0x30) error(0x51);
|
||||
}
|
||||
|
||||
fun1(l)
|
||||
long l;
|
||||
{
|
||||
fglobal = 2;
|
||||
if (l != 0x71234) error(0x57);
|
||||
}
|
||||
|
||||
fun2()
|
||||
{
|
||||
fglobal = 3;
|
||||
}
|
||||
|
||||
test2()
|
||||
{
|
||||
long l;
|
||||
int y();
|
||||
|
||||
|
||||
l = 0xfe00; /* hex constant should be int value, which should go neg */
|
||||
if (l > 0) error(0x61);
|
||||
l = 32768;
|
||||
if (l < 0) error(0x62);
|
||||
f2(fun2,fun2); /* error 0x63 */
|
||||
}
|
||||
|
||||
static f2(a1,a2)
|
||||
char *a1, *a2;
|
||||
{
|
||||
if (a1 != a2) error(0x63);
|
||||
}
|
||||
|
||||
error(ernum)
|
||||
int ernum;
|
||||
{
|
||||
printf("error %x\n",ernum);
|
||||
err++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user