--- /dev/null
+/*
+ * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ *
+ * This product is part of the Amsterdam Compiler Kit.
+ *
+ * Permission to use, sell, duplicate or disclose this software must be
+ * obtained in writing. Requests for such permissions may be sent to
+ *
+ * Dr. Andrew S. Tanenbaum
+ * Wiskundig Seminarium
+ * Vrije Universiteit
+ * Postbox 7161
+ * 1007 MC Amsterdam
+ * The Netherlands
+ *
+ */
+
+/* Author: E.G. Keizer */
+
+/* Test a few declaration features */
+/* Such as:
+ forward function declarations,
+ redeclarations,
+ pointer to function declarations.
+*/
+
+static int sqr() ; /* forward declarations */
+extern int sqrt();
+
+main() {
+ fdcl() ;
+ hidden() ;
+ return 0 ;
+}
+
+fdcl() {
+ int (*a[2])() ;
+
+ printf("sqr(4) %d\n",sqr(4)) ;
+
+ a[0]=sqr ; a[1]=sqrt ;
+ printf("(*a[0])(16) %d\n",(*a[0])(16) ) ;
+ printf("(*a[1])( (*a[0])(3) ) %d\n", (*a[1])( (*a[0])(3) ) ) ;
+}
+
+static int sqr(par) int par ; {
+ return par*par ;
+}
+
+int sqrt(par) int par ; {
+ float x1,x2 ;
+ int i ;
+
+ if ( par<0 ) return -1 ;
+ x1 = par ;
+ i=0 ;
+ do {
+ x2 = x1 ;
+ x1 = ( x2*x2 + par ) / (2*x2) ;
+ if ( i++>=100 ) return -2 ;
+ } while ( ( x2<x1 ? x1-x2 : x2-x1 ) > 1e-5 ) ;
+ return (x1+x2)/2 ;
+}
+
+int a = -8 ;
+
+hidden() {
+ hide() ;
+ printf("a outside hide %d\n",a) ;
+}
+
+int hide() {
+ int a ;
+
+ a = 4 ;
+ printf("a in hide %d\n",a) ;
+ {
+ int a ;
+
+ a = 16 ;
+ printf("a in in hide %d\n",a) ;
+
+ }
+ printf("a in hide %d\n",a) ;
+}
--- /dev/null
+sqr(4) 16
+(*a[0])(16) 256
+(*a[1])( (*a[0])(3) ) 3
+a in hide 4
+a in in hide 16
+a in hide 4
+a outside hide -8
--- /dev/null
+make "P=decl" -fsk ../makefile ${1-gen}
--- /dev/null
+/*
+ * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ *
+ * This product is part of the Amsterdam Compiler Kit.
+ *
+ * Permission to use, sell, duplicate or disclose this software must be
+ * obtained in writing. Requests for such permissions may be sent to
+ *
+ * Dr. Andrew S. Tanenbaum
+ * Wiskundig Seminarium
+ * Vrije Universiteit
+ * Postbox 7161
+ * 1007 MC Amsterdam
+ * The Netherlands
+ *
+ */
+
+/* Author: E.G. Keizer */
+
+main() {
+
+ assnull() ;
+ ushift() ;
+ lshift() ;
+ uadd() ;
+ return 0 ;
+}
+
+int a,b ;
+assnull() {
+ int c,d ;
+ /* test a few cases handled especially by the cem-compiler */
+
+ a= -1 ; b= -1 ; c= -1 ; d = -1 ;
+
+ a=b=0 ;
+ c=d=0 ;
+ printf("a %d, b %d, c %d, d %d\n",a,b,c,d) ;
+ a = b = c = d = -32 ;
+ printf (" (a=0) %d, (c=0) %d\n",(a=0),(c=0) ) ;
+ printf("a %d, b %d, c %d, d %d\n",a,b,c,d) ;
+
+}
+ushift() {
+ unsigned u ;
+
+ printf("Unsigned shifts by constants\n") ;
+ u = 0150715 ;
+ printf(" u = %06o\n",u) ;
+ printf(" u>>0 %06o\n", u>>0 ) ;
+ printf(" u>>1 %06o\n", u>>1 ) ;
+ printf(" u>>2 %06o\n", u>>2 ) ;
+ printf(" u>>3 %06o\n", u>>3 ) ;
+ printf(" u>>4 %06o\n", u>>4 ) ;
+ printf(" u>>5 %06o\n", u>>5 ) ;
+ printf(" u>>6 %06o\n", u>>6 ) ;
+ printf(" u>>7 %06o\n", u>>7 ) ;
+ printf(" u>>8 %06o\n", u>>8 ) ;
+ printf(" u>>9 %06o\n", u>>9 ) ;
+ printf(" u>>10 %06o\n", u>>10 ) ;
+ printf(" u>>11 %06o\n", u>>11 ) ;
+ printf(" u>>12 %06o\n", u>>12 ) ;
+ printf(" u>>13 %06o\n", u>>13 ) ;
+ printf(" u>>14 %06o\n", u>>14 ) ;
+ printf(" u>>15 %06o\n", u>>15 ) ;
+ printf(" u>>16 %06o\n", u>>16 ) ;
+ printf(" u<<0 %06o\n", u<<0 ) ;
+ printf(" u<<1 %06o\n", u<<1 ) ;
+ printf(" u<<2 %06o\n", u<<2 ) ;
+ printf(" u<<3 %06o\n", u<<3 ) ;
+ printf(" u<<4 %06o\n", u<<4 ) ;
+ printf(" u<<5 %06o\n", u<<5 ) ;
+ printf(" u<<6 %06o\n", u<<6 ) ;
+ printf(" u<<7 %06o\n", u<<7 ) ;
+ printf(" u<<8 %06o\n", u<<8 ) ;
+ printf(" u<<9 %06o\n", u<<9 ) ;
+ printf(" u<<10 %06o\n", u<<10 ) ;
+ printf(" u<<11 %06o\n", u<<11 ) ;
+ printf(" u<<12 %06o\n", u<<12 ) ;
+ printf(" u<<13 %06o\n", u<<13 ) ;
+ printf(" u<<14 %06o\n", u<<14 ) ;
+ printf(" u<<15 %06o\n", u<<15 ) ;
+ printf(" u<<16 %06o\n", u<<16 ) ;
+}
+
+lshift() {
+ long ll ;
+
+ printf("Long shifts by constants\n") ;
+ ll = 400000L - 0532 ;
+ printf(" ll = %011O\n",ll) ;
+ printf(" ll>>0 %011O\n", ll>>0 ) ;
+ printf(" ll>>1 %011O\n", ll>>1 ) ;
+ printf(" ll>>2 %011O\n", ll>>2 ) ;
+ printf(" ll>>3 %011O\n", ll>>3 ) ;
+ printf(" ll>>4 %011O\n", ll>>4 ) ;
+ printf(" ll>>5 %011O\n", ll>>5 ) ;
+ printf(" ll>>6 %011O\n", ll>>6 ) ;
+ printf(" ll>>7 %011O\n", ll>>7 ) ;
+ printf(" ll>>8 %011O\n", ll>>8 ) ;
+ printf(" ll>>9 %011O\n", ll>>9 ) ;
+ printf(" ll>>10 %011O\n", ll>>10 ) ;
+ printf(" ll>>11 %011O\n", ll>>11 ) ;
+ printf(" ll>>12 %011O\n", ll>>12 ) ;
+ printf(" ll>>13 %011O\n", ll>>13 ) ;
+ printf(" ll>>14 %011O\n", ll>>14 ) ;
+ printf(" ll>>15 %011O\n", ll>>15 ) ;
+ printf(" ll>>16 %011O\n", ll>>16 ) ;
+ printf(" ll>>17 %011O\n", ll>>17 ) ;
+ printf(" ll>>18 %011O\n", ll>>18 ) ;
+ printf(" ll>>19 %011O\n", ll>>19 ) ;
+ printf(" ll>>20 %011O\n", ll>>20 ) ;
+ printf(" ll>>21 %011O\n", ll>>21 ) ;
+ printf(" ll>>22 %011O\n", ll>>22 ) ;
+ printf(" ll>>23 %011O\n", ll>>23 ) ;
+ printf(" ll>>24 %011O\n", ll>>24 ) ;
+ printf(" ll>>25 %011O\n", ll>>25 ) ;
+ printf(" ll>>26 %011O\n", ll>>26 ) ;
+ printf(" ll>>27 %011O\n", ll>>27 ) ;
+ printf(" ll>>28 %011O\n", ll>>28 ) ;
+ printf(" ll>>29 %011O\n", ll>>29 ) ;
+ printf(" ll>>30 %011O\n", ll>>30 ) ;
+ printf(" ll>>31 %011O\n", ll>>31 ) ;
+ ll = 1 ;
+ printf(" ll<<0 %011O\n", ll<<0 ) ;
+ printf(" ll<<1 %011O\n", ll<<1 ) ;
+ printf(" ll<<2 %011O\n", ll<<2 ) ;
+ printf(" ll<<3 %011O\n", ll<<3 ) ;
+ printf(" ll<<4 %011O\n", ll<<4 ) ;
+ printf(" ll<<5 %011O\n", ll<<5 ) ;
+ printf(" ll<<6 %011O\n", ll<<6 ) ;
+ printf(" ll<<7 %011O\n", ll<<7 ) ;
+ printf(" ll<<8 %011O\n", ll<<8 ) ;
+ printf(" ll<<9 %011O\n", ll<<9 ) ;
+ printf(" ll<<10 %011O\n", ll<<10 ) ;
+ printf(" ll<<11 %011O\n", ll<<11 ) ;
+ printf(" ll<<12 %011O\n", ll<<12 ) ;
+ printf(" ll<<13 %011O\n", ll<<13 ) ;
+ printf(" ll<<14 %011O\n", ll<<14 ) ;
+ printf(" ll<<15 %011O\n", ll<<15 ) ;
+ printf(" ll<<16 %011O\n", ll<<16 ) ;
+ printf(" ll<<17 %011O\n", ll<<17 ) ;
+ printf(" ll<<18 %011O\n", ll<<18 ) ;
+ printf(" ll<<19 %011O\n", ll<<19 ) ;
+ printf(" ll<<20 %011O\n", ll<<20 ) ;
+ printf(" ll<<21 %011O\n", ll<<21 ) ;
+ printf(" ll<<22 %011O\n", ll<<22 ) ;
+ printf(" ll<<23 %011O\n", ll<<23 ) ;
+ printf(" ll<<24 %011O\n", ll<<24 ) ;
+ printf(" ll<<25 %011O\n", ll<<25 ) ;
+ printf(" ll<<26 %011O\n", ll<<26 ) ;
+ printf(" ll<<27 %011O\n", ll<<27 ) ;
+ printf(" ll<<28 %011O\n", ll<<28 ) ;
+ printf(" ll<<29 %011O\n", ll<<29 ) ;
+ printf(" ll<<30 %011O\n", ll<<30 ) ;
+}
+uadd() {
+ unsigned u ;
+ int i ;
+
+ u = 32760 ;
+ for ( i=0 ; i<=16 ; ++i ) {
+ printf("%2d %06o\n",i,u+i) ;
+ }
+}
--- /dev/null
+a 0, b 0, c 0, d 0
+ (a=0) 0, (c=0) 0
+a 0, b -32, c 0, d -32
+Unsigned shifts by constants
+ u = 150715
+ u>>0 150715
+ u>>1 064346
+ u>>2 032163
+ u>>3 015071
+ u>>4 006434
+ u>>5 003216
+ u>>6 001507
+ u>>7 000643
+ u>>8 000321
+ u>>9 000150
+ u>>10 000064
+ u>>11 000032
+ u>>12 000015
+ u>>13 000006
+ u>>14 000003
+ u>>15 000001
+ u>>16 000000
+ u<<0 150715
+ u<<1 121632
+ u<<2 043464
+ u<<3 107150
+ u<<4 016320
+ u<<5 034640
+ u<<6 071500
+ u<<7 163200
+ u<<8 146400
+ u<<9 115000
+ u<<10 032000
+ u<<11 064000
+ u<<12 150000
+ u<<13 120000
+ u<<14 040000
+ u<<15 100000
+ u<<16 000000
+Long shifts by constants
+ ll = 00001414446
+ ll>>0 00001414446
+ ll>>1 00000606223
+ ll>>2 00000303111
+ ll>>3 00000141444
+ ll>>4 00000060622
+ ll>>5 00000030311
+ ll>>6 00000014144
+ ll>>7 00000006062
+ ll>>8 00000003031
+ ll>>9 00000001414
+ ll>>10 00000000606
+ ll>>11 00000000303
+ ll>>12 00000000141
+ ll>>13 00000000060
+ ll>>14 00000000030
+ ll>>15 00000000014
+ ll>>16 00000000006
+ ll>>17 00000000003
+ ll>>18 00000000001
+ ll>>19 00000000000
+ ll>>20 00000000000
+ ll>>21 00000000000
+ ll>>22 00000000000
+ ll>>23 00000000000
+ ll>>24 00000000000
+ ll>>25 00000000000
+ ll>>26 00000000000
+ ll>>27 00000000000
+ ll>>28 00000000000
+ ll>>29 00000000000
+ ll>>30 00000000000
+ ll>>31 00000000000
+ ll<<0 00000000001
+ ll<<1 00000000002
+ ll<<2 00000000004
+ ll<<3 00000000010
+ ll<<4 00000000020
+ ll<<5 00000000040
+ ll<<6 00000000100
+ ll<<7 00000000200
+ ll<<8 00000000400
+ ll<<9 00000001000
+ ll<<10 00000002000
+ ll<<11 00000004000
+ ll<<12 00000010000
+ ll<<13 00000020000
+ ll<<14 00000040000
+ ll<<15 00000100000
+ ll<<16 00000200000
+ ll<<17 00000400000
+ ll<<18 00001000000
+ ll<<19 00002000000
+ ll<<20 00004000000
+ ll<<21 00010000000
+ ll<<22 00020000000
+ ll<<23 00040000000
+ ll<<24 00100000000
+ ll<<25 00200000000
+ ll<<26 00400000000
+ ll<<27 01000000000
+ ll<<28 02000000000
+ ll<<29 04000000000
+ ll<<30 10000000000
+ 0 077770
+ 1 077771
+ 2 077772
+ 3 077773
+ 4 077774
+ 5 077775
+ 6 077776
+ 7 077777
+ 8 100000
+ 9 100001
+10 100002
+11 100003
+12 100004
+13 100005
+14 100006
+15 100007
+16 100010
--- /dev/null
+make "P=ops" -fskk ../makefile ${1-gen}
--- /dev/null
+/*
+ * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ *
+ * This product is part of the Amsterdam Compiler Kit.
+ *
+ * Permission to use, sell, duplicate or disclose this software must be
+ * obtained in writing. Requests for such permissions may be sent to
+ *
+ * Dr. Andrew S. Tanenbaum
+ * Wiskundig Seminarium
+ * Vrije Universiteit
+ * Postbox 7161
+ * 1007 MC Amsterdam
+ * The Netherlands
+ *
+ */
+
+/* Author: E.G. Keizer */
+
+/* This programs is a collection of derived from small tests develloped
+ for specific bugs/features in the C->EM compiler
+*/
+
+char * err_name ;
+
+set_err(s) char *s ; {
+ printf("%s\n",s) ;
+ err_name= s ;
+}
+e(i) {
+ printf("%s: error %d\n",err_name,i) ;
+}
+
+main() {
+ cmp_rev() ;
+ loc_dif() ;
+ con_fold() ;
+ ass_res() ;
+ c_to_l() ;
+ acc_struct() ;
+ char_param() ;
+ addr_lb() ;
+ compl_ind() ;
+ printf("END\n") ;
+}
+
+cmp_rev() {
+ /* Some compilers magically transform the second < into a > */
+ int i,j ;
+ int result ;
+
+ set_err("cmp_rev") ;
+ i=2 ; j=1 ;
+ result= ( (j-i<0) == (j-i<0) ) ? 1 : 0 ;
+ if ( !result ) e(1) ;
+}
+
+loc_dif() {
+ set_err("loc_dif") ;
+ loc_fa(1,2) ;
+}
+
+loc_fa(p1,p2) {
+ int i ;
+ if ( &p1-&p2 != -1 ) e(1) ;
+ if ( &i-&p1 >=0 ) e(2) ;
+ if ( &p1-&i <=0 ) e(3) ;
+}
+
+con_fold() {
+ set_err("con_fold") ;
+ con_flo( (1 ? 3 : 4.5), 200, 200, 200 ) ;
+ con_lo( 4L + 3, 1 ) ;
+}
+con_flo(d) double d ; {
+ if ( d>3.00001 || d<2.99999 ) e(1) ;
+}
+con_lo(l) long l ; {
+ if ( l!=7 ) e(2) ;
+}
+
+ass_res() {
+ char c, *pc ;
+ int i ;
+ int s_extend ;
+
+ set_err("ass_res") ;
+ c = -1 ; i=c ;
+ s_extend= i== -1 ;
+
+ pc = &c ;
+ i = ( *pc++ = 01777 ) ;
+ switch ( i ) {
+ case 01777 :
+ e(1) ; break ;
+ case -1 :
+ if ( !s_extend ) e(2) ;
+ break ;
+ case 0377 :
+ if ( s_extend ) e(3) ;
+ break ;
+ default :
+ e(4) ;
+ }
+}
+
+c_to_l() {
+ char c = -1 ;
+ long l ;
+
+ set_err("c_to_l") ;
+ l= c ;
+ if ( c==255 ) {
+ if ( l!=255 ) e(1) ;
+ } else {
+ if ( l!= -1 ) e(2) ;
+ }
+}
+
+acc_struct() {
+ struct s1 { char s1_a[3] ; } ss1, is1 ;
+ struct s2 {
+ int s2_i ;
+ struct s1 s2_s1 ;
+ } ;
+ struct s3 {
+ int s3_i ;
+ struct s2 s3_s2 ;
+ } ss3, *ps3 ;
+
+ set_err("acc_struct") ;
+ ps3 = &ss3 ;
+ is1.s1_a[0]=1 ; is1.s1_a[1]=100 ; is1.s1_a[2]=127 ;
+ ss3.s3_s2.s2_s1= is1 ;
+ ss1 = ps3->s3_s2.s2_s1 ;
+ if ( ss1.s1_a[0]!=1 ) e(1) ;
+ if ( ss1.s1_a[1]!=100 ) e(2) ;
+ if ( ss1.s1_a[2]!=127 ) e(3) ;
+}
+
+char_param() {
+ set_err("char_param") ;
+ fcall(1,01002,-1) ;
+}
+
+fcall(c1,c2,c3) char c1,c2,c3 ; {
+ if ( c1!=1 ) e(1) ;
+ if ( c2!=2 ) e(2) ;
+ c_alter(&c1,127) ;
+ if ( c1!=127 ) e(3) ;
+ c_alter(&c3,0) ;
+ if ( c3 ) e(4) ;
+}
+
+c_alter(ptr,val) char *ptr ; int val ; {
+ *ptr= val ;
+}
+
+addr_lb() {
+ char a[6] ;
+ int i ;
+
+ set_err("addr_lb");
+ i=6 ;
+ if ( &a[6] != a+i ) e(1) ;
+}
+compl_ind() {
+ char arr[20] ;
+ int i ;
+ set_err("compl_ind") ;
+ arr[10]=111 ;
+ i=0 ; if ( arr[i+10] != 111 ) e(1) ;
+}
--- /dev/null
+cmp_rev
+loc_dif
+con_fold
+ass_res
+c_to_l
+acc_struct
+char_param
+addr_lb
+compl_ind
+END
--- /dev/null
+make "P=bugs" -fsk ../makefile ${1-gen}
--- /dev/null
+make "P=test" -fsk ../makefile ${1-gen}
--- /dev/null
+/*
+ * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ *
+ * This product is part of the Amsterdam Compiler Kit.
+ *
+ * Permission to use, sell, duplicate or disclose this software must be
+ * obtained in writing. Requests for such permissions may be sent to
+ *
+ * Dr. Andrew S. Tanenbaum
+ * Wiskundig Seminarium
+ * Vrije Universiteit
+ * Postbox 7161
+ * 1007 MC Amsterdam
+ * The Netherlands
+ *
+ */
+
+/* C-compiler test 1 */
+/* This program can be used to test C-compilers */
+
+# define EPSD 1e-6
+# define EPSF 1e-6
+
+/* global counters */
+
+int t, /* the value indicates the number of the test procedure */
+ ect, /* error counter */
+ tct; /* count the number of test procedures called */
+
+/****************************************************************************/
+/*
+ * The following is tested:
+ * INTEGER CONSTANTS in test1
+ * GLOBAL INTEGER VARIABLES in test2
+ * LOCAL INTEGER VARIABLES in test3
+ * GLOBAL LONG VARIABLES in test4
+ * LOCAL LONG VARIABLES in test5
+ * REAL ARITHMETIC in test6
+ * GLOBAL RECORDS in test7
+ * LOCAL RECORDS in test8
+ * GLOBAL ARRAYS in test9
+ * LOCAL ARRAYS in test10
+ * GLOBAL POINTERS in test11
+ */
+/***************************************************************************/
+char alstr[1000] ;
+char *alptr = alstr ;
+
+char *alloc(size) {
+ register char *retval ;
+
+ retval=alptr ;
+ alptr += size ;
+ if ( alptr-alstr>sizeof alstr ) {
+ printf("allocation overflow\n") ;
+ exit(8) ;
+ }
+ return(retval) ;
+}
+
+double fabs(a) double a ; { return( a<0 ? -a : a) ; }
+
+
+
+/* global variables for the test procedures */
+
+int i,j,k,l,m;
+
+long li,lj,lk,ll,lm;
+
+float xf, yf, zf;
+
+double xd, yd, zd;
+
+struct tp2 {
+ char c1;
+ int i,j;
+ float aaa;
+ double bbb;
+} r1, r2;
+
+int p, *p1, *p11, **p2, ***p3, ****p4, *****p5;
+
+struct tp2 *pp1, *pp2, *pp3;
+int a1[20];
+float a2[20];
+double a3[20];
+
+main()
+{
+ tct = 0;
+ ect = 0;
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+ test6();
+ test7();
+ test8();
+ test9();
+ test10();
+ test11();
+ printf("End of test program, %d tests completed, %d errors detected\n",
+ tct,ect);
+ return 0 ;
+}
+
+
+
+e(n)
+int n;
+{
+ ect++;
+ printf("Error %d in test%d \n",n,t);
+}
+
+
+
+test1() /* testing integer constants */
+{
+ t = 1;
+ tct++;
+ if (0) e(1);
+ if (!1) e(2);
+ if ( 1+2 != 3 ) e(3);
+ if (-500 - 234 != -734) e(4);
+ if (-32 + 155 != 123) e(5);
+ if ( 2*3 != 6) e(6);
+ if ( 3*4*5*6 != 360) e(7);
+ if ( 654-3*2 != 648) e(8);
+ if (5*5 + 5*5 != 50) e(9);
+ if ( 1+1-1+1-1+1-1+1-1+1 != 2) e(10);
+/**********************************************************************/
+ if ( ((((((((((((((((((((0)))))))))))))))))))) ) e(11);
+ if ( (((-2))) - ((((-3)))) * (3+((2))) != 13 ) e(12);
+ if ( 1+1 != 2 ) e(13);
+ if ( 3333 + 258 != 3591) e(14);
+ if (3*4 != 12) e(15);
+ if (111*111 != 12321) e(16);
+ if (50 / 5 != 10) e(17);
+ if (7498 / 75 != 99) e(18);
+ if (456 - 345 != 111) e(19);
+ if (1+(-2) != -1) e(20);
+ if (-3 * -4 != 12) e(21);
+ if (-2 / 2 != -1) e(22);
+ if (-5 / 1 != -5) e(23);
+ if (-4 - -5 != 1) e(24);
+ if ( 03 + 02 != 05) e(25);
+ if ( 03456 + 88 != 03606 ) e(26);
+ if ( 0100 * 23 != 02700 ) e(27);
+ if ( 045 / 020 != 2 ) e(28);
+ if ( 0472 - 0377 != 073 ) e(29);
+ if ( 'a' != 'a' ) e(30);
+ if ( 'a' + 'c' != 'b' + 'b' ) e(31);
+ if ( 'z' * 'z' != 14884 ) e(32);
+ if ( -'z' / 01 != -'z' ) e(33);
+ if ( 077777 >> 3 != 07777 ) e(34);
+ if ( 077777 >> 15 ) e(35);
+ if ( ( 0124 & 07765 ) != 0124 ) e(37);
+ if ( ( 34 & 31 ) != 2 ) e(38);
+ if (( 5 | 013 | 020 ) != 31 ) e(39);
+ if ( ( -7 ^ 3 ) != -6 ) e(40);
+ if ( (07373 ^ 4632 ) != 016343 ) e(41);
+ if ( (1+2+3)*(2+3+4)*(3+5+5) / 2 != ((3*((5+3+2)*10)+51)*6)/6 ) e(42);
+ if ( (1000*2+5*7+13)/8 != 2*2*2*2*4*4 ) e(43);
+ if ( ( 1*2*3*4*5*6*7 / 5040 ) != 5040 / 7 / 6 / 5 / 4 / 3 / 2 / 1 ) e(44);
+ if ( (-(-(-(-(-(-(1))))))) != 1) e(45);
+ if ( - 1 != -((((((((1)))))))) ) e(46);
+ if ( -1-1-1-1-1-1 != -6+3-3 ) e(47);
+ if ( 2<1 ) e(48);
+ if ( 2==3 ) e(49);
+ if ( 2 != 2 ) e(50);
+ if ( 2>3 ) e(51);
+ if ( 2+0 != 2 ) e(52);
+ if ( 2-0 != 2 ) e(53);
+ if ( 2*0 != 0 ) e(54);
+ if ( 0/1 != 0 ) e(55);
+ if ( 0*0 != 0 ) e(56);
+ if (32767 > 32767) e(57);
+ if ( -32768 > -32767 ) e(58);
+ if ( 0456 < 0400 ) e(59);
+ if ( 0456 != ( 0400 | 050 | 06 ) ) e(60);
+ if ( 2*2 + (2<<2) != 12 ) e(61);
+ if ( 0 || 0 ) e(62);
+ if ( 1 && 0 ) e(63);
+ if ( ( 123 ? 123*4 : 345 ) != 492 ) e(64);
+ if ( ( 0 ? 345 : 280 ) != 280 ) e(65);
+ if ( ( 4>>10 ) + 3 != 3 ) e(66);
+ if ( ! ( 111 || 23 && 0 ) ) e(67);
+ if ( !1 ) e(68);
+ if ( !0 == 0 ) e(69);
+ if ( !!!!!!!!!!0 ) e(70);
+ if ( 2*2*2*2 != 4*4 ) e(71);
+ if ( 0 && 0 && 0 && 0000 && 000000000000 ) e(72);
+ if ( 1 & 1 & 1 && 1 & 1 && 1 & 0 ) e(73);
+ if ( 01 + 01 + 01 != 1 + 1 + 1 ) e(74);
+ if ( 07 + 1 != 010 ) e(75);
+ if ( ('a' & 017777) != 'a' ) e(76);
+ if ( ( 3 >> 0 ) != 3 ) e(77);
+ if ( ( 3 << 0 ) != 3 ) e(78);
+ if ( ((((((((((3)))))))))) << ((((((((((((2)))))))))))) != 12 ) e(79);
+ if ( (((3 << 4)) >> 4) != 3 ) e(80);
+ if ( (2+'a')*'b' != 2*'b' + 'a'*'b' ) e(81);
+ if ( 'a' * 'a' < 0 ) e(82);
+ if ( ('a'-'a'+'a'-'a'+('a'-'a')*'h') >> 3 ) e(82);
+ if ( 'z' - 01 != 'y' + 00 ) e(83);
+ if ( 'a' ^ 'a' ) e(84);
+ if ( 'h' ^ 'h' ^ 'a' ^ 'a' ) e(85);
+ if ( 0567 ^ (0500 | 060 | 7 ) ) e(86);
+ if ( 0 ^ 0 ^ 0 ^ 00 ) e(87);
+ if ( ( !0 ) ^ (!0) ) e(88);
+ if ( ( !!!40 ) ^ (!!!050) ) e(89);
+ if ( ( 6^7 ) * 345 != 345 ) e(90);
+ if ( !!!!!!!!!!!!! 'k' ) e(91);
+ if ( !!!((('k'))) ) e(92);
+ if ( -0 != 0 ) e(93) ;
+}
+
+
+
+
+test2() /* testing global integer variables */
+{
+ t = 2;
+ tct++;
+ i = 1;
+ j = 2;
+ k = 3;
+ l = 4;
+ m = 10;
+ if ( i + j != k ) e(1);
+ if ( i + k != l ) e(2);
+ if ( j - k != -i ) e(3);
+ if ( j*(j+k) != m ) e(4);
+ if ( -m != -(k+k+l) ) e(5);
+ if ( i/i != 1 ) e(6);
+ if ( m*m / m != m ) e(7);
+ if ( 10*m != 100 ) e(8);
+ if ( m * (-10) != -100 ) e(9);
+ if ( j/k != 0 ) e(10);
+ if ( 100/k != 33 ) e(11);
+ if ( i+j*k+l+m / j+50 / k != 32 ) e(12);
+ if ( j*k*m / 6 != 10 ) e(13);
+ if ( (k>4) || (k>=4) || (k==4) ) e(14);
+ if ( (m<j) || (m<=j) || (m==j) ) e(15);
+ if ( i+j-k ) e(16);
+ if ( j<i ) e(17);
+ if ( j != j ) e(18);
+ if ( i>j ) e(19);
+ if ( (i>j ? k : k*j) != 6 ) e(20);
+ if ( (i<j ? k : k*j) != 3 ) e(21);
+ if ( j<<i != l ) e(22);
+ if ( j>> i != i ) e(25);
+ if ( i++ != 1 ) e(26);
+ if ( --i != 1 ) e(27);
+ if ( i-- != 1 ) e(28);
+ if ( (i+j) && (i<0) || (m-10) && (064) ) e(29);
+ if ( (i+j) && !(i>=0) || (m-10) && !(0) ) e(30);
+ i = 2;
+ j = 4;
+ k = 8;
+ l = 16;
+ m = 32;
+ if ( i != 02 ) e(31);
+ if ( j != 04 ) e(32);
+ if ( k != 010 ) e(33);
+ if ( l != 020 ) e(34);
+ if ( i & j ) e(35);
+ if ( i & j & k & l & m ) e(36);
+ if ( ! ( i & j & k & l & m | i ) ) e(37);
+ if ( ( i >> 0 ) != i ) e(38);
+ if ( (( i/i ) << 1 ) != 02 ) e(39);
+ if ( ( i | (j) | (k) | (l) | (m) ) != i+j+k+l+m ) e(40);
+ if (!(i^j) ) e(41);
+ if ( !(i^j^k^l^m) ) e(42);
+ if ( ( --i << 1 ) != 2 ) e(43);
+ if ( ( i << 01 ) != 2 ) e(44);
+ if ( i%j != i ) e(45);
+ if ( k%l != k ) e(46);
+ if (( (m/l) << i >> i ) != 2 ) e(47);
+ if ( (i = j = k = l = m) != m ) e(48);
+ if ( ( i!=j ) || ( j!=k ) || !(l==m) ) e(49);
+ if ( (i<j) || (j>i) || (k<m) ) e(50);
+ if ( (i%j) || (j%i) || (k%l) || (m%l) ) e(51);
+ if ( (i% (j<<0) + ((j<<3)>>3)%(i/i)) ) e(52);
+ if ( ! ( i++ == j++ ) ) e(53);
+ if ( i != j ) e(54);
+ if ( i++ != (j++) ) e(55);
+ i = 1;
+ j = i + 1;
+ if ( -i != -i ) e(56);
+ if ( i != --j ) e(57);
+ if ( (((((i))))) != -(-(-(-(i)))) ) e(59);
+ if ( j != 1 ) e(60);
+}
+
+
+
+
+test3() /* testing local integer variables */
+{
+ int a,b,c,d,f;
+
+ t = 3;
+ tct++;
+ a = 1;
+ b = 2;
+ c = 3;
+ d = 4;
+ f = 10;
+ if ( a + b != c ) e(1);
+ if ( a + c != d ) e(2);
+ if ( b - c != -a ) e(3);
+ if ( b*(b+c) != f ) e(4);
+ if ( -f != -(c+c+d) ) e(5);
+ if ( a/a != 1 ) e(6);
+ if ( f*f / f != f ) e(7);
+ if ( 10*f != 100 ) e(8);
+ if ( f * (-10) != -100 ) e(9);
+ if ( b/c != 0 ) e(10);
+ if ( 100/c != 33 ) e(11);
+ if ( a+b*c+d+f / b+50 / c != 32 ) e(12);
+ if ( b*c*f / 6 != 10 ) e(13);
+ if ( (c>4) || (c>=4) || (c==4) ) e(14);
+ if ( (f<b) || (f<=b) || (f==b) ) e(15);
+ if ( a+b-c ) e(16);
+ if ( b<a ) e(17);
+ if ( b != b ) e(18);
+ if ( a>b ) e(19);
+ if ( (a>b ? c : c*b) != 6 ) e(20);
+ if ( (a<b ? c : c*b) != 3 ) e(21);
+ if ( b<<a != d ) e(22);
+ if ( b>> a != a ) e(25);
+ if ( a++ != 1 ) e(26);
+ if ( --a != 1 ) e(27);
+ if ( a-- != 1 ) e(28);
+ if ( (a+b) && (a<0) || (f-10) && (064) ) e(29);
+ if ( (a+b) && !(a>=0) || (f-10) && !(0) ) e(30);
+ a = 2;
+ b = 4;
+ c = 8;
+ d = 16;
+ f = 32;
+ if ( a != 02 ) e(31);
+ if ( b != 04 ) e(32);
+ if ( c != 010 ) e(33);
+ if ( d != 020 ) e(34);
+ if ( a & b ) e(35);
+ if ( a & b & c & d & f ) e(36);
+ if ( ! ( a & b & c & d & f | a ) ) e(37);
+ if ( ( a >> 0 ) != a ) e(38);
+ if ( (( a/a ) << 1 ) != 02 ) e(39);
+ if ( ( a | (b) | (c) | (d) | (f) ) != a+b+c+d+f ) e(40);
+ if (!(a^b) ) e(41);
+ if ( !(a^b^c^d^f) ) e(42);
+ if ( ( --a << 1 ) != 2 ) e(43);
+ if ( ( a << 01 ) != 2 ) e(44);
+ if ( a%b != a ) e(45);
+ if ( c%d != c ) e(46);
+ if (( (f/d) << a >> a ) != 2 ) e(47);
+ if ( (a = b = c = d = f) != f ) e(48);
+ if ( ( a!=b ) || ( b!=c ) || !(d==f) ) e(49);
+ if ( (a<b) || (b>a) || (c<f) ) e(50);
+ if ( (a%b) || (b%a) || (c%d) || (f%d) ) e(51);
+ if ( (a%(b<<0) + ((b<<3)>>3)%(a/a)) ) e(52);
+ if ( ! ( a++ == b++ ) ) e(53);
+ if ( a != b ) e(54);
+ if ( a++ != (b++) ) e(55);
+ a = 1;
+ b = a + 1;
+ if ( -a != -a ) e(56);
+ if ( a != --b ) e(57);
+ if ( (((((a))))) != -(-(-(-(a)))) ) e(59);
+ if ( b != 1 ) e(60);
+}
+
+
+
+
+test4() /* testing global long variables */
+{
+ t = 4;
+ tct++;
+ li = 1;
+ lj = 2;
+ lk = 3;
+ ll = 4;
+ lm = 10;
+ if ( li + lj != lk ) e(1);
+ if ( li + lk != ll ) e(2);
+ if ( lj - lk != -li ) e(3);
+ if ( lj*(lj+lk) != lm ) e(4);
+ if ( -lm != -(lk+lk+ll) ) e(5);
+ if ( li/li != 1 ) e(6);
+ if ( lm*lm / lm != lm ) e(7);
+ if ( 10*lm != 100 ) e(8);
+ if ( lm * (-10) != -100 ) e(9);
+ if ( lj/lk != 0 ) e(10);
+ if ( 100/lk != 33 ) e(11);
+ if ( li+lj*lk+ll+lm / lj+50 / lk != 32 ) e(12);
+ if ( lj*lk*lm / 6 != 10 ) e(13);
+ if ( (lk>4) || (lk>=4) || (lk==4) ) e(14);
+ if ( (lm<lj) || (lm<=lj) || (lm==lj) ) e(15);
+ if ( li+lj-lk ) e(16);
+ if ( lj<li ) e(17);
+ if ( lj != lj ) e(18);
+ if ( li>lj ) e(19);
+ if ( (li>lj ? lk : lk*lj) != 6 ) e(20);
+ if ( (li<lj ? lk : lk*lj) != 3 ) e(21);
+ if ( lj<<li != ll ) e(22);
+ if ( lj>> li != li ) e(25);
+ if ( li++ != 1 ) e(26);
+ if ( --li != 1 ) e(27);
+ if ( li-- != 1 ) e(28);
+ if ( (li+lj) && (li<0) || (lm-10) && (064) ) e(29);
+ if ( (li+lj) && !(li>=0) || (lm-10) && !(0) ) e(30);
+ li = 2;
+ lj = 4;
+ lk = 8;
+ ll = 16;
+ lm = 32;
+ if ( li != 02 ) e(31);
+ if ( lj != 04 ) e(32);
+ if ( lk != 010 ) e(33);
+ if ( ll != 020 ) e(34);
+ if ( li & lj ) e(35);
+ if ( li & lj & lk & ll & lm ) e(36);
+ if ( ! ( li & lj & lk & ll & lm | li ) ) e(37);
+ if ( ( li >> 0 ) != li ) e(38);
+ if ( (( li/li ) << 1 ) != 02 ) e(39);
+ if ( ( li | (lj) | (lk) | (ll) | (lm) ) != li+lj+lk+ll+lm ) e(40);
+ if (!(li^lj) ) e(41);
+ if ( !(li^lj^lk^ll^lm) ) e(42);
+ if ( ( --li << 1 ) != 2 ) e(43);
+ if ( ( li << 01 ) != 2 ) e(44);
+ if ( li%lj != li ) e(45);
+ if ( lk%ll != lk ) e(46);
+ if (( (lm/ll) << li >> li ) != 2 ) e(47);
+ if ( (li = lj = lk = ll = lm) != lm ) e(48);
+ if ( ( li!=lj ) || ( lj!=lk ) || !(ll==lm) ) e(49);
+ if ( (li<lj) || (lj>li) || (lk<lm) ) e(50);
+ if ( (li%lj) || (lj%li) || (lk%ll) || (lm%ll) ) e(51);
+ if ( (li%(lj<<0) + ((lj<<3)>>3)%(li/li)) ) e(52);
+ if ( ! ( li++ == lj++ ) ) e(53);
+ if ( li != lj ) e(54);
+ if ( li++ != (lj++) ) e(55);
+ li = 1;
+ lj = li + 1;
+ if ( -li != -li ) e(56);
+ if ( li != --lj ) e(57);
+ if ( (((((li))))) != -(-(-(-(li)))) ) e(59);
+ if ( lj != 1 ) e(60);
+ li = 40000;
+ lj = 80000;
+ lk = 800000L;
+ ll = -800000L;
+ lm = 1200000L;
+ if ( lk != -ll ) e(61);
+ if ( 10 * li != 400000L ) e(62);
+ if ( 2 * li != lj ) e(63);
+ if ( -(-(-(-(li)))) != li ) e(64);
+ if ( 10 * lj != lk ) e(65);
+ if ( lm + lm != 2 * lm ) e(66);
+ if ( lm - lm ) e(67);
+ if ( lk / lk != 1 ) e(68);
+ if ( lk / lj != 10 ) e(69);
+ if ( lm / li != 30 ) e(70);
+ if ( li + lj != lm / 10 ) e(71);
+ if ( li - 40000 - 1 != lk - 800001L ) e(72);
+ if ( li + li + li + li +li + li != lj + lj + lj ) e(73);
+ if ( li > lj ) e(74);
+ if ( lj > lk ) e(75);
+ if ( lm < ll ) e(76);
+ if ( (lm<1000000L) || (((lk-lj-lj*10)>0)) ) e(77);
+ if ( lm / 01 != lm ) e(78);
+ if ( lm * 01 != lm ) e(79);
+ if ( lm + 'a' != lm + 'b' -1 ) e(80);
+ if ( (lm % 'a') % 'a' != lm % 'a' ) e(81);
+ if ( lm % lm ) e(82);
+ if ( lj % li ) e(83);
+ if ( (lm<<1) != lm * 2 ) e(84);
+ if ( ! ( ( --lm % li ) + 1 ) ) e(86);
+ if ( ( lj >> 1 ) ^ li ) e(87);
+ li = 1;
+ if ( li != 1 ) e(89);
+ li <<= 20;
+ lj = 2;
+ if ( (lj<<19) != li ) e(90);
+ li = lj = lk= ll = lm = -345678L;
+ if ( (li != lj) || (lj != lk) || (ll != lm) ) e(91);
+ if ( (li != lj) || (lj != lk) || (lk != ll) || (ll != lm) ) e(92);
+ if ( li != -345678L ) e(93);
+ li = 1 | 2;
+ li <<= 20;
+ lj = li & li & li & li & li | li | li | li;
+ if ( li != lj ) e(94);
+ if ( ! ( li & lj ) ) e(95);
+ if ( li ^ lj ) e(96);
+ if ( ! (li | lj) ) e(97);
+ if ( (li >> 20) != 3 ) e(98);
+ li = 20000;
+ li *= 2;
+ if ( li < 0 ) e(99);
+ if ( 1 * li != li ) e(100);
+ lj = 20000;
+ if ( (lj<<1) != li ) e(101);
+ if ( (5*lj)/10 != lj/2 ) e(102);
+ if ( 4*lj != 1*01*2*2*lj ) e(103);
+ li = lj = 30000;
+ if ( li != li * lj / 30000 ) e(104);
+ if ( ++li != ++lj ) e(105);
+ lk = 5;
+ ll = 150000L;
+ if ( lk * (li-1) != ll ) e(106);
+}
+
+
+
+
+test5() /* testing local long variables */
+{
+ long la, lb, lc, ld, lf;
+
+ t = 5;
+ tct++;
+ la = 1;
+ lb = 2;
+ lc = 3;
+ ld = 4;
+ lf = 10;
+ if ( la + lb != lc ) e(1);
+ if ( la + lc != ld ) e(2);
+ if ( lb - lc != -la ) e(3);
+ if ( lb*(lb+lc) != lf ) e(4);
+ if ( -lf != -(lc+lc+ld) ) e(5);
+ if ( la/la != 1 ) e(6);
+ if ( lf*lf / lf != lf ) e(7);
+ if ( 10*lf != 100 ) e(8);
+ if ( lf * (-10) != -100 ) e(9);
+ if ( lb/lc != 0 ) e(10);
+ if ( 100/lc != 33 ) e(11);
+ if ( la+lb*lc+ld+lf / lb+50 / lc != 32 ) e(12);
+ if ( lb*lc*lf / 6 != 10 ) e(13);
+ if ( (lc>4) || (lc>=4) || (lc==4) ) e(14);
+ if ( (lf<lb) || (lf<=lb) || (lf==lb) ) e(15);
+ if ( la+lb-lc ) e(16);
+ if ( lb<la ) e(17);
+ if ( lb != lb ) e(18);
+ if ( la>lb ) e(19);
+ if ( (la>lb ? lc : lc*lb) != 6 ) e(20);
+ if ( (la<lb ? lc : lc*lb) != 3 ) e(21);
+ if ( lb<<la != ld ) e(22);
+ if ( lb>> la != la ) e(25);
+ if ( la++ != 1 ) e(26);
+ if ( --la != 1 ) e(27);
+ if ( la-- != 1 ) e(28);
+ if ( (la+lb) && (la<0) || (lf-10) && (064) ) e(29);
+ if ( (la+lb) && !(la>=0) || (lf-10) && !(0) ) e(30);
+ la = 2;
+ lb = 4;
+ lc = 8;
+ ld = 16;
+ lf = 32;
+ if ( la != 02 ) e(31);
+ if ( lb != 04 ) e(32);
+ if ( lc != 010 ) e(33);
+ if ( ld != 020 ) e(34);
+ if ( la & lb ) e(35);
+ if ( la & lb & lc & ld & lf ) e(36);
+ if ( ! ( la & lb & lc & ld & lf | la ) ) e(37);
+ if ( ( la >> 0 ) != la ) e(38);
+ if ( (( la/la ) << 1 ) != 02 ) e(39);
+ if ( ( la | (lb) | (lc) | (ld) | (lf) ) != la+lb+lc+ld+lf ) e(40);
+ if (!(la^lb) ) e(41);
+ if ( !(la^lb^lc^ld^lf) ) e(42);
+ if ( ( --la << 1 ) != 2 ) e(43);
+ if ( ( la << 01 ) != 2 ) e(44);
+ if ( la%lb != la ) e(45);
+ if ( lc%ld != lc ) e(46);
+ if (( (lf/ld) << la >> la ) != 2 ) e(47);
+ if ( (la = lb = lc = ld = lf) != lf ) e(48);
+ if ( ( la!=lb ) || ( lb!=lc ) || !(ld==lf) ) e(49);
+ if ( (la<lb) || (lb>la) || (lc<lf) ) e(50);
+ if ( (la%lb) || (lb%la) || (lc%ld) || (lf%ld) ) e(51);
+ if ( (la%(lb<<0) + ((lb<<3)>>3)%(la/la)) ) e(52);
+ if ( ! ( la++ == lb++ ) ) e(53);
+ if ( la != lb ) e(54);
+ if ( la++ != (lb++) ) e(55);
+ la = 1;
+ lb = la + 1;
+ if ( -la != -la ) e(56);
+ if ( la != --lb ) e(57);
+ if ( (((((la))))) != -(-(-(-(la)))) ) e(59);
+ if ( lb != 1 ) e(60);
+ la = 40000;
+ lb = 80000;
+ lc = 800000L;
+ ld = -800000L;
+ lf = 1200000L;
+ if ( lc != -ld ) e(61);
+ if ( 10 * la != 400000L ) e(62);
+ if ( 2 * la != lb ) e(63);
+ if ( -(-(-(-(la)))) != la ) e(64);
+ if ( 10 * lb != lc ) e(65);
+ if ( lf + lf != 2 * lf ) e(66);
+ if ( lf - lf ) e(67);
+ if ( lc / lc != 1 ) e(68);
+ if ( lc / lb != 10 ) e(69);
+ if ( lf / la != 30 ) e(70);
+ if ( la + lb != lf / 10 ) e(71);
+ if ( la - 40000 - 1 != lc - 800001L ) e(72);
+ if ( la + la + la + la +la + la != lb + lb + lb ) e(73);
+ if ( la > lb ) e(74);
+ if ( lb > lc ) e(75);
+ if ( lf < ld ) e(76);
+ if ( (lf<1000000L) || (((lc-lb-lb*10)>0)) ) e(77);
+ if ( lf / 01 != lf ) e(78);
+ if ( lf * 01 != lf ) e(79);
+ if ( lf + 'a' != lf + 'b' -1 ) e(80);
+ if ( (lf % 'a') % 'a' != lf % 'a' ) e(81);
+ if ( lf % lf ) e(82);
+ if ( lb % la ) e(83);
+ if ( (lf<<1) != lf * 2 ) e(84);
+ if ( ! ( ( --lf % la ) + 1 ) ) e(86);
+ if ( ( lb >> 1 ) ^ la ) e(87);
+ la = 1;
+ if ( la != 1 ) e(89);
+ la <<= 20;
+ lb = 2;
+ if ( (lb<<19) != la ) e(90);
+ la = lb = lc= ld = lf = -345678L;
+ if ( (la != lb) || (lb != lc) || (ld != lf) ) e(91);
+ if ( (la != lb) || (lb != lc) || (lc != ld) || (ld != lf) ) e(92);
+ if ( la != -345678L ) e(93);
+ la = 1 | 2;
+ la <<= 20;
+ lb = la & la & la & la & la | la | la | la;
+ if ( la != lb ) e(94);
+ if ( ! ( la & lb ) ) e(95);
+ if ( la ^ lb ) e(96);
+ if ( ! (la | lb) ) e(97);
+ if ( (la >> 20) != 3 ) e(98);
+ la = 20000;
+ la *= 2;
+ if ( la < 0 ) e(99);
+ if ( 1 * la != la ) e(100);
+ lb = 20000;
+ if ( (lb<<1) != la ) e(101);
+ if ( (5*lb)/10 != lb/2 ) e(102);
+ if ( 4*lb != 1*01*2*2*lb ) e(103);
+ la = lb = 30000;
+ if ( la != la * lb / 30000 ) e(104);
+ if ( ++la != ++lb ) e(105);
+ lc = 5;
+ ld = 150000L;
+ if ( lc * (la-1) != ld ) e(106);
+}
+
+
+
+
+test6() /* real arithmetic */
+{
+ double fabs();
+ double epsd;
+ float epsf;
+ float locxf;
+
+ t = 6;
+ tct++;
+ epsf = EPSF;
+ epsd = EPSD;
+ xf = 1.50;
+ yf = 3.00;
+ zf = 0.10;
+ xd = 1.50;
+ yd = 3.00;
+ zd = 0.10;
+ if ( fabs(1.0 + 1.0 - 2.0) > epsd ) e(1);
+ if ( fabs( 1e10-1e10 ) > epsd ) e(2);
+ if ( fabs( 1.0e+5 * 1.0e+5 - 100e+8 ) > epsd ) e(3);
+ if ( fabs( 10.0/3.0 * 3.0/10.0 - 100e-2 ) > epsd ) e(4);
+ if ( 0.0e0 != 0 ) e(5);
+ if ( fabs( 32767.0 - 32767 ) > epsd ) e(6);
+ if ( fabs( 1.0+2+5+3.0e0+7.5e+1+140e-1-100.0 ) > epsd ) e(7);
+ if ( fabs(-1+(-1)+(-1.0)+(-1.0e0)+(-1.0e-0)+(-1e0)+6 ) > epsd ) e(8);
+ if ( fabs(5.0*yf*zf-xf) > epsf ) e(9);
+ if ( fabs(5.0*yd*zd-xd) > epsd ) e(10);
+ if ( fabs(yd*yd - (2.0*xd)*(2.0*xd) ) > epsd ) e(11);
+ if ( fabs(yf*yf - (2.0*xf)*(2.0*xf) ) > epsf ) e(12);
+ if ( fabs( yd*yd+zd*zd+2.0*yd*zd-(yd+zd)*(zd+yd) ) > epsf ) e(13);
+ if ( fabs( yf*yf+zf*zf+2.0*yf*zf-(yf+zf)*(zf+yf) ) > epsf ) e(14);
+ xf = 1.10;
+ yf = 1.20;
+ if ( yd<xd ) e(15);
+ if ( yd<=xd ) e(16);
+ if ( yd==xd ) e(17);
+ if ( xd>=yd ) e(18);
+ if ( yd<xd ) e(19);
+ if ( fabs(yd-xd-1.5) > epsd ) e(20);
+ if ( 1.0 * 3.0 != 3.0 * 1.0 ) e(21);
+ if ( 1.0 != 1e+0 ) e(22);
+ if ( 4.5 < 4.4 ) e(23);
+ if ( -3.4 != -3.4 ) e(24);
+ if ( 10/3.0 - 10/3.0 != 0.0 ) e(25);
+ if ( fabs( (1<<0) * (-5.3) + 5.3 ) > epsd ) e(26);
+ if ( fabs( (1<<3) * 5.0 - 4e+1 ) > epsd ) e(27);
+ if ( fabs( ((1<<5)>>5) - 1e-0 ) > epsd ) e(28);
+ if ( fabs ( 00000 * 3.0 ) > epsd ) e(29);
+ if ( fabs ( 8 * 5.0 - 02 * 02 + 04 / 1.0 -40.0 ) > epsd ) e(30);
+ if ( fabs ( 'a' / 1.0 - 'a' ) > epsd ) e(31);
+ if ( fabs ( (!1) * ( 2.0 / -34e-1 ) ) > epsd ) e(32);
+ if ( fabs ( (01 | 1 | 2) * 4.0 - 12.0 ) > epsd ) e(33);
+ if ( fabs ( 1.0 * 2.0 * 3.0 * 4.0 * 5.0 - 120.0 ) > epsd ) e(34);
+ if ( fabs ( 1.0 * 2.0 * (1 | (4>>1)) - 6 ) > epsd ) e(35);
+ if ( fabs ( ( 0 ^ 0 ^ 0 ^ 0 ) * 0.0 ) > epsd ) e(36);
+ if ( fabs ( 1.0 * 2.0 * (1 ^ (4>>1)) - 6 ) > epsd ) e(37);
+ if ( fabs ( (((((-1.0 * (((((-1.0))))) - 1.0 ))))) ) > epsd) e(38);
+ if ( fabs ( ( 2==3 ) * 3.0 ) > epsd ) e(39);
+ if ( ( 4 + 3 > 5 ? 3.4 : -5e+3 ) != 3.4 ) e(40);
+ if ( ( -4 -'a' > 0 ? 3.4 : -5e+3 ) != -5e+3 ) e(41);
+ locxf = 3.0;
+ xf = 3.0;
+ if ( locxf != locxf ) e(42);
+ if ( locxf != xf ) e(43);
+ if ( locxf * xf != xf * locxf ) e(44);
+ if ( fabs ( ((2*3)>>1) / 3.0 - 1.0 ) > epsd ) e(45);
+ if ( fabs ( 'a' / locxf - 'a' / xf ) > epsd ) e(46);
+ if ( fabs( xf * locxf - 9.0 ) > epsd ) e(47);
+ yd = 3.0;
+ if ( fabs( xf*yd - 9.0) > epsd ) e(48);
+ if ( yd >= 4 ) e(49);
+ if ( locxf == 2 ) e(50);
+}
+
+
+
+
+test7() /* global records */
+{
+ double epsd;
+ float epsf;
+ double fabs();
+
+ t = 7;
+ tct++;
+ epsd = EPSD;
+ epsf = EPSF;
+ r1.c1 = 'x';
+ r1.i = 40;
+ r1.j = 50;
+ r1.aaa = 3.0;
+ r1.bbb = 4.0;
+ r2.c1 = r1.c1;
+ r2.i = 50;
+ r2.j = 40;
+ r2.aaa = 4.0;
+ r2.bbb = 5.0;
+ if ( r1.c1 != 'x' || r1.i != 40 || r1.aaa != 3.0 ) e(1);
+ if ( r1.i != 40 || r2.i != 50 ) e(2);
+ if ( r2.j != 40 || r1.j != 50 ) e(3);
+ if ( (r1.c1 + r2.c1)/2 != 'x' ) e(4);
+ if ( r1.aaa * r1.aaa + r2.aaa * r2.aaa != r2.bbb * r2.bbb ) e(5);
+ r1.i = r1.j = r2.i = r2.j = 3.0;
+ if ( r1.i != 3 ) e(6);
+ if ( r1.i * r2.j - 9 ) e(7);
+ r1.i++;
+ if ( r1.i != 4 ) e(8);
+ if ( --r1.i != 3 ) e(9);
+ if ( (++r2.i) * (--r2.j) != 8 ) e(10);
+ if ( (r2.i = r2.j = r1.j = r1.i = -5 ) != -5 ) e(11);
+ if ( r2.i * r1.j / 25 != 1 ) e(12);
+ r1.c1 = '\0';
+ if ( r1.i * r1.j * r2.i * r1.c1 * r2.j ) e(13);
+ r2.c1 = 'j';
+ if ( r1.c1 + r2.c1 != 'j' ) e(14);
+ if ( r1.c1 * r2.c1 ) e(15);
+ r2.j = r1.i = r2.i = r1.j = 1;
+ if ( (r1.i<<0) != r1.j ) e(16);
+ if ( (r1.i >> -0 ) != ( r1.j >> 0 ) ) e(17);
+ if ( (r1.i<<1) != 2 ) e(18);
+ if ( (r1.i<<2) != 4 ) e(19);
+ if ( (r1.j<<3) != (r2.j<<3) ) e(20);
+ if ( (r1.i | r1.i | r1.i | r1.i | r1.i) != r1.i ) e(21);
+ if ( (r2.j & r1.j & r2.j & r2.i) != (r1.i<<3>>3) ) e(22);
+ r1.j = 1;
+ r1.aaa = 2.0;
+ if ( fabs ( r1.j * r1.aaa - 2.0 ) > epsd ) e(23);
+ if ( (r1.j << 4) * r1.aaa != (r1.j << 4) * r1.aaa ) e(24);
+ if ( ((r1.j<<6)&r1.j) * r1.aaa ) e(25);
+ if ((r1.j | (r1.j << 1)) * r1.aaa != ((r1.j << 1) ^ r1.j) * r1.aaa) e(26);
+ r1.i = r1.j = r2.i = r2.j = -2;
+ if ( r1.i > 0 || r1.j >= 0 ) e(27);
+ if ( r1.i != r2.j ) e(28);
+ if ( !!! ((((( r1.i == r2.j ))))) ) e(28);
+ if ( -(-(r1.j)) != r2.j ) e(29);
+ if ( r1.i % r1.j ) e(30);
+ if ( (r1.i % r1.j) % r1.i ) e(31);
+ if ( 0 % r2.j ) e(32);
+ if ( 03 * r1.i != -6 ) e(33);
+ r1.aaa = r2.aaa = -4;
+ r1.bbb = r2.bbb = 4;
+ if ( r1.aaa > -3.5 ) e(34);
+ if ( fabs ( r1.aaa - r2.aaa ) > epsf ) e(35);
+ r1.c1 = '\03';
+ if ( fabs ( r2.aaa * r1.aaa - r1.c1 * 5 - 1.0 ) > epsf ) e(36);
+}
+
+
+
+
+test8() /* local records */
+{
+ double epsd;
+ float epsf;
+ double fabs();
+ struct tp2 s1, s2;
+
+ t = 8;
+ tct++;
+ epsd = EPSD;
+ epsf = EPSF;
+ s1.c1 = 'x';
+ s1.i = 40;
+ s1.j = 50;
+ s1.aaa = 3.0;
+ s1.bbb = 4.0;
+ s2.c1 = s1.c1;
+ s2.i = 50;
+ s2.j = 40;
+ s2.aaa = 4.0;
+ s2.bbb = 5.0;
+ if ( s1.c1 != 'x' || s1.i != 40 || s1.aaa != 3.0 ) e(1);
+ if ( s1.i != 40 || s2.i != 50 ) e(2);
+ if ( s2.j != 40 || s1.j != 50 ) e(3);
+ if ( (s1.c1 + s2.c1)/2 != 'x' ) e(4);
+ if ( s1.aaa * s1.aaa + s2.aaa * s2.aaa != s2.bbb * s2.bbb ) e(5);
+ s1.i = s1.j = s2.i = s2.j = 3.0;
+ if ( s1.i != 3 ) e(6);
+ if ( s1.i * s2.j - 9 ) e(7);
+ s1.i++;
+ if ( s1.i != 4 ) e(8);
+ if ( --s1.i != 3 ) e(9);
+ if ( (++s2.i) * (--s2.j) != 8 ) e(10);
+ if ( (s2.i = s2.j = s1.j = s1.i = -5 ) != -5 ) e(11);
+ if ( s2.i * s1.j / 25 != 1 ) e(12);
+ s1.c1 = '\0';
+ if ( s1.i * s1.j * s2.i * s1.c1 * s2.j ) e(13);
+ s2.c1 = 'j';
+ if ( s1.c1 + s2.c1 != 'j' ) e(14);
+ if ( s1.c1 * s2.c1 ) e(15);
+ s2.j = s1.i = s2.i = s1.j = 1;
+ if ( (s1.i<<0) != s1.j ) e(16);
+ if ( (s1.i >> -0 ) != ( s1.j >> 0 ) ) e(17);
+ if ( (s1.i<<1) != 2 ) e(18);
+ if ( (s1.i<<2) != 4 ) e(19);
+ if ( (s1.j<<3) != (s2.j<<3) ) e(20);
+ if ( (s1.i | s1.i | s1.i | s1.i | s1.i) != s1.i ) e(21);
+ if ( (s2.j & s1.j & s2.j & s2.i) != (s1.i<<3>>3) ) e(22);
+ s1.j = 1;
+ s1.aaa = 2.0;
+ if ( fabs ( s1.j * s1.aaa - 2.0 ) > epsd ) e(23);
+ if ( (s1.j << 4) * s1.aaa != (s1.j << 4) * s1.aaa ) e(24);
+ if ( ((s1.j<<6)&s1.j) * s1.aaa ) e(25);
+ if ((s1.j | (s1.j << 1)) * s1.aaa != ((s1.j << 1) ^ s1.j) * s1.aaa) e(26);
+ s1.i = s1.j = s2.i = s2.j = -2;
+ if ( s1.i > 0 || s1.j >= 0 ) e(27);
+ if ( s1.i != s2.j ) e(28);
+ if ( !!! ((((( s1.i == s2.j ))))) ) e(28);
+ if ( -(-(s1.j)) != s2.j ) e(29);
+ if ( s1.i % s1.j ) e(30);
+ if ( (s1.i % s1.j) % s1.i ) e(31);
+ if ( 0 % s2.j ) e(32);
+ if ( 03 * s1.i != -6 ) e(33);
+ s1.aaa = s2.aaa = -4;
+ s1.bbb = s2.bbb = 4;
+ if ( s1.aaa > -3.5 ) e(34);
+ if ( fabs ( s1.aaa - s2.aaa ) > epsf ) e(35);
+ s1.c1 = '\03';
+ if ( fabs ( s2.aaa * s1.aaa - s1.c1 * 5 - 1.0 ) > epsf ) e(36);
+}
+
+
+
+
+test9() /* global arrays */
+{
+ float epsf;
+ double epsd;
+ double fabs();
+
+ t = 9;
+ tct++;
+ epsf = EPSF;
+ epsd = EPSD;
+ for ( i=0; i<20 ; i++ )
+ a1[i] = i*i;
+ if ( a1[9] != 81 || a1[17] != 289 || a1[0] != 0 ) e(1);
+ if ( a1[1] + a1[2] + a1[3] != 14 ) e(2);
+ if ( ! a1[15] ) e(3);
+ if ( a1[8] / a1[4] != 4 ) e(4);
+ for ( i=0; i<20; i++ )
+ a2[i] = 10.0e-1 + i/54.324e-1;
+ if ( fabs(a2[4]*a2[4]-a2[4]*(10.0e-1 + 4/54.324e-1 ) ) > epsf ) e(5);
+ if ( fabs(a2[8]/a2[8]*a2[9]/a2[9]-a2[10]+a2[10]-1.0 ) > epsf ) e(6);
+ if ( fabs(a2[5]-a2[4]-1/54.324e-1 ) > epsf ) e(7);
+ for ( i=0; i<20; i++)
+ a3[i]= 10.0e-1 + i/54.324e-1;
+ if ( fabs(a3[4]*a3[4]-a3[4]*(1.0e0+4/54.324e-1 )) > epsd ) e(8);
+ if ( fabs( a3[8]*a3[9]/a3[8]/a3[9]-a3[10]+a3[10]-1000e-3) > epsd ) e(9);
+ if ( fabs(a3[8]+a3[6]-2*a3[7]) > epsd ) e(10);
+ for ( i=0; i<20; i++ )
+ a1[i] = i+1;
+ if ( a1[a1[a1[a1[a1[a1[0]]]]]] != 6 ) e(11);
+ if ( a1[a1[0]+a1[1]+a1[2]+a1[3]] != 11 ) e(12);
+ if ( (a1[0] << 2) != 4 ) e(13);
+ if ( (a1[0] >> 2) ) e(14);
+ if ( (a1[0] << 3 >> 3) != a1[0] ) e(15);
+ if ( a1[a1[0] << 1] != 3 ) e(16);
+ if ( a1[4<<1] != 9 ) e(17);
+ if ( a1[4 << 1] != 9 ) e(18);
+ if ( (1 << a1[0]) != 2 ) e(19);
+ if ( (1 & a1[0]) != 1 ) e(20);
+ if ( a1[4]++ != 5 ) e(21);
+ if ( a1[4] != 6 ) e(22);
+ if ( --a1[4] != 5 ) e(23);
+ if ( a1[ --a1[10] ] != 10 ) e(24);
+ a1[0] = 0;
+ a1[1] = 1;
+ a1[2] = 2;
+ a1[3] = 3;
+ i = 3;
+ if ( a1[--i] != 2 ) e(25);
+ if ( a1[ a1[--i] ] != 1 ) e(26);
+ if ( a1[a1[a1[a1[a1[a1[a1[a1[3]]]]]]]] != 3 ) e(27);
+ if ( a1[1+2] != 3 ) e(28);
+ if ( a1[1+2] != a1[3/3] + 2 ) e(29);
+ if ( a1[i=2] != 2 ) e(30);
+ if ( -a1[i==3] ) e(31);
+ if ( a1[3*2 + a1[0]*6 - 10/2 -4 + 3/1] != 0 ) e(32);
+ if ( a1['a' + 'c' -2*'b'] ) e(33);
+ if ( a1[ a1[0]==a1[1] ] ) e(34);
+ if ( a1[a1[1<<1]>>1] != 1 ) e(35);
+ a1[i=j=4] = 10;
+ if ( (i!=4) || (j!=4) || (i!=j) ) e(36);
+ if ( a1[4] != 10 ) e(37);
+ if ( a1[--i] != 3 ) e(38);
+ if ( a1[i++] != 3 ) e(39);
+ if ( --a1[--i] != 2 ) e(40);
+ a1[a1[a1[a1[a1[0]=7]=5]=8]=2]=0;
+ if ( a1[0] != 7) e(41);
+ if ((a1[7] != 5) || (a1[5]!=8) || (a1[8]!=2))e(42);
+ if (a1[2]) e(43);
+ for ( i=0 ; i<20; i++)
+ a1[i] = i;
+ a1[0] = 0;
+ a1[1] = 01;
+ a1[2] = 02;
+ a1[3] = 04;
+ a1[4] = 010;
+ if ((a1[0] | a1[1] | a1[2] | a1[3] | a1[4]) != 017 ) e(44);
+ if ( a1[0]<<4 ) e(45);
+ if ( (a1[4]>>3) != 1 ) e(46);
+ a1[4] = 04;
+ a1[010] = 010;
+ if ( a1[8] != 8 ) e(47);
+ if ( a1[0|1|2|4|8] != (a1[0]|a1[1]|a1[2]|a1[4]|a1[8]) ) e(48);
+ if ( a1[a1[0]|a1[1]|a1[2]|a1[4]|a1[8]] != a1[017] ) e(49);
+ if ( a1[a1[1]^a1[2]^a1[4]^a1[8]] != a1[a1[1]|a1[2]|a1[4]|a1[8]] ) e(50);
+ for ( i = 0; i<20; i++ )
+ a1[i] = i+1;
+ for ( i = 0; i<20; i++ )
+ a2[i] = a3[i] = a1[i];
+ if ( a2[5] != 6.0 ) e(51);
+ if ( a2[13] != 14.0 ) e(52);
+ if ( a2[a1[a1[a1[a1[a1[0]]]]]] != 6.0 ) e(53);
+ if ( a1[12] != 13 ) e(54);
+ if ( a1[ a1[12] = a2[a1[11]] ] != 14 ) e(55);
+ if ( fabs( a2[13] - a2[a1[12]] ) > epsf ) e(56);
+ if ( a2[8] != a1[8] ) e(57);
+}
+
+
+
+
+test10() /* local arrays */
+{
+ float epsf;
+ double epsd;
+ double fabs();
+ int b1[20];
+ float b2[20];
+ double b3[20];
+
+ t = 10;
+ tct++;
+ epsf = EPSF;
+ epsd = EPSD;
+ for ( i=0; i<20 ; i++ )
+ b1[i] = i*i;
+ if ( b1[9] != 81 || b1[17] != 289 || b1[0] != 0 ) e(1);
+ if ( b1[1] + b1[2] + b1[3] != 14 ) e(2);
+ if ( ! b1[15] ) e(3);
+ if ( b1[8] / b1[4] != 4 ) e(4);
+ for ( i=0; i<20; i++ )
+ b2[i] = 10.0e-1 + i/54.324e-1;
+ if ( fabs(b2[4]*b2[4]-b2[4]*(10.0e-1 + 4/54.324e-1 ) ) > epsf ) e(5);
+ if ( fabs(b2[8]/b2[8]*b2[9]/b2[9]-b2[10]+b2[10]-1.0 ) > epsf ) e(6);
+ if ( fabs(b2[5]-b2[4]-1/54.324e-1 ) > epsf ) e(7);
+ for ( i=0; i<20; i++)
+ b3[i]= 10.0e-1 + i/54.324e-1;
+ if ( fabs(b3[4]*b3[4]-b3[4]*(1.0e0+4/54.324e-1 )) > epsd ) e(8);
+ if ( fabs( b3[8]*b3[9]/b3[8]/b3[9]-b3[10]+b3[10]-1000e-3) > epsd ) e(9);
+ if ( fabs(b3[8]+b3[6]-2*b3[7]) > epsd ) e(10);
+ for ( i=0; i<20; i++ )
+ b1[i] = i+1;
+ if ( b1[b1[b1[b1[b1[b1[0]]]]]] != 6 ) e(11);
+ if ( b1[b1[0]+b1[1]+b1[2]+b1[3]] != 11 ) e(12);
+ if ( (b1[0] << 2) != 4 ) e(13);
+ if ( (b1[0] >> 2) ) e(14);
+ if ( (b1[0] << 3 >> 3) != b1[0] ) e(15);
+ if ( b1[b1[0] << 1] != 3 ) e(16);
+ if ( b1[4<<1] != 9 ) e(17);
+ if ( b1[4 << 1] != 9 ) e(18);
+ if ( (1 << b1[0]) != 2 ) e(19);
+ if ( (1 & b1[0]) != 1 ) e(20);
+ if ( b1[4]++ != 5 ) e(21);
+ if ( b1[4] != 6 ) e(22);
+ if ( --b1[4] != 5 ) e(23);
+ if ( b1[ --b1[10] ] != 10 ) e(24);
+ b1[0] = 0;
+ b1[1] = 1;
+ b1[2] = 2;
+ b1[3] = 3;
+ i = 3;
+ if ( b1[--i] != 2 ) e(25);
+ if ( b1[ b1[--i] ] != 1 ) e(26);
+ if ( b1[b1[b1[b1[b1[b1[b1[b1[3]]]]]]]] != 3 ) e(27);
+ if ( b1[1+2] != 3 ) e(28);
+ if ( b1[1+2] != b1[3/3] + 2 ) e(29);
+ if ( b1[i=2] != 2 ) e(30);
+ if ( -b1[i==3] ) e(31);
+ if ( b1[3*2 + b1[0]*6 - 10/2 -4 + 3/1] != 0 ) e(32);
+ if ( b1['a' + 'c' -2*'b'] ) e(33);
+ if ( b1[ b1[0]==b1[1] ] ) e(34);
+ if ( b1[b1[1<<1]>>1] != 1 ) e(35);
+ b1[i=j=4] = 10;
+ if ( (i!=4) || (j!=4) || (i!=j) ) e(36);
+ if ( b1[4] != 10 ) e(37);
+ if ( b1[--i] != 3 ) e(38);
+ if ( b1[i++] != 3 ) e(39);
+ if ( --b1[--i] != 2 ) e(40);
+ b1[b1[b1[b1[b1[0]=7]=5]=8]=2]=0;
+ if ( b1[0] != 7) e(41);
+ if ((b1[7] != 5) || (b1[5]!=8) || (b1[8]!=2))e(42);
+ if (b1[2]) e(43);
+ for ( i=0 ; i<20; i++)
+ b1[i] = i;
+ b1[0] = 0;
+ b1[1] = 01;
+ b1[2] = 02;
+ b1[3] = 04;
+ b1[4] = 010;
+ if ((b1[0] | b1[1] | b1[2] | b1[3] | b1[4]) != 017 ) e(44);
+ if ( b1[0]<<4 ) e(45);
+ if ( (b1[4]>>3) != 1 ) e(46);
+ b1[4] = 04;
+ b1[010] = 010;
+ if ( b1[8] != 8 ) e(47);
+ if ( b1[0|1|2|4|8] != (b1[0]|b1[1]|b1[2]|b1[4]|b1[8]) ) e(48);
+ if ( b1[b1[0]|b1[1]|b1[2]|b1[4]|b1[8]] != b1[017] ) e(49);
+ if ( b1[b1[1]^b1[2]^b1[4]^b1[8]] != b1[b1[1]|b1[2]|b1[4]|b1[8]] ) e(50);
+ for ( i = 0; i<20; i++ )
+ b1[i] = i+1;
+ for ( i = 0; i<20; i++ )
+ b2[i] = b3[i] = b1[i];
+ if ( b2[5] != 6.0 ) e(51);
+ if ( b2[13] != 14.0 ) e(52);
+ if ( b2[b1[b1[b1[b1[b1[0]]]]]] != 6.0 ) e(53);
+ if ( b1[12] != 13 ) e(54);
+ if ( b1[ b1[12] = b2[b1[11]] ] != 14 ) e(55);
+ if ( fabs( b2[13] - b2[b1[12]] ) > epsf ) e(56);
+ if ( b2[8] != b1[8] ) e(57);
+}
+
+
+
+
+test11() /* global pointers */
+{
+ float epsf;
+ double fabs();
+ int li;
+ struct tp2 strp2;
+
+ epsf = EPSF;
+ t = 11;
+ tct++;
+ p1 = &li;
+ li = 076;
+ if ( p1 != &li ) e(1);
+ p11 = &li;
+ if ( p1 != p11 ) e(3);
+ if ( *p1 != *p11 ) e(4);
+ if ( &li != p11 ) e(5);
+ if ( *&p1 != p1 ) e(6);
+ if ( &*p1 != p1 ) e(7);
+ if ( **&p1 != *&*p1 ) e(10);
+ if ( *&*&*&*&*&li != li ) e(11);
+ p1 = &p ;
+ p2 = &p1;
+ *p1 = **p2 = 34;
+ if ( p1 != *p2 ) e(25);
+ li = 4;
+ p1 = &li;
+ p2 = &p1;
+ p3 = &p2;
+ p4 = &p3;
+ p5 = &p4;
+ if ( *p1 != **p2 ) e(26);
+ if ( **p2 != **p2 ) e(27);
+ if ( ***p3 != **p2 ) e(28);
+ if ( *****p5 != 4 ) e(30);
+ li = 3;
+ if ( *p1 - *p1 ) e(44);
+ if ( p1 != &li ) e(46);
+ pp1 = (struct tp2 *) alloc( sizeof *pp1 );
+ pp2 = (struct tp2 *) alloc( sizeof *pp2 );
+ pp3 = (struct tp2 *) alloc( sizeof *pp3 );
+ pp1->i = 1325;
+ if ( pp1->i != 1325 ) e(47);
+ pp1->i = pp2->i = pp3->i = 3;
+ if ( pp1->i * pp1->i != 9 ) e(48);
+ if ( pp1->i * pp2->i * pp3->i != pp2->i * 3 * 3 ) e(49);
+ if ( pp1->i - pp3->i ) e(50);
+ if ( (*pp1).i != pp1->i ) e(51);
+ pp1->i++;
+ if ( ++pp2->i != pp1->i ) e(52);
+ if ( pp2->i != 4 ) e(53);
+ pp1->aaa = 3.0;
+ pp2->aaa = -3.0;
+ pp3->bbb = 25.0;
+ if ( pp1->aaa != 3.0 ) e(54);
+ if ( fabs( pp1->aaa + pp2->aaa ) > epsf ) e(55);
+ if ( fabs( pp1->aaa * pp2->aaa + pp3->bbb - 16 ) > epsf ) e(56);
+ if ( fabs( pp1->aaa / pp2->aaa + 1 ) > epsf ) e(57);
+ pp1->c1 = 'x';
+ pp1->i = pp1->j = 45;
+ pp1->aaa = 100.0;
+ pp1->bbb = 1024.0;
+ strp2.c1 = pp1->c1; /* strp2 is a local struct */
+ strp2.i = pp1->i = strp2.j = pp1->j;
+ strp2.aaa = pp1->aaa;
+ strp2.bbb = pp1->bbb;
+ if ( strp2.c1 != 'x' ) e(58);
+ if ( strp2.i != strp2.j ) e(59);
+ if ( strp2.aaa != pp1->aaa ) e(60);
+ if ( strp2.bbb != pp1->bbb ) e(61);
+}
--- /dev/null
+End of test program, 11 tests completed, 0 errors detected
--- /dev/null
+make "P=t7" -fsk ../makefile ${1-gen}
--- /dev/null
+#
+/*
+ * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ *
+ * This product is part of the Amsterdam Compiler Kit.
+ *
+ * Permission to use, sell, duplicate or disclose this software must be
+ * obtained in writing. Requests for such permissions may be sent to
+ *
+ * Dr. Andrew S. Tanenbaum
+ * Wiskundig Seminarium
+ * Vrije Universiteit
+ * Postbox 7161
+ * 1007 MC Amsterdam
+ * The Netherlands
+ *
+ */
+
+
+/*
+#define TEST1 1
+*/
+
+
+/* This program can be used to test C-compilers */
+/* It is supposed the first test program (= "test1") */
+/* is used to test the basic arithmetic */
+
+/* The following are global counters */
+
+int t, /* the value indicates the number of the test procedure */
+ ect, /* error counter */
+ tct; /* count the number of test procedures called */
+
+/************************************************************************/
+/* */
+/* The following is tested: */
+/* FOR STATEMENTS in test1 */
+/* WHILE STATEMENTS in test2 */
+/* WHILE and FOR STATEMENTS in test3 */
+/* DO STATEMENTS in test4 */
+/* SWITCH STATEMENTS in test5\e */
+/* */
+/************************************************************************/
+
+
+
+char *pp1 = "End of test program, ";
+char *pp2 = " test(s) completed, ";
+char *pp3 = " errors detected\n";
+char *pp4 = "Error ";
+char *pp5 = " in test";
+char *pp6 = "\n";
+
+itoa(p,ptr)
+/* converts integer "p" to ascii string "ptr" */
+int p;
+char *ptr;
+{
+ register int k,l;
+ register char *str;
+ int sign;
+
+ str=ptr;
+ k=p;
+ if ((sign=k)<0)
+ k = -k;
+ do
+ {
+ l = k % 10;
+ k /= 10;
+ *str++ = l + '0';
+ }
+ while(k);
+ if (sign<0)
+ *str++ = '-';
+ *str = '\0';
+ reverse(ptr);
+}
+
+
+
+reverse(s)
+char s[];
+{
+ register int c,i,j;
+
+ for (i=0, j=strlen(s)-1; i<j; i++, j--)
+ {
+ c=s[i];
+ s[i]=s[j];
+ s[j]=c;
+ }
+}
+
+strlen(str)
+/* returns the length of string str */
+char *str;
+{
+ register char *s, *p;
+
+ p = s = str;
+ while (*p)
+ p++;
+ return(p-s);
+}
+
+
+
+main()
+{
+ char chtct[10],chect[10];
+ tct = 0;
+ ect = 0; /* No errors, so far so good */
+ test1(); /* testing FOR STATEMENTS */
+ test2(); /* testing WHILE STATEMENTS */
+ test3(); /* testing combined FOR and WHILE statements */
+ test4(); /* testing DO statements */
+ test5(); /* testing SWITCH statements */
+ test6(); /* testing GOTO statements */
+ test7();
+ test8();
+ write(1,pp1,strlen(pp1));
+ itoa(tct,chtct);
+ write(1,chtct,strlen(chtct));
+ write(1,pp2,strlen(pp2));
+ itoa(ect,chect);
+ write(1,chect,strlen(chect));
+ write(1,pp3,strlen(pp3));
+ return(ect);
+}
+
+
+
+e(n) /* prints an error message */
+int n;
+{
+ char cht[10],chn[10];
+ ect++; /* total number of errors increased by 1 */
+ write(1,pp4,strlen(pp4));
+ itoa(n,chn);
+ write(1,chn,strlen(chn));
+ write(1,pp5,strlen(pp5));
+ itoa(t,cht);
+ write(1,cht,strlen(cht));
+ write(1,pp6,strlen(pp6));
+}
+
+
+
+test1() /* Testing the for statement */
+{
+ int i, j; /* variables, used as contolling integers in the */
+ /* for statements */
+
+ t = 1; /* This is test 1 */
+ tct++;
+ for ( ; ; )
+ {
+ break;
+ e(1);
+ return; /* If the break doesn't work, let's hope the */
+ /* return does ! */
+ }
+ for ( ; ; )
+ {
+ for ( ; ; )
+ {
+ for ( ; ; )
+ {
+ for ( ; ; )
+ {
+ for ( ; ; )
+ {
+ for ( ; ; )
+ {
+ break;
+ e(2);
+ return;
+ }
+ break;
+ e(3);
+ return;
+ }
+ break;
+ e(4);
+ return;
+ }
+ break;
+ e(5);
+ return;
+ }
+ break;
+ e(6);
+ return;
+ }
+ break;
+ e(7);
+ return;
+ }
+ i=0;
+ for ( ; ; i++)
+ {
+ break;
+ e(8);
+ return;
+ }
+ for (i=0 ; ; i++)
+ {
+ break;
+ e(9);
+ return;
+ }
+ for (i=0 ; i<3; i++)
+ ;
+ if (i != 3) e(10);
+ for (i=0; i<0; i++)
+ e(11);
+ if (i != 0) e(12);
+ for (i=0; i<1; i++)
+ for (i=i; i<i; i++)
+ for (i=i; i<(i+0); i++)
+ for (i=i+0; i<(i-0); i++)
+ for (i=i-0; i<i; i++)
+ e(13);
+ if (i != 1) e(14);
+ for (i=0; i<3; )
+ i++;
+ if (i != 3) e(15);
+ i = 18;
+ j = 3;
+ for ( ; j<i; --i)
+ ;
+ if (i != j) e(16);
+ if (i != 3) e(17);
+ j = -30;
+ for ( ; ; )
+ if (++j)
+ continue;
+ else break;
+ if (j != 0) e(18);
+ i = 0;
+ for (i++, i++, i++, i++; ; )
+ {
+ if (i != 4) e(19);
+ break;
+ }
+ i = 1;
+ for (i=j=i=j=i=j=i; i && j && i; --i, --j)
+ {
+ if (i != 1) e(20);
+ }
+ j=0;
+ for (i=32700; i<32767; i++)
+ j++;
+ if (j != 67) e(21);
+ j=0;
+#ifdef TEST1
+ printf("*** 1\n");
+ for (i=32000; i<=32767; i++)
+ j++;
+ if (j != 68) e(22);
+ printf("*** 2\n");
+#endif
+ j=0;
+ for (i=32767; i>32700; i--)
+ j++;
+ if (j != 67) e(23);
+ j=0;
+ for (i= -32768; i<-32700; i++)
+ j++;
+ if (j != 68) e(24);
+}
+
+
+
+
+test2() /* Testing the while statement */
+{
+ int i, j;
+
+ t = 2;
+ tct++;
+ while(1)
+ {
+ break;
+ e(1);
+ return;
+ }
+ while(0)
+ {
+ e(2);
+ break;
+ e(3);
+ return;
+ }
+ while (1 || 0)
+ {
+ break;
+ e(4);
+ return;
+ }
+ while (1 && 0)
+ {
+ e(5);
+ break;
+ e(6);
+ return;
+ }
+ j = 10;
+ while (--j)
+ ;
+ if (j != 0) e(7);
+ while (j)
+ {
+ e(8);
+ break;
+ }
+ while ( i=j )
+ {
+ e(9);
+ break;
+ }
+ while ( (i==j) && (i!=j) )
+ {
+ e(10);
+ break;
+ }
+ j = 1;
+ while (j)
+ while(j)
+ while(j)
+ while(j)
+ while(j)
+ while(--j)
+ ;
+ if (j != 0) e(11);
+ if (j) e(12);
+ j = 30;
+ while (--j)
+ {
+ continue;
+ continue;
+ continue;
+ continue;
+ continue;
+ break;
+ e(13);
+ }
+}
+
+
+
+
+test3() /* Combined FOR and WHILE statements */
+{
+ int i,j;
+
+ t = 3;
+ tct++;
+ j = 0;
+ for (i=3; i; i++)
+ {
+ while (i--)
+ ;
+ if (++j > 1) e(1);
+ }
+}
+
+
+
+
+test4() /* Do statement */
+{
+ int i;
+
+ t = 4;
+ tct++;
+ i = 0;
+ do
+ if (i) e(1);
+ while (i);
+ do
+ {
+ do
+ {
+ do
+ {
+ do
+ {
+ i++;
+ }
+ while (!i);
+ i++;
+ }
+ while (!i);
+ i++;
+ }
+ while (!i);
+ i++;
+ }
+ while (!i);
+ if (i != 4) e(2);
+}
+
+
+
+
+test5() /* SWITCH statement */
+{
+ int i,j;
+
+ t = 5;
+ tct++;
+ for (i=0; i<10; i++)
+ {
+ switch (i)
+ {
+ case 0: if (i != 0) e(1);
+ break;
+ case 1: if (i != 1) e(2);
+ break;
+ case 2: if (i != 2) e(3);
+ break;
+ case 3: if (i != 3) e(4);
+ i++;
+ case 4: if (i != 4) e(5);
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ break;
+ default: e(6);
+ }
+ }
+ for (i=j= -18; i<10; i++, j++)
+ {
+ switch (i)
+ {
+ case -3:
+ case 7:
+ case 1: switch (j)
+ {
+ case -3:
+ case 7:
+ case 1:
+ break;
+ default: e(7);
+ }
+ break;
+ e(8);
+ case -4: switch (j)
+ {
+ case -4: if (i != -4) e(9);
+ break;
+ default: e(10);
+ }
+ }
+ }
+ i = 'a';
+ switch (i)
+ {
+ case 'a':
+ switch ( i )
+ {
+ case 'a':
+ switch ( i )
+ {
+ case 'a':
+ break;
+ default: e(11);
+ }
+ break;
+ default: e(12);
+ }
+ break;
+ default: e(13);
+ }
+}
+
+
+
+test6() /* goto statement */
+{
+ int k;
+
+ t = 6;
+ tct++;
+ k = 0;
+ goto lab0;
+xl1:
+ k = 1;
+ goto lab1;
+xl2:
+ k = 2;
+ goto lab2;
+xl3:
+ k = 3;
+ goto lab3;
+xl4:
+ k = 4;
+ goto llab1;
+llab2: goto llab3;
+llab4: goto llab5;
+llab6: goto llab7;
+llab8: if ( k != 4 ) e(5);
+ return ;
+llab1: goto llab2;
+llab3: goto llab4;
+llab5: goto llab6;
+llab7: goto llab8;
+lab0: if ( k!= 0 ) e(1);
+ goto xl1 ;
+lab1: if ( k!= 1 ) e(2);
+ goto xl2 ;
+lab2: if ( k!= 2 ) e(3);
+ goto xl3 ;
+lab3: if ( k!= 3 ) e(4);
+ goto xl4 ;
+}
+
+
+
+test7() /* Combinations of FOR, WHILE, DO and SWITCH statements */
+{
+ int i,j,k;
+
+ t = 7;
+ tct++;
+ for ( i=j=k=0; i<6; i++, j++, k++ )
+ {
+ if ( i != j ) e(1);
+ if ( i != k ) e(2);
+ if ( j != k ) e(3);
+ while ( i > j )
+ {
+ e(4);
+ break;
+ }
+ while ( i > k )
+ {
+ e(5);
+ break;
+ }
+ while ( j != k )
+ {
+ e(6);
+ break;
+ }
+ switch(i)
+ {
+ case 0:
+ switch(j)
+ {
+ case 0:
+ switch(k)
+ {
+ case 0: if ( i+j+k != 0 ) e(7);
+ break;
+ e(8);
+ default: if ( i+j+k != k ) e(9);
+ }
+ break;
+ default: if ( j > 6 ) e(10);
+ if ( k != j ) e(11);
+ }
+ break;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5: break;
+ default: e(12);
+ }
+ }
+ for ( i=j= -3; i<0; i++,j++)
+ if ( j == -3 )
+ do
+ if ( i )
+ switch ( i )
+ {
+ case -3: if ( j != i ) e(13);
+ case -2: if ( j != i ) e(14);
+ case -1: for ( k=i; k < 2*j-j; k++)
+ {
+ e(15);
+ break;
+ }
+ break;
+ case 0: e(16);
+ break;
+ default: e(17);
+ break;
+ }
+ else e(18);
+ while ( 0 );
+ if ( i != j ) e(19);
+}
+
+
+
+
+test8()
+{
+ int *p1, *p2;
+ int i,j,k;
+ int a1[1], a2[2][2], a3[3][3][3];
+
+ t = 8;
+ tct++;
+ a1[0] = 0;
+ for ( i=0; i<2; i++ )
+ for ( j=0; j<2; j++ )
+ a2[i][j] = (i*j) ^ (i+j);
+ if ( a2[0][0] != 0 ) e(1);
+ if ( a2[0][1] != 1 ) e(2);
+ if ( a2[1][0] != a2[0][1] ) e(3);
+ for ( i=0; i<3; i++)
+ for (j=0; j<3; j++)
+ for (k=0; k<3; k++)
+ a3[i][j][k] = i | j | k;
+ if ( a3[0][0][0] != 0 ) e(4);
+ if ( a3[0][1][2] != a3[2][0][1] ) e(5);
+ if ( a3[2][1][1] != (2 | 1 | 1) ) e(6);
+ p2 = &a3[0][1][2];
+ p1 = &a3[0][1][2];
+ for ( ; p1 == p2 ; p1++ )
+ {
+ switch ( *p1 )
+ {
+ case 3: break;
+ default: e(7);
+ }
+ if ( *p1 != *p2 ) e(8);
+ }
+}
--- /dev/null
+End of test program, 8 test(s) completed, 0 errors detected
--- /dev/null
+make "P=test2" -fsk ../makefile ${1-gen}
--- /dev/null
+/*
+ * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ *
+ * This product is part of the Amsterdam Compiler Kit.
+ *
+ * Permission to use, sell, duplicate or disclose this software must be
+ * obtained in writing. Requests for such permissions may be sent to
+ *
+ * Dr. Andrew S. Tanenbaum
+ * Wiskundig Seminarium
+ * Vrije Universiteit
+ * Postbox 7161
+ * 1007 MC Amsterdam
+ * The Netherlands
+ *
+ */
+
+/* This program can be used to test C-compilers */
+
+
+int t, ect, tct;
+
+
+/**********************************************************************/
+/*
+ * Testing basic function calls
+ *
+ */
+
+
+
+main()
+{
+ tct = 0;
+ ect = 0;
+ test1();
+ test2();
+ test3();
+ test4();
+ test5();
+ test6();
+ printf("End of test program, %d tests completed, %d errors detected\n",
+ tct,ect);
+ return 0 ;
+}
+
+
+
+
+e(n)
+int n;
+{
+ ect++;
+ printf("Error %d in test%d \n",n,t);
+}
+
+
+
+
+one()
+{
+ return(1);
+}
+
+
+
+
+two()
+{
+ return(2);
+}
+
+
+
+
+three()
+{
+ return(3);
+}
+
+
+
+
+four()
+{
+ return(4);
+}
+
+
+
+
+five()
+{
+ return(5);
+}
+
+
+
+
+plus()
+{
+ return ( one() + two() + three() + four() + five() );
+}
+
+
+
+
+multipl()
+{
+ return( one() * two() * three() * four() * five() );
+}
+
+
+
+
+subtr()
+{
+ return( - one() - two() - three() - four() - five() );
+}
+
+
+
+
+test1()
+{
+ int i;
+ int count;
+
+ t = 1;
+ tct++;
+ if ( one() != 1 ) e(1);
+ if ( two() != 2 ) e(2);
+ if ( three() != 3 ) e(3);
+ if ( four() != 4 ) e(4);
+ if ( five() != 5 ) e(5);
+ if ( (one() + two()) != 3 ) e(6);
+ if ( ((((((one() + two())))))) != 3) e(7);
+ if ( (one() * three()) != 3) e(8);
+ if (( (four() + three()) * two()) != 14) e(9);
+ if ( (four() + four()) != (two() * four()) ) e(10);
+ if ( (four() - four()) / three() ) e(11);
+ if (( four() + 3 * 12 - ( one() * two() * 2 ) ) != 36 ) e(12);
+ if ( one() & two() & four() & three() ) e(13);
+ if ( !( three() && two() ) ) e(14);
+ for (i=0; i<8; i++)
+ {
+ count = one() + two() + three() + four();
+ count = count * one();
+ count = count * two() - one() - two() - three() - four();
+ }
+ if (count != 10) e(15);
+ if ( !one() ) e(16);
+ if ( plus() != 15 ) e(17);
+ if ( multipl() != 120 ) e(18);
+ if ( subtr() != -15 ) e(19);
+ if ( -subtr() != plus() ) e(18);
+ if ( -subtr() != plus() ) e(21);
+}
+
+
+
+
+echo(a)
+int a;
+{
+ return ( a );
+}
+
+
+
+
+min(a,b)
+int a,b;
+{
+ if ( a < b )
+ return(a);
+ return(b);
+}
+
+
+
+
+max1(a,b)
+int a,b;
+{
+ if ( a < b )
+ return(b);
+ return(a);
+}
+
+
+
+
+max2(a,b)
+int a,b;
+{
+ return ( ( a < b ? b : a ) );
+}
+
+
+
+
+test2()
+{
+ int i,j;
+ int a,b;
+
+ t = 2;
+ tct++;
+ if ( echo(1) != 1 ) e(1);
+ if ( echo(3) != 3 ) e(2);
+ if ( echo(0) ) e(3);
+ if ( echo(2) + echo(3) != echo(5) ) e(4);
+ if ( echo( 2 + 3 ) != 5 ) e(5);
+ if ( echo ( 1 + 2 + 3 + 4 + 5 ) != 10 + echo(5) ) e(6);
+ if (( echo( 2<<1 ) ) != 4 ) e(7);
+ if ( echo( 2 >> 1 ) != 1 ) e(8);
+ if ( echo( 1 << 4 ) != echo( 2 << 3 ) ) e(9);
+ if ( echo( echo(4) ) != echo(4) ) e(10);
+ if (( echo ( echo ( echo( echo ( echo ( 3 ) ) ) ) ) ) != 3 ) e(11);
+ if ( echo( echo( echo(2+3-4+echo(4)*echo(2))) ) != 9 ) e(12);
+ if ( min(1,2) != 1) e(13);
+ if (min(0,45) != 0) e(14);
+ if (min(45,0) != 0) e(15);
+ if (min(-72,-100) != -100) e(16);
+ if (min(-100,-72) != -100) e(17);
+ if (min(1<<3,2<<3) != (1<<3) ) e(18);
+ if ( min( echo(3), echo(3) ) != echo (echo(3)) ) e(19);
+ if ( max1('a','b') != 'b' ) e(20);
+ if ( max1('b','a') != 'b' ) e(21);
+ if ( max1(-3,54+2) != ( -3 < 54+2 ? 54+2 : -3 ) ) e(22);
+ if (max1('a'+'b'+34,'a'*2) != max2('a'*2,'a'+'b'+34)) e(23);
+ if (max1(345/23,4) != max1( echo(345/23), 4) ) e(24);
+ if ( max1( max1(2,3), max1(2,3) ) != max1(2,3) ) e(25);
+ for (i=3; i<5; i++)
+ if ((max1(i,-i)) != i) e(26);
+ for (j=min('a',34); j<max2('a',34); j++)
+ {
+ if ( j<min(max1('a',34),min('a',34)) ) e(27);
+ if ( j>max1(min(34,'a'),max2(34,'a')) ) e(28);
+ }
+ a=b= -32768;
+ if ( min(echo(a),a) != a) e(29);
+ if ( max1(echo(b),max1(b,b)) != b) e(30);
+}
+
+
+
+
+sum(k)
+int k;
+{
+ if (k<=0)
+ return(0);
+ return(k+sum(k-1));
+}
+
+
+
+
+formula(k)
+int k;
+{
+ if (k<=0)
+ return(0);
+ return ( ((((( (k*(k+1))/2 ))))) );
+}
+
+
+
+
+test3()
+{
+ int k;
+ int count;
+
+ t = 3;
+ tct++;
+ count=0;
+ if ( sum(-4) != 0 ) e(1);
+ if ( sum(0) != 0 ) e(2);
+ if ( sum(2) != 3 ) e(3);
+ if ( sum(10) != 55 ) e(4);
+ if ( sum(34) != formula(34) ) e(5);
+ if ( sum(101) != formula(101) ) e(6);
+ if ( sum( sum(11) ) != formula( formula(11) ) ) e(7);
+ if ( sum( sum(11) ) != formula( sum(11) ) ) e(8);
+ if ( sum( sum( sum(4) )) != sum ( formula ( sum( 4) )) ) e(9);
+ for (k = sum(-45); k<sum('a'); k += sum('b') )
+ if (count++) e(10);
+ if ( echo( sum ( formula( five() ))) != formula ( sum(5) ) ) e(11);
+}
+
+
+
+
+test4()
+{
+ int i,j,k,l,m;
+ int a[50];
+ int b[1][2][3][4][5];
+
+ t = 4;
+ tct++;
+ b[0][1][2][3][4] = one();
+ if ( b[0][1][2][3][4] != 1) e(1);
+ if ( b[0][one()][two()][three()][four()] != 1) e(2);
+ if ( b[0][one()][five()-3][one()+2][four()] != b[0][1][2][2*2-1][4]) e(3);
+ for (i=0; i<50; i++)
+ a[i] = i+1;
+ if (a[one()-1] != one()) e(4);
+ if (echo(a[4]) != 5) e(5);
+ if ( echo( a[ echo(6) ] ) != 7 ) e(6);
+ if ( a[a[a[0]]] != 3 ) e(7);
+ for (i=11; i<22; i++)
+ if ( echo( a[i+echo('b'-'a'-1)] ) != i+1) e(8);
+ for (i=0; i<1; i++)
+ for (j=0; j<2; j++)
+ for (k=0; k<3; k++)
+ for (l=0; l<4; l++)
+ for (m=0; m<5; m++)
+ b[echo(i)][echo(j)][echo(k)][l][echo(m)] = j*k*l*m;
+ for (i=3; i; --i)
+ for (j=4; j; --j)
+ if (b[0][max1( max1(0,0), 1)][2][i][j] != 1*2*echo(i)*j ) e(9);
+}
+
+
+
+
+/* More testing */
+
+
+func(sw,i)
+int sw; /* switch selector */
+int i; /* value to be returned */
+{
+ int a[10];
+
+ switch(sw)
+ {
+ case 0: return(-i);
+ break;
+ case 1: return ( echo(i*i) - (i-1)*i );
+ break;
+ case 2: return ( 2*func(0,i) );
+ break;
+ case 3: a[0] = 3;
+ a[3] = 1;
+ a[1] = 8;
+ a[8] = i;
+ return( 3*a[a[a[a[0]]]] );
+ }
+ return(-32768);
+}
+
+
+
+
+/* testing function arguments */
+
+
+
+
+f1(i,j)
+int i,j;
+{
+ return( i!=j );
+}
+
+
+
+f2(ptr)
+int *ptr;
+{
+ int *locptr;
+
+ locptr = ptr;
+ return ( *ptr | *locptr );
+}
+
+
+
+swap(a,b)
+int *a,*b;
+{
+ int temp;
+
+ temp = *a;
+ *a = *b;
+ *b = temp;
+}
+
+
+
+test5()
+{
+ int k,l;
+ int *ptr;
+
+ t = 5;
+ tct++;
+ for (k = -6353; k < -6003; k++)
+ if (f1(k,k+3-echo(3))) e(1);
+ k = 'a' - 723;
+ ptr = &k;
+ if ( f2(ptr) != f2(&k) ) e(3);
+ if ( f2(ptr) + f2(&k) != 2*k ) e(4);
+ if ( f1(*ptr,*ptr) ) e(5);
+ if ( f1(*ptr,k) ) e(6);
+ if ( f1( f2(&k), *ptr ) ) e(7);
+ k = l=28;
+ swap(&k,&l);
+ if ( k != l ) e(8);
+ *ptr = k;
+ swap(&k,ptr);
+ if ( k != *ptr ) e(9);
+ l = -5;
+ k = 'h';
+ ptr = &k;
+ swap(ptr,&l);
+ if ( l != 'h' ) e(10);
+ if ( k != -5 ) e(11);
+ if ( *ptr != -5 ) e(12);
+ if ( ptr != &k ) e(13);
+}
+
+
+
+icount(i)
+int i;
+{
+ return(i+1);
+}
+
+
+
+test6()
+{
+ int i;
+
+ tct++;
+ t=6;
+ for (i=0; i<10; i++)
+ if (func(0,i) != -i) e(i);
+ for (i=10; i<20; i++)
+ if ( -func(2,i) != 2*i) e(i);
+ if (func(func(0,0),0) != 0) e(20);
+ if (func(-func(0,1),32) != 32) e(21);
+ if (max1(32767,10) != max2(32767,10)) e(22);
+ if (func(3,10) != 30) e(22);
+ if (icount(1)!=2) e(23);
+ if (icount(2)!=3) e(24);
+ if (icount(32766) != 32767) e(25);
+ if (icount((int)-32768) != -32767) e(26);
+ if (icount(icount(1)) != 3) e(27);
+ if ( icount( (int)&i ) != (int)&i + 1 ) e(28) ;
+ if (icount(icount(icount(icount(icount(icount(icount(icount(0))))))))!=8) e(29);
+}
--- /dev/null
+End of test program, 6 tests completed, 0 errors detected
--- /dev/null
+make "P=test1" -fsk ../makefile ${1-gen}
--- /dev/null
+/*
+ * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ *
+ * This product is part of the Amsterdam Compiler Kit.
+ *
+ * Permission to use, sell, duplicate or disclose this software must be
+ * obtained in writing. Requests for such permissions may be sent to
+ *
+ * Dr. Andrew S. Tanenbaum
+ * Wiskundig Seminarium
+ * Vrije Universiteit
+ * Postbox 7161
+ * 1007 MC Amsterdam
+ * The Netherlands
+ *
+ */
+
+/* This program can be used to test C-compilers */
+
+int i,j,k,l,m,ect,pct,t,*p1;
+int a1[20];
+float a2[20],xf,yf,zf;
+double a3[20],xd,yd,zd;
+
+char alstr[3000] ;
+char *alptr = alstr ;
+
+struct tp2
+{ char c1;
+ int i,j;
+ float aaa;
+ double bbb;
+} r1,r2,*p3;
+
+struct node
+{ int val;
+ struct node *next;
+} *head,*tail,*p2;
+
+main()
+{ ect = 0; pct = 0;
+ test1();test2();test3();
+ test4();test5();test6();
+ test7();test8();test9();
+ test10();test11();
+ printf("program test1\n");
+ printf("%d tests completed. Number of errors = %d\n",pct,ect);
+ return 0 ;
+}
+
+char *alloc(size) {
+ register char *retval ;
+
+ retval=alptr ;
+ alptr += size ;
+ if ( alptr-alstr>sizeof alstr ) {
+ printf("allocation overflow\n") ;
+ exit(8) ;
+ }
+ return(retval) ;
+}
+
+int abs(a) int a ; { return ( a<0 ? -a : a) ; }
+double fabs(a) double a ; { return( a<0 ? -a : a) ; }
+
+e(n)
+{ ect++; printf("error %d in test %d \n",n,t);
+}
+
+inc(n)
+{ return(++n);}
+
+/***********************************************************************/
+
+test1()
+/*arithmetic on constants */
+{ t = 1; pct++;
+ if (1+1 != 2) e(1);
+ if (3333 + 258 != 3591) e(2);
+ if (3*4 != 12) e(3);
+ if (111*111 != 12321) e(4);
+ if (50 / 5 != 10) e(5);
+ if (7498 / 75 != 99) e(6);
+ if (456 - 345 != 111) e(7);
+ if (1+(-2) != -1) e(8);
+ if (-3 * -4 != 12) e(9);
+ if (-2 / 2 != -1) e(10);
+ if (-5 / 1 != -5 ) e(11);
+ if (-4 - -5 != 1) e(12);
+ if ( 03 + 02 != 05) e(13);
+ if ( 03456 + 88 != 03606 ) e(14);
+ if ( 0100 * 23 != 02700 ) e(15);
+ if ( 045 / 020 != 2) e(16);
+ if (0472 - 0377 != 073 ) e(17);
+ if ('a' + 3 != 100) e(18);
+ if ('a' + 'c' != 'b' + 'b') e(19);
+ if ( 'z' * 'z' != 14884 ) e(20);
+ if ( -'z' / 01 != -'z' ) e(21);
+ if ( 077777 >> 3 != 07777 ) e(22);
+ if ( 077777 >> 15 ) e(23);
+ if ( 234 << 6 != 234 >> -6 ) e(24);
+ if ( 0124 & 07765 != 0124 ) e(25);
+ if ( 34 & 31 != 2 ) e(26);
+ if ( ( -4 | 3 ) != -1 ) e(27);
+ if ( ( 5 | 013 | 020 ) != 31 ) e(28);
+ if ( ( -7 ^ 3 ) != -6 ) e(29);
+ if ( ( 07373 ^ 4632 ) != 016343 ) e(30);
+ if ( (1+2+3)*(2+3+4)*(3+5+5) / 2 != ((3*((5+3+2)*10)+51)*6)/6 ) e(31);
+ if ( (1000*2+5*7+13)/ 8 != 2*2*2*2*4*4 ) e(32);
+ if ((1*2*3*4*5*6*7 / 5040 !=
+ 5040 / 7 / 6 / 5 / 4 / 3 / 2 / 1 )) e(33);
+ if ( -(-(-(-(-(-(1)))))) != 1 ) e(34);
+ if (- 1 != -((((((((((1)))))))))) ) e(35);
+ if ( -1-1-1-1-1-1 != -6-3+3 ) e(36);
+ if ( -4 * -5 != 20 ) e(37);
+ if ( 2<1 ) e(38);
+ if ( 2<= 1 ) e(39);
+ if ( 2==3 ) e(40);
+ if ( 2 != 2 ) e(41);
+ if ( 2 >= 3) e(42);
+ if ( 2 > 3 ) e(43);
+ if (2 + 0 != 2 ) e(44);
+ if (2 - 0 != 2 ) e(45);
+ if (2 * 0 != 0 ) e(46);
+ if ( 0 / 1 != 0 ) e(47);
+ if ( -0 != 0 ) e(48);
+ if ( 0 * 0 != 0 ) e(49);
+ if ( 32767 > 32767 ) e(50);
+ if ( 0456 < 0400 ) e(51);
+ if ( 0456 != ( 0400 | 050 | 06 ) ) e(52);
+ if ( 2*2<<2*2/4 != 010 ) e(53);
+ if ( 0 || 0 ) e(54);
+ if ( 1 && 0 ) e(55);
+ if ( ( 123 ? 123 * 4 :345) != 492 ) e(56);
+ if ( ( 0 ? 345 : 280) != 280 ) e(57);
+ if ( ( (2*2/2<<2)|(2/2) ) != 9 ) e(58);
+ if ( !( 111 || 23 && 0 ) ) e(59);
+ if ( !1 ) e(60);
+ if ( !0 == 0 ) e(61);
+ if ( !!!!!!!!0 ) e(62);
+}
+
+/***********************************************************************/
+
+test2()
+/*arithmetic on global integer variables*/
+{ t = 2; pct++;
+ i = 1; j = 2; k = 3; l = 4; m = 10;
+ if ( i+j != k ) e(1);
+ if ( i+k != l ) e(2);
+ if ( j-k != -i ) e(3);
+ if ( j*(j + k) != m ) e(4);
+ if ( -m != -(k+k+l) ) e(5);
+ if ( i / i != 1 ) e(6);
+ if ( m*m / m != m ) e(7);
+ if ( 10 * m != 100 ) e(8);
+ if ( m * (-10) != -100 ) e(9);
+ if ( j / k != 0 ) e(10);
+ if ( 100 / k != 33 ) e(11);
+ if ( i+j*k+l+m / j + 50 / k != 32 ) e(12);
+ if ( j*k*m / 6 != 10 ) e(13);
+ if ( (k>4) || (k>=4) || (k==4) ) e(14);
+ if ( (m<j) || (m<=j) || (m==j) ) e(15);
+ if ( i+j-k ) e(16);
+ if ( j<i ) e(17);
+ if ( j != j ) e(18);
+ if ( i > j ) e(19);
+ if ( (i > j ? k : k*j ) != 6 ) e(20);
+ if ( (i < j ? k : k*j ) != 3 ) e(21);
+ if ( j<<i != l ) e(22);
+ if ( j>> -i != l ) e(23);
+ if ( j<< -i != i ) e(24);
+ if ( j>> i != i ) e(25);
+ if ( i++ != 1 ) e(26);
+ if ( --i != 1 ) e(27);
+ if ( i-- != 1 ) e(28);
+ if ( ( i+j ) && ( i<0 ) || (m-10) && (064) ) e(29);
+ if ( ( i+j ) && !(i>=0) || (m-10) && !( 0 ) ) e(30);
+}
+
+/***********************************************************************/
+
+test3()
+/*arithmetic on local integer variables*/
+{ int a,b,c,d,f;
+ t = 3; pct++;
+ a = 1; b = 2; c = 3; d = 4; f = 10;
+ if ( a+b != c ) e(1);
+ if ( a+c != d ) e(2);
+ if ( b-c != -a ) e(3);
+ if ( b*(b + c) != f ) e(4);
+ if ( -f != -(c+c+d) ) e(5);
+ if ( a / a != 1 ) e(6);
+ if ( f*f / f != f ) e(7);
+ if ( 10 * f != 100 ) e(8);
+ if ( f * (-10) != -100 ) e(9);
+ if ( b / c != 0 ) e(10);
+ if ( 100 / c != 33 ) e(11);
+ if ( a+b*c+d+f / b + 50 / c != 32 ) e(12);
+ if ( b*c*f / 6 != 10 ) e(13);
+ if ( (c>4) || (c>=4) || (c==4) ) e(14);
+ if ( (f<b) || (f<=b) || (f==b) ) e(15);
+ if ( c != a+b ) e(16);
+ if ( b<a ) e(17);
+ if ( b != b ) e(18);
+ if ( a > b ) e(19);
+ if ( (a > b ? c : c*b ) != 6 ) e(20);
+ if ( (a < b ? c : c*b ) != 3 ) e(21);
+ if ( b<<a != d ) e(22);
+ if ( b>> -a != d ) e(23);
+ if ( b<< -a != a ) e(24);
+ if ( b>> a != a ) e(25);
+ if ( a++ != 1 ) e(26);
+ if ( --a != 1 ) e(27);
+ if ( a-- != 1 ) e(28);
+ if ( ( a+b ) && ( a<0 ) || (f-10) && (064) ) e(29);
+ if ( ( a+b ) && !(a>=0) || (f-10) && !( 0 ) ) e(30);
+}
+
+/***********************************************************************/
+
+test4()
+/* global arrays */
+{ float epsf;
+ double epsd;
+ t=4; pct++; epsf = 1e-7; epsd = 1e-17;
+ for ( i=0; i<20 ; i++ ) a1[i] = i*i;
+ if ( a1[9] != 81 || a1[17] != 289 || a1[0] != 0 ) e(1);
+ if ( a1[1] + a1[2] + a1[3] != 14 ) e(2);
+ if ( ! a1[15] ) e(3);
+ if ( a1[8] / a1[4] != 4 ) e(4);
+ for ( i=0; i<20; i++ ) a2[i] = 10.0e-1 + i/54.324e-1;
+ if ( fabs(a2[4]*a2[4]-a2[4]*(10.0e-1 + 4/54.324e-1 ) ) > epsf ) e(5);
+ if ( fabs(a2[8]/a2[8]*a2[9]/a2[9]-a2[10]+a2[10]-1.0 ) > epsf ) e(6);
+ if ( fabs(a2[5]-a2[4]-1/54.324e-1 ) > epsf ) e(7);
+ for ( i=0; i<20; i++ ) a3[i]= 10.0e-1 + i/54.324e-1;
+ if ( fabs(a3[4]*a3[4]-a3[4]*(1.0e0+4/54.324e-1 )) > epsd ) e(8);
+ if ( fabs( a3[8]*a3[9]/a3[8]/a3[9]-a3[10]+a3[10]-1000e-3) > epsd ) e(9);
+ if ( fabs(a3[8]+a3[6]-2*a3[7]) > epsd ) e(10);
+}
+
+/***************************************************************/
+
+test5()
+/* real arithmetic */
+{
+ double epsd; float epsf;
+ t = 5; pct++; epsf = 1e-7; epsd = 1e-17;
+ xf = 1.50 ; yf = 3.00 ; zf = 0.10;
+ xd = 1.50 ; yd = 3.00 ; zd = 0.10;
+ if ( fabs(1.0 + 1.0 - 2.0 ) > epsd ) e(1);
+ if ( fabs( 1e10-1e10 ) > epsd ) e(2);
+ if ( abs( 1.0e+5*1.0e+5-100e+8 ) > epsd ) e(3);
+ if ( fabs( 10.0/3.0*3.0/10.0-100e-2 ) > epsd ) e(4);
+ if ( 0.0e0 != 0 ) e(5);
+ if ( fabs( 32767.0 - 32767 ) > epsd ) e(6);
+ if ( fabs( 1.0+2+5+3.0e0+7.5e+1+140e-1-100.0 ) > epsd ) e(7);
+ if ( fabs(-1+(-1)+(-1.0)+(-1.0e0)+(-1.0e-0)+(-1e0)+6 ) > epsd ) e(8);
+ if ( fabs(5.0*yf*zf-xf) > epsf ) e(9);
+ if ( fabs(5.0*yd*zd-xd) > epsd ) e(10);
+ if ( fabs(yd*yd - (2.0*xd)*(2.0*xd) ) > epsd ) e(11);
+ if ( fabs(yf*yf - (2.0*xf)*(2.0*xf) ) > epsf ) e(12);
+ if ( fabs( yd*yd+zd*zd+2.0*yd*zd-(yd+zd)*(zd+yd) ) > epsd ) e(13);
+ if ( fabs( yf*yf+zf*zf+2.0*yf*zf-(yf+zf)*(zf+yf) ) > epsf ) e(14);
+ xf=1.10;yf=1.20;
+ if ( yd<xd ) e(15);
+ if ( yd<=xd ) e(16);
+ if ( yd==xd ) e(17);
+ if ( xd>=yd ) e(18);
+ if ( yd<xd ) e(19);
+ if ( fabs(yd-xd-1.5) > epsd ) e(20);
+}
+
+
+/****************************************************************/
+
+test6()
+/* local arrays */
+{ int b1[20]; float epsf, b2[20]; double b3[20],epsd;
+ epsf = 1e-7; epsd = 1e-17;
+ t = 6; pct++;
+ for ( i=0; i<20 ; i++ ) b1[i] = i*i;
+ if ( b1[9]-b1[8] != 17 ) e(1);
+ if ( b1[3] + b1[4] != b1[5] ) e(2);
+ if ( b1[1] != 1||b1[3] != 9 || b1[5] != 25 || b1[7] != 49 ) e(3);
+ if ( b1[12] / b1[6] != 4 ) e(4);
+ for ( i=0; i<20; i += 1) b2[i] = 10.0e-1+i/54.324e-1;
+ if (fabs(b2[4]*b2[4]-b2[4]*(10.0e-1+4/54.324e-1)) > epsf ) e(5);
+ if (fabs(b2[8]/b2[8]*b2[9]/b2[9]-b2[10]+b2[10]-1.0) > epsf ) e(6);
+ if ( fabs(b2[5]-b2[4]-1/5.4324 ) > epsf ) e(7);
+ for ( i=0; i<20 ; i += 1 ) b3[i] = 10.0e-1+i/54.324e-1;
+ if (fabs(b3[4]*b3[4]-b3[4]*(10.0e-1+4/54.324e-1)) > epsd ) e(8);
+ if (fabs(b3[8]*b3[9]/b3[8]/b3[9]+b3[10]-b3[10]-1.0) > epsd ) e(9);
+ if (fabs(b3[10]+b3[18]-2*b3[14]) > epsd ) e(10);
+}
+
+
+/****************************************************************/
+
+
+
+test7()
+/* mixed local and global */
+{ int li,b1[20];
+ double b3[10],xxd,epsd;
+ t = 7; pct++;epsd = 1e-17;
+ li = 6; i = li ;
+ if ( i != 6 ) e(1);
+ i = 6; li = i;
+ if ( i != li ) e(2);
+ if ( i % li ) e(3);
+ i=li=i=li=i=li=i=i=i=li=j;
+ if ( i != li || i != j ) e(4);
+ for ( i=li=0; i<20 ; i=li ) { b1[li]= (li+1)*(i+1) ; li++; }
+ if ( b1[9] != a1[10] ) e(5);
+ if ( b1[7]/a1[4] != a1[2] ) e(6);
+ li = i = 121;
+ if ( b1[10] != i && a1[11]!= li ) e(7);
+ for ( li=0 ; li<10; li++ ) b3[li]= 1.0e0 + li/54.324e-1;
+ if ( fabs(b3[9]-a3[9]) > epsd ) e(8);
+ if ( fabs(8/54.324e-1 - b3[9]+a3[1] ) > epsd ) e(9);
+}
+
+/***************************************************************/
+
+
+test8()
+/*global records */
+{ t=8; pct++;
+ r1.c1= 'x';r1.i=40;r1.j=50;r1.aaa=3.0;r1.bbb=4.0;
+ r2.c1=r1.c1;
+ r2.i= 50;
+ r2.j=40;r2.aaa=4.0;r2.bbb=5.0;
+ if (r1.c1 != 'x' || r1.i != 40 || r1.aaa != 3.0 ) e(1);
+ i = 25;j=75;
+ if (r1.i != 40 || r2.i != 50 ) e(2);
+ if ( r2.j != 40 || r1.j != 50 ) e(3);
+ if ( (r1.c1 + r2.c1)/2 != 'x' ) e(4);
+ if ( r1.aaa*r1.aaa+r2.aaa*r2.aaa != r2.bbb*r2.bbb) e(5);
+ r1.i = 34; if ( i!=25 ) e(6);
+}
+
+
+/****************************************************************/
+
+
+test9()
+/*local records */
+{ struct tp2 s1,s2;
+ t=9; pct++;
+ s1.c1= 'x';s1.i=40;s1.j=50;s1.aaa=3.0;s1.bbb=4.0;
+ s2.c1=s1.c1;
+ s2.i= 50;
+ s2.j=40;s2.aaa=4.0;s2.bbb=5.0;
+ if (s1.c1 != 'x' || s1.i != 40 || s1.aaa != 3.0 ) e(1);
+ i = 25;j=75;
+ if (s1.i != 40 || s2.i != 50 ) e(2);
+ if ( s2.j != 40 || s1.j != 50 ) e(3);
+ if ( (s1.c1 + s2.c1)/2 != 'x' ) e(4);
+ if ( s1.aaa*s1.aaa+s2.aaa*s2.aaa != s2.bbb*s2.bbb) e(5);
+ s1.i = 34; if ( i!=25 ) e(6);
+}
+
+
+
+/***********************************************************************/
+test10()
+/*global pointers */
+{ t=10; pct++;
+ p1=alloc( sizeof *p1 );
+ p2=alloc( sizeof *p2);
+ p3=alloc(sizeof *p3);
+ *p1 = 1066;
+ if ( *p1 != 1066 ) e(1);
+ p3->i = 1215;
+ if ( p3->i != 1215 ) e(2);
+ p2->val = 1566;
+ if ( p2->val != 1566 || p2->next ) e(3);
+ if ( a1 != &a1[0] ) e(4);
+ p1 = a1;
+ if ( ++p1 != &a1[1] ) e(5);
+ head = 0;
+ for (i=0;i<=100;i += 1)
+ { tail = alloc(sizeof *p2);
+ tail->val = 100+i;tail->next = head;
+ head = tail;
+ }
+ if ( tail->val != 200 || tail->next->val != 199 ) e(6);
+ if ( tail->next->next->next->next->next->val != 195) e(7);
+ tail->next->next->next->next->next->val = 1;
+ if ( tail->next->next->next->next->next->val != 1) e(8);
+ i = 27;
+ if ( *&i != 27 ) e(9);
+ if ( &*&*&*&i != &i ) e(10);
+ p1 = &i;i++;
+ if ( p1 != &i ) e(11);
+}
+
+/*****************************************************************/
+test11()
+/*local pointers */
+{ struct tp2 *pp3;
+ struct node *pp2,*ingang,*uitgang;
+ int *pp1;
+ int b1[20];
+ t=11; pct++;
+ pp1=alloc( sizeof *pp1 );
+ pp2=alloc( sizeof *p2);
+ pp3=alloc(sizeof *pp3);
+ *pp1 = 1066;
+ if ( *pp1 != 1066 ) e(1);
+ pp3->i = 1215;
+ if ( pp3->i != 1215 ) e(2);
+ pp2->val = 1566;
+ if ( pp2->val != 1566 || p2->next ) e(3);
+ if ( b1 != &b1[0] ) e(4);
+ pp1 = b1;
+ if ( ++pp1 != &b1[1] ) e(5);
+ ingang = 0;
+ for (i=0;i<=100;i += 1)
+ { uitgang = alloc(sizeof *pp2);
+ uitgang->val = 100+i;uitgang->next = ingang;
+ ingang = uitgang;
+ }
+ if ( uitgang->val != 200 || uitgang->next->val != 199 ) e(6);
+ if ( uitgang->next->next->next->next->next->val != 195 ) e(7);
+ uitgang->next->next->next->next->next->val = 1;
+ if ( uitgang->next->next->next->next->next->val != 1) e(8);
+}
+
+/*****************************************************************/
--- /dev/null
+error 13 in test 5
+program test1
+11 tests completed. Number of errors = 1
--- /dev/null
+ISTART
+FN() {
+teff() ; tass() ; tsta() ; tasssta() ; tiff() ; tifass() ;
+return 0 ;
+}
+teff() {
+/* simple operator test */
+/* first evaluate for side effects */
+LSTART
+X + Y
+X - Y
+X / Y
+X % Y
+X * Y
+X & Y
+X | Y
+X ^ Y
+X || Y
+X && Y
+X << S
+X >> S
+-X
+!X
+~X
+X == Y
+X != Y
+X <= Y
+X >= Y
+X < Y
+X > Y
+X ? X : Y
+}
+tass() {
+LSTART
+/* assignment ops */
+Z1 = X
+Z1 += X
+Z1 -= X
+Z1 /= X
+Z1 %= X
+Z1 *= X
+Z1 &= X
+Z1 |= X
+Z1 ^= X
+Z1 <<= S
+Z1 >>= S
+Z1 ++
+Z1 --
+-- Z1
+++ Z1
+}
+tsta() {
+/* secondly evaluate and use the value */
+LSTART
+Z2 = ( X + Y )
+Z2 = ( X - Y )
+Z2 = ( X / Y )
+Z2 = ( X % Y )
+Z2 = ( X * Y )
+Z2 = ( X & Y )
+Z2 = ( X | Y )
+Z2 = ( X ^ Y )
+Z2 = ( X || Y )
+Z2 = ( X && Y )
+Z2 = ( X << S )
+Z2 = ( X >> S )
+Z2 = ( -X )
+Z2 = ( !X )
+Z2 = ( ~X )
+Z2 = ( X == Y )
+Z2 = ( X != Y )
+Z2 = ( X <= Y )
+Z2 = ( X >= Y )
+Z2 = ( X < Y )
+Z2 = ( X > Y )
+Z2 = ( X ? X : Y )
+}
+tasssta() {
+/* assignment ops */
+LSTART
+Z2 = ( Z1 = X )
+Z2 = ( Z1 += X )
+Z2 = ( Z1 -= X )
+Z2 = ( Z1 /= X )
+Z2 = ( Z1 %= X )
+Z2 = ( Z1 *= X )
+Z2 = ( Z1 &= X )
+Z2 = ( Z1 |= X )
+Z2 = ( Z1 ^= X )
+Z2 = ( Z1 <<= S )
+Z2 = ( Z1 >>= S )
+Z2 = ( Z1 ++ )
+Z2 = ( Z1 -- )
+Z2 = ( -- Z1 )
+Z2 = ( ++ Z1 )
+}
+tiff() {
+LSTART
+/* conditional context */
+if ( X + Y ) yes() ; else no()
+if ( X - Y ) yes() ; else no()
+if ( X / Y ) yes() ; else no()
+if ( X % Y ) yes() ; else no()
+if ( X * Y ) yes() ; else no()
+if ( X & Y ) yes() ; else no()
+if ( X | Y ) yes() ; else no()
+if ( X ^ Y ) yes() ; else no()
+if ( X || Y ) yes() ; else no()
+if ( X && Y ) yes() ; else no()
+if ( X << S ) yes() ; else no()
+if ( X >> S ) yes() ; else no()
+if ( -X ) yes() ; else no()
+if ( !X ) yes() ; else no()
+if ( ~X ) yes() ; else no()
+if ( X == Y ) yes() ; else no()
+if ( X != Y ) yes() ; else no()
+if ( X <= Y ) yes() ; else no()
+if ( X >= Y ) yes() ; else no()
+if ( X < Y ) yes() ; else no()
+if ( X > Y ) yes() ; else no()
+if ( X ? X : Y ) yes() ; else no()
+}
+tifass() {
+LSTART
+/* assignment ops */
+if ( Z1 = X ) yes() ; else no()
+if ( Z1 += X ) yes() ; else no()
+if ( Z1 -= X ) yes() ; else no()
+if ( Z1 /= X ) yes() ; else no()
+if ( Z1 %= X ) yes() ; else no()
+if ( Z1 *= X ) yes() ; else no()
+if ( Z1 &= X ) yes() ; else no()
+if ( Z1 |= X ) yes() ; else no()
+if ( Z1 ^= X ) yes() ; else no()
+if ( Z1 <<= S ) yes() ; else no()
+if ( Z1 >>= S ) yes() ; else no()
+if ( Z1 ++ ) yes() ; else no()
+if ( Z1 -- ) yes() ; else no()
+if ( -- Z1 ) yes() ; else no()
+if ( ++ Z1 ) yes() ; else no()
+}
+yes() { printf("yes ") ; }
+no() { printf("no ") ; }
--- /dev/null
+bfs.bf1 + bfs.bf2
+bfs.bf1 - bfs.bf2
+bfs.bf1 / bfs.bf2
+bfs.bf1 % bfs.bf2
+bfs.bf1 * bfs.bf2
+bfs.bf1 & bfs.bf2
+bfs.bf1 | bfs.bf2
+bfs.bf1 ^ bfs.bf2
+bfs.bf1 || bfs.bf2
+bfs.bf1 && bfs.bf2
+bfs.bf1 << 1
+bfs.bf1 >> 1
+-bfs.bf1
+!bfs.bf1
+~bfs.bf1
+bfs.bf1 == bfs.bf2
+bfs.bf1 != bfs.bf2
+bfs.bf1 <= bfs.bf2
+bfs.bf1 >= bfs.bf2
+bfs.bf1 < bfs.bf2
+bfs.bf1 > bfs.bf2
+bfs.bf1 ? bfs.bf1 : bfs.bf2
+bfs.bf3 = bfs.bf1 1
+bfs.bf3 += bfs.bf1 0
+bfs.bf3 -= bfs.bf1 254
+bfs.bf3 /= bfs.bf1 255
+bfs.bf3 %= bfs.bf1 0
+bfs.bf3 *= bfs.bf1 255
+bfs.bf3 &= bfs.bf1 1
+bfs.bf3 |= bfs.bf1 255
+bfs.bf3 ^= bfs.bf1 254
+bfs.bf3 <<= 1 254
+bfs.bf3 >>= 1 127
+bfs.bf3 ++ 0
+bfs.bf3 -- 254
+-- bfs.bf3 254
+++ bfs.bf3 0
+bfs.bf4 = ( bfs.bf1 + bfs.bf2 ) 9
+bfs.bf4 = ( bfs.bf1 - bfs.bf2 ) -7
+bfs.bf4 = ( bfs.bf1 / bfs.bf2 ) 0
+bfs.bf4 = ( bfs.bf1 % bfs.bf2 ) 1
+bfs.bf4 = ( bfs.bf1 * bfs.bf2 ) 8
+bfs.bf4 = ( bfs.bf1 & bfs.bf2 ) 0
+bfs.bf4 = ( bfs.bf1 | bfs.bf2 ) 9
+bfs.bf4 = ( bfs.bf1 ^ bfs.bf2 ) 9
+bfs.bf4 = ( bfs.bf1 || bfs.bf2 ) 1
+bfs.bf4 = ( bfs.bf1 && bfs.bf2 ) 1
+bfs.bf4 = ( bfs.bf1 << 1 ) 2
+bfs.bf4 = ( bfs.bf1 >> 1 ) 0
+bfs.bf4 = ( -bfs.bf1 ) -1
+bfs.bf4 = ( !bfs.bf1 ) 0
+bfs.bf4 = ( ~bfs.bf1 ) -2
+bfs.bf4 = ( bfs.bf1 == bfs.bf2 ) 0
+bfs.bf4 = ( bfs.bf1 != bfs.bf2 ) 1
+bfs.bf4 = ( bfs.bf1 <= bfs.bf2 ) 1
+bfs.bf4 = ( bfs.bf1 >= bfs.bf2 ) 0
+bfs.bf4 = ( bfs.bf1 < bfs.bf2 ) 1
+bfs.bf4 = ( bfs.bf1 > bfs.bf2 ) 0
+bfs.bf4 = ( bfs.bf1 ? bfs.bf1 : bfs.bf2 ) 1
+bfs.bf4 = ( bfs.bf3 = bfs.bf1 ) 1 1
+bfs.bf4 = ( bfs.bf3 += bfs.bf1 ) 0 0
+bfs.bf4 = ( bfs.bf3 -= bfs.bf1 ) 254 254
+bfs.bf4 = ( bfs.bf3 /= bfs.bf1 ) 255 255
+bfs.bf4 = ( bfs.bf3 %= bfs.bf1 ) 0 0
+bfs.bf4 = ( bfs.bf3 *= bfs.bf1 ) 255 255
+bfs.bf4 = ( bfs.bf3 &= bfs.bf1 ) 1 1
+bfs.bf4 = ( bfs.bf3 |= bfs.bf1 ) 255 255
+bfs.bf4 = ( bfs.bf3 ^= bfs.bf1 ) 254 254
+bfs.bf4 = ( bfs.bf3 <<= 1 ) 254 254
+bfs.bf4 = ( bfs.bf3 >>= 1 ) 127 127
+bfs.bf4 = ( bfs.bf3 ++ ) 0 255
+bfs.bf4 = ( bfs.bf3 -- ) 254 255
+bfs.bf4 = ( -- bfs.bf3 ) 254 254
+bfs.bf4 = ( ++ bfs.bf3 ) 0 0
+yes if ( bfs.bf1 + bfs.bf2 ) yes() ; else no()
+yes if ( bfs.bf1 - bfs.bf2 ) yes() ; else no()
+no if ( bfs.bf1 / bfs.bf2 ) yes() ; else no()
+yes if ( bfs.bf1 % bfs.bf2 ) yes() ; else no()
+yes if ( bfs.bf1 * bfs.bf2 ) yes() ; else no()
+no if ( bfs.bf1 & bfs.bf2 ) yes() ; else no()
+yes if ( bfs.bf1 | bfs.bf2 ) yes() ; else no()
+yes if ( bfs.bf1 ^ bfs.bf2 ) yes() ; else no()
+yes if ( bfs.bf1 || bfs.bf2 ) yes() ; else no()
+yes if ( bfs.bf1 && bfs.bf2 ) yes() ; else no()
+yes if ( bfs.bf1 << 1 ) yes() ; else no()
+no if ( bfs.bf1 >> 1 ) yes() ; else no()
+yes if ( -bfs.bf1 ) yes() ; else no()
+no if ( !bfs.bf1 ) yes() ; else no()
+yes if ( ~bfs.bf1 ) yes() ; else no()
+no if ( bfs.bf1 == bfs.bf2 ) yes() ; else no()
+yes if ( bfs.bf1 != bfs.bf2 ) yes() ; else no()
+yes if ( bfs.bf1 <= bfs.bf2 ) yes() ; else no()
+no if ( bfs.bf1 >= bfs.bf2 ) yes() ; else no()
+yes if ( bfs.bf1 < bfs.bf2 ) yes() ; else no()
+no if ( bfs.bf1 > bfs.bf2 ) yes() ; else no()
+yes if ( bfs.bf1 ? bfs.bf1 : bfs.bf2 ) yes() ; else no()
+yes if ( bfs.bf3 = bfs.bf1 ) yes() ; else no() 1
+no if ( bfs.bf3 += bfs.bf1 ) yes() ; else no() 0
+yes if ( bfs.bf3 -= bfs.bf1 ) yes() ; else no() 254
+yes if ( bfs.bf3 /= bfs.bf1 ) yes() ; else no() 255
+no if ( bfs.bf3 %= bfs.bf1 ) yes() ; else no() 0
+yes if ( bfs.bf3 *= bfs.bf1 ) yes() ; else no() 255
+yes if ( bfs.bf3 &= bfs.bf1 ) yes() ; else no() 1
+yes if ( bfs.bf3 |= bfs.bf1 ) yes() ; else no() 255
+yes if ( bfs.bf3 ^= bfs.bf1 ) yes() ; else no() 254
+yes if ( bfs.bf3 <<= 1 ) yes() ; else no() 254
+yes if ( bfs.bf3 >>= 1 ) yes() ; else no() 127
+yes if ( bfs.bf3 ++ ) yes() ; else no() 0
+yes if ( bfs.bf3 -- ) yes() ; else no() 254
+yes if ( -- bfs.bf3 ) yes() ; else no() 254
+no if ( ++ bfs.bf3 ) yes() ; else no() 0
--- /dev/null
+/ISTART/c\
+/* test bit fields */\
+struct bfs {\
+ int bf1:1 ;\
+ int bf2:4 ;\
+ int bf3:8 ;\
+ int bf4:16 ;\
+} bfs ;
+s/FN/main/
+/LSTART/c\
+ bfs.bf1=1 ; bfs.bf2=8 ;
+/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
+/Z1/s/#/ %d&/
+/Z1/s/@/, Z1&/
+/Z2/s/#/ %d&/
+/Z2/s/@/, Z2&/
+/Z1/s/^/Z1 = 255 ; /
+/Z2/s/^/Z2 = 3 ; /
+/[XYZS]/s/^/ /
+s/X/bfs.bf1/g
+s/Y/bfs.bf2/g
+s/S/1/g
+s/Z1/bfs.bf3/g
+s/Z2/bfs.bf4/g
+s/#/\\n/
+s/@//
--- /dev/null
+40000 + 30000
+40000 - 30000
+40000 / 30000
+40000 % 30000
+40000 * 30000
+40000 & 30000
+40000 | 30000
+40000 ^ 30000
+40000 || 30000
+40000 && 30000
+40000 << 9
+40000 >> 9
+-40000
+!40000
+~40000
+40000 == 30000
+40000 != 30000
+40000 <= 30000
+40000 >= 30000
+40000 < 30000
+40000 > 30000
+40000 ? 40000 : 30000
+x = 40000 40000
+x += 40000 40010
+x -= 40000 -39990
+x /= 40000 0
+x %= 40000 10
+x *= 40000 400000
+x &= 40000 0
+x |= 40000 40010
+x ^= 40000 40010
+x <<= 9 5120
+x >>= 9 0
+x ++ 11
+x -- 9
+-- x 9
+++ x 11
+y = ( 40000 + 30000 ) 70000
+y = ( 40000 - 30000 ) 10000
+y = ( 40000 / 30000 ) 1
+y = ( 40000 % 30000 ) 10000
+y = ( 40000 * 30000 ) 1200000000
+y = ( 40000 & 30000 ) 5120
+y = ( 40000 | 30000 ) 64880
+y = ( 40000 ^ 30000 ) 59760
+y = ( 40000 || 30000 ) 1
+y = ( 40000 && 30000 ) 1
+y = ( 40000 << 9 ) 20480000
+y = ( 40000 >> 9 ) 78
+y = ( -40000 ) -40000
+y = ( !40000 ) 0
+y = ( ~40000 ) -40001
+y = ( 40000 == 30000 ) 0
+y = ( 40000 != 30000 ) 1
+y = ( 40000 <= 30000 ) 0
+y = ( 40000 >= 30000 ) 1
+y = ( 40000 < 30000 ) 0
+y = ( 40000 > 30000 ) 1
+y = ( 40000 ? 40000 : 30000 ) 40000
+y = ( x = 40000 ) 40000 40000
+y = ( x += 40000 ) 40010 40010
+y = ( x -= 40000 ) -39990 -39990
+y = ( x /= 40000 ) 0 0
+y = ( x %= 40000 ) 10 10
+y = ( x *= 40000 ) 400000 400000
+y = ( x &= 40000 ) 0 0
+y = ( x |= 40000 ) 40010 40010
+y = ( x ^= 40000 ) 40010 40010
+y = ( x <<= 9 ) 5120 5120
+y = ( x >>= 9 ) 0 0
+y = ( x ++ ) 11 10
+y = ( x -- ) 9 10
+y = ( -- x ) 9 9
+y = ( ++ x ) 11 11
+yes if ( 40000 + 30000 ) yes() ; else no()
+yes if ( 40000 - 30000 ) yes() ; else no()
+yes if ( 40000 / 30000 ) yes() ; else no()
+yes if ( 40000 % 30000 ) yes() ; else no()
+yes if ( 40000 * 30000 ) yes() ; else no()
+yes if ( 40000 & 30000 ) yes() ; else no()
+yes if ( 40000 | 30000 ) yes() ; else no()
+yes if ( 40000 ^ 30000 ) yes() ; else no()
+yes if ( 40000 || 30000 ) yes() ; else no()
+yes if ( 40000 && 30000 ) yes() ; else no()
+yes if ( 40000 << 9 ) yes() ; else no()
+yes if ( 40000 >> 9 ) yes() ; else no()
+yes if ( -40000 ) yes() ; else no()
+no if ( !40000 ) yes() ; else no()
+yes if ( ~40000 ) yes() ; else no()
+no if ( 40000 == 30000 ) yes() ; else no()
+yes if ( 40000 != 30000 ) yes() ; else no()
+no if ( 40000 <= 30000 ) yes() ; else no()
+yes if ( 40000 >= 30000 ) yes() ; else no()
+no if ( 40000 < 30000 ) yes() ; else no()
+yes if ( 40000 > 30000 ) yes() ; else no()
+yes if ( 40000 ? 40000 : 30000 ) yes() ; else no()
+yes if ( x = 40000 ) yes() ; else no() 40000
+yes if ( x += 40000 ) yes() ; else no() 40010
+yes if ( x -= 40000 ) yes() ; else no() -39990
+no if ( x /= 40000 ) yes() ; else no() 0
+yes if ( x %= 40000 ) yes() ; else no() 10
+yes if ( x *= 40000 ) yes() ; else no() 400000
+no if ( x &= 40000 ) yes() ; else no() 0
+yes if ( x |= 40000 ) yes() ; else no() 40010
+yes if ( x ^= 40000 ) yes() ; else no() 40010
+yes if ( x <<= 9 ) yes() ; else no() 5120
+no if ( x >>= 9 ) yes() ; else no() 0
+yes if ( x ++ ) yes() ; else no() 11
+yes if ( x -- ) yes() ; else no() 9
+yes if ( -- x ) yes() ; else no() 9
+yes if ( ++ x ) yes() ; else no() 11
--- /dev/null
+1i\
+ /* ops is converted into a test program for longs \
+*/
+/LSTART/d
+s/FN/main/
+/ISTART/c\
+ long x=100234 , y= -301 ;
+/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
+/Z1/s/#/ %D&/
+/Z1/s/@/, Z1&/
+/Z2/s/#/ %D&/
+/Z2/s/@/, Z2&/
+/Z1/s/^/Z1 = 10 ; /
+/Z2/s/^/Z2 = 0100 ; /
+/[XYZS]/s/^/ /
+s/X/40000/g
+s/Y/30000/g
+s/S/9/g
+s/Z1/x/g
+s/Z2/y/g
+s/#/\\n/
+s/@//
--- /dev/null
+40000 + 8012
+40000 - 8012
+40000 / 8012
+40000 % 8012
+40000 * 8012
+40000 & 8012
+40000 | 8012
+40000 ^ 8012
+40000 || 8012
+40000 && 8012
+40000 << 9
+40000 >> 9
+-40000
+!40000
+~40000
+40000 == 8012
+40000 != 8012
+40000 <= 8012
+40000 >= 8012
+40000 < 8012
+40000 > 8012
+40000 ? 40000 : 8012
+x = 40000 -25536
+x += 40000 -25526
+x -= 40000 25546
+x /= 40000 0
+x %= 40000 10
+x *= 40000 6784
+x &= 40000 0
+x |= 40000 -25526
+x ^= 40000 -25526
+x <<= 9 5120
+x >>= 9 0
+x ++ 11
+x -- 9
+-- x 9
+++ x 11
+y = ( 40000 + 8012 ) -17524
+y = ( 40000 - 8012 ) 31988
+y = ( 40000 / 8012 ) 4
+y = ( 40000 % 8012 ) 7952
+y = ( 40000 * 8012 ) 8960
+y = ( 40000 & 8012 ) 7232
+y = ( 40000 | 8012 ) -24756
+y = ( 40000 ^ 8012 ) -31988
+y = ( 40000 || 8012 ) 1
+y = ( 40000 && 8012 ) 1
+y = ( 40000 << 9 ) -32768
+y = ( 40000 >> 9 ) 78
+y = ( -40000 ) 25536
+y = ( !40000 ) 0
+y = ( ~40000 ) 25535
+y = ( 40000 == 8012 ) 0
+y = ( 40000 != 8012 ) 1
+y = ( 40000 <= 8012 ) 0
+y = ( 40000 >= 8012 ) 1
+y = ( 40000 < 8012 ) 0
+y = ( 40000 > 8012 ) 1
+y = ( 40000 ? 40000 : 8012 ) -25536
+y = ( x = 40000 ) -25536 -25536
+y = ( x += 40000 ) -25526 -25526
+y = ( x -= 40000 ) 25546 25546
+y = ( x /= 40000 ) 0 0
+y = ( x %= 40000 ) 10 10
+y = ( x *= 40000 ) 6784 6784
+y = ( x &= 40000 ) 0 0
+y = ( x |= 40000 ) -25526 -25526
+y = ( x ^= 40000 ) -25526 -25526
+y = ( x <<= 9 ) 5120 5120
+y = ( x >>= 9 ) 0 0
+y = ( x ++ ) 11 10
+y = ( x -- ) 9 10
+y = ( -- x ) 9 9
+y = ( ++ x ) 11 11
+yes if ( 40000 + 8012 ) yes() ; else no()
+yes if ( 40000 - 8012 ) yes() ; else no()
+yes if ( 40000 / 8012 ) yes() ; else no()
+yes if ( 40000 % 8012 ) yes() ; else no()
+yes if ( 40000 * 8012 ) yes() ; else no()
+yes if ( 40000 & 8012 ) yes() ; else no()
+yes if ( 40000 | 8012 ) yes() ; else no()
+yes if ( 40000 ^ 8012 ) yes() ; else no()
+yes if ( 40000 || 8012 ) yes() ; else no()
+yes if ( 40000 && 8012 ) yes() ; else no()
+yes if ( 40000 << 9 ) yes() ; else no()
+yes if ( 40000 >> 9 ) yes() ; else no()
+yes if ( -40000 ) yes() ; else no()
+no if ( !40000 ) yes() ; else no()
+yes if ( ~40000 ) yes() ; else no()
+no if ( 40000 == 8012 ) yes() ; else no()
+yes if ( 40000 != 8012 ) yes() ; else no()
+no if ( 40000 <= 8012 ) yes() ; else no()
+yes if ( 40000 >= 8012 ) yes() ; else no()
+no if ( 40000 < 8012 ) yes() ; else no()
+yes if ( 40000 > 8012 ) yes() ; else no()
+yes if ( 40000 ? 40000 : 8012 ) yes() ; else no()
+yes if ( x = 40000 ) yes() ; else no() -25536
+yes if ( x += 40000 ) yes() ; else no() -25526
+yes if ( x -= 40000 ) yes() ; else no() 25546
+no if ( x /= 40000 ) yes() ; else no() 0
+yes if ( x %= 40000 ) yes() ; else no() 10
+yes if ( x *= 40000 ) yes() ; else no() 6784
+no if ( x &= 40000 ) yes() ; else no() 0
+yes if ( x |= 40000 ) yes() ; else no() -25526
+yes if ( x ^= 40000 ) yes() ; else no() -25526
+yes if ( x <<= 9 ) yes() ; else no() 5120
+no if ( x >>= 9 ) yes() ; else no() 0
+yes if ( x ++ ) yes() ; else no() 11
+yes if ( x -- ) yes() ; else no() 9
+yes if ( -- x ) yes() ; else no() 9
+yes if ( ++ x ) yes() ; else no() 11
--- /dev/null
+1i\
+ /* ops is converted into a test program for longs \
+*/
+/ISTART/d
+s/FN/main/
+/LSTART/c\
+ unsigned x=40234 , y= 301 ;
+/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
+/Z1/s/#/ %d&/
+/Z1/s/@/, Z1&/
+/Z2/s/#/ %d&/
+/Z2/s/@/, Z2&/
+/Z1/s/^/Z1 = 10 ; /
+/Z2/s/^/Z2 = 0100 ; /
+/[XYZS]/s/^/ /
+s/X/40000/g
+s/Y/8012/g
+s/S/9/g
+s/Z1/x/g
+s/Z2/y/g
+s/#/\\n/
+s/@//
--- /dev/null
+'0' + '1'
+'0' - '1'
+'0' / '1'
+'0' % '1'
+'0' * '1'
+'0' & '1'
+'0' | '1'
+'0' ^ '1'
+'0' || '1'
+'0' && '1'
+'0' << 4
+'0' >> 4
+-'0'
+!'0'
+~'0'
+'0' == '1'
+'0' != '1'
+'0' <= '1'
+'0' >= '1'
+'0' < '1'
+'0' > '1'
+'0' ? '0' : '1'
+x = '0' 48
+x += '0' 58
+x -= '0' 218
+x /= '0' 0
+x %= '0' 10
+x *= '0' 224
+x &= '0' 0
+x |= '0' 58
+x ^= '0' 58
+x <<= 4 160
+x >>= 4 0
+x ++ 11
+x -- 9
+-- x 9
+++ x 11
+y = ( '0' + '1' ) 97
+y = ( '0' - '1' ) 255
+y = ( '0' / '1' ) 0
+y = ( '0' % '1' ) 48
+y = ( '0' * '1' ) 48
+y = ( '0' & '1' ) 48
+y = ( '0' | '1' ) 49
+y = ( '0' ^ '1' ) 1
+y = ( '0' || '1' ) 1
+y = ( '0' && '1' ) 1
+y = ( '0' << 4 ) 0
+y = ( '0' >> 4 ) 3
+y = ( -'0' ) 208
+y = ( !'0' ) 0
+y = ( ~'0' ) 207
+y = ( '0' == '1' ) 0
+y = ( '0' != '1' ) 1
+y = ( '0' <= '1' ) 1
+y = ( '0' >= '1' ) 0
+y = ( '0' < '1' ) 1
+y = ( '0' > '1' ) 0
+y = ( '0' ? '0' : '1' ) 48
+y = ( x = '0' ) 48 48
+y = ( x += '0' ) 58 58
+y = ( x -= '0' ) 218 218
+y = ( x /= '0' ) 0 0
+y = ( x %= '0' ) 10 10
+y = ( x *= '0' ) 224 224
+y = ( x &= '0' ) 0 0
+y = ( x |= '0' ) 58 58
+y = ( x ^= '0' ) 58 58
+y = ( x <<= 4 ) 160 160
+y = ( x >>= 4 ) 0 0
+y = ( x ++ ) 11 10
+y = ( x -- ) 9 10
+y = ( -- x ) 9 9
+y = ( ++ x ) 11 11
+yes if ( '0' + '1' ) yes() ; else no()
+yes if ( '0' - '1' ) yes() ; else no()
+no if ( '0' / '1' ) yes() ; else no()
+yes if ( '0' % '1' ) yes() ; else no()
+yes if ( '0' * '1' ) yes() ; else no()
+yes if ( '0' & '1' ) yes() ; else no()
+yes if ( '0' | '1' ) yes() ; else no()
+yes if ( '0' ^ '1' ) yes() ; else no()
+yes if ( '0' || '1' ) yes() ; else no()
+yes if ( '0' && '1' ) yes() ; else no()
+yes if ( '0' << 4 ) yes() ; else no()
+yes if ( '0' >> 4 ) yes() ; else no()
+yes if ( -'0' ) yes() ; else no()
+no if ( !'0' ) yes() ; else no()
+yes if ( ~'0' ) yes() ; else no()
+no if ( '0' == '1' ) yes() ; else no()
+yes if ( '0' != '1' ) yes() ; else no()
+yes if ( '0' <= '1' ) yes() ; else no()
+no if ( '0' >= '1' ) yes() ; else no()
+yes if ( '0' < '1' ) yes() ; else no()
+no if ( '0' > '1' ) yes() ; else no()
+yes if ( '0' ? '0' : '1' ) yes() ; else no()
+yes if ( x = '0' ) yes() ; else no() 48
+yes if ( x += '0' ) yes() ; else no() 58
+yes if ( x -= '0' ) yes() ; else no() 218
+no if ( x /= '0' ) yes() ; else no() 0
+yes if ( x %= '0' ) yes() ; else no() 10
+yes if ( x *= '0' ) yes() ; else no() 224
+no if ( x &= '0' ) yes() ; else no() 0
+yes if ( x |= '0' ) yes() ; else no() 58
+yes if ( x ^= '0' ) yes() ; else no() 58
+yes if ( x <<= 4 ) yes() ; else no() 160
+no if ( x >>= 4 ) yes() ; else no() 0
+yes if ( x ++ ) yes() ; else no() 11
+yes if ( x -- ) yes() ; else no() 9
+yes if ( -- x ) yes() ; else no() 9
+yes if ( ++ x ) yes() ; else no() 11
--- /dev/null
+1i\
+ /* ops is converted into a test program for local characters \
+*/
+/LSTART/d
+s/FN/main/
+/ISTART/c\
+ char x=10 , y= 0100 ;
+/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
+/Z1/s/#/ %d&/
+/Z1/s/@/, Z1&/
+/Z2/s/#/ %d&/
+/Z2/s/@/, Z2&/
+/Z1/s/^/Z1 = 10 ; /
+/Z2/s/^/Z2 = 0100 ; /
+/[XYZS]/s/^/ /
+s/X/'0'/g
+s/Y/'1'/g
+s/S/4/g
+s/Z1/x/g
+s/Z2/y/g
+s/#/\\n/
+s/@//
--- /dev/null
+.4e-5 + .3e-5
+.4e-5 - .3e-5
+.4e-5 / .3e-5
+.4e-5 * .3e-5
+.4e-5 || .3e-5
+.4e-5 && .3e-5
+-.4e-5
+!.4e-5
+.4e-5 == .3e-5
+.4e-5 != .3e-5
+.4e-5 <= .3e-5
+.4e-5 >= .3e-5
+.4e-5 < .3e-5
+.4e-5 > .3e-5
+.4e-5 ? .4e-5 : .3e-5
+x = .4e-5 4.000000e-06
+x += .4e-5 3.141504e+00
+x -= .4e-5 3.141496e+00
+x /= .4e-5 7.853750e+05
+x *= .4e-5 1.256600e-05
+x ++ 4.141500e+00
+x -- 2.141500e+00
+-- x 2.141500e+00
+++ x 4.141500e+00
+y = ( .4e-5 + .3e-5 ) 7.000000e-06
+y = ( .4e-5 - .3e-5 ) 1.000000e-06
+y = ( .4e-5 / .3e-5 ) 1.333333e+00
+y = ( .4e-5 * .3e-5 ) 1.200000e-11
+y = ( .4e-5 || .3e-5 ) 1.000000e+00
+y = ( .4e-5 && .3e-5 ) 1.000000e+00
+y = ( -.4e-5 ) -4.000000e-06
+y = ( !.4e-5 ) 0.000000e+00
+y = ( .4e-5 == .3e-5 ) 0.000000e+00
+y = ( .4e-5 != .3e-5 ) 1.000000e+00
+y = ( .4e-5 <= .3e-5 ) 0.000000e+00
+y = ( .4e-5 >= .3e-5 ) 1.000000e+00
+y = ( .4e-5 < .3e-5 ) 0.000000e+00
+y = ( .4e-5 > .3e-5 ) 1.000000e+00
+y = ( .4e-5 ? .4e-5 : .3e-5 ) 4.000000e-06
+y = ( x = .4e-5 ) 4.000000e-06 4.000000e-06
+y = ( x += .4e-5 ) 3.141504e+00 3.141504e+00
+y = ( x -= .4e-5 ) 3.141496e+00 3.141496e+00
+y = ( x /= .4e-5 ) 7.853750e+05 7.853750e+05
+y = ( x *= .4e-5 ) 1.256600e-05 1.256600e-05
+y = ( x ++ ) 4.141500e+00 3.141500e+00
+y = ( x -- ) 2.141500e+00 3.141500e+00
+y = ( -- x ) 2.141500e+00 2.141500e+00
+y = ( ++ x ) 4.141500e+00 4.141500e+00
+yes if ( .4e-5 + .3e-5 ) yes() ; else no()
+yes if ( .4e-5 - .3e-5 ) yes() ; else no()
+yes if ( .4e-5 / .3e-5 ) yes() ; else no()
+yes if ( .4e-5 * .3e-5 ) yes() ; else no()
+yes if ( .4e-5 || .3e-5 ) yes() ; else no()
+yes if ( .4e-5 && .3e-5 ) yes() ; else no()
+yes if ( -.4e-5 ) yes() ; else no()
+no if ( !.4e-5 ) yes() ; else no()
+no if ( .4e-5 == .3e-5 ) yes() ; else no()
+yes if ( .4e-5 != .3e-5 ) yes() ; else no()
+no if ( .4e-5 <= .3e-5 ) yes() ; else no()
+yes if ( .4e-5 >= .3e-5 ) yes() ; else no()
+no if ( .4e-5 < .3e-5 ) yes() ; else no()
+yes if ( .4e-5 > .3e-5 ) yes() ; else no()
+yes if ( .4e-5 ? .4e-5 : .3e-5 ) yes() ; else no()
+yes if ( x = .4e-5 ) yes() ; else no() 4.000000e-06
+yes if ( x += .4e-5 ) yes() ; else no() 3.141504e+00
+yes if ( x -= .4e-5 ) yes() ; else no() 3.141496e+00
+yes if ( x /= .4e-5 ) yes() ; else no() 7.853750e+05
+yes if ( x *= .4e-5 ) yes() ; else no() 1.256600e-05
+yes if ( x ++ ) yes() ; else no() 4.141500e+00
+yes if ( x -- ) yes() ; else no() 2.141500e+00
+yes if ( -- x ) yes() ; else no() 2.141500e+00
+yes if ( ++ x ) yes() ; else no() 4.141500e+00
--- /dev/null
+/LSTART/d
+s/FN/main/
+/ISTART/c\
+ float x=3.1415 , y= 1e-7 ;
+/[^&]& /d
+/[^|]| /d
+/>>/d
+/<</d
+/%/d
+/\^/d
+/~/d
+/&=/d
+/|=/d
+/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
+/Z1/s/#/ %e&/
+/Z1/s/@/, Z1&/
+/Z2/s/#/ %e&/
+/Z2/s/@/, Z2&/
+/Z1/s/^/Z1 = 3.1415 ; /
+/Z2/s/^/Z2 = 1e-7 ; /
+/[XYZS]/s/^/ /
+s/X/.4e-5/g
+s/Y/.3e-5/g
+s/Z1/x/g
+s/Z2/y/g
+s/#/\\n/
+s/@//
--- /dev/null
+4 + 5
+4 - 5
+4 / 5
+4 % 5
+4 * 5
+4 & 5
+4 | 5
+4 ^ 5
+4 || 5
+4 && 5
+4 << 15
+4 >> 15
+-4
+!4
+~4
+4 == 5
+4 != 5
+4 <= 5
+4 >= 5
+4 < 5
+4 > 5
+4 ? 4 : 5
+x = 4 4
+x += 4 259
+x -= 4 251
+x /= 4 63
+x %= 4 3
+x *= 4 1020
+x &= 4 4
+x |= 4 255
+x ^= 4 251
+x <<= 15 -32768
+x >>= 15 0
+x ++ 256
+x -- 254
+-- x 254
+++ x 256
+y = ( 4 + 5 ) 9
+y = ( 4 - 5 ) -1
+y = ( 4 / 5 ) 0
+y = ( 4 % 5 ) 4
+y = ( 4 * 5 ) 20
+y = ( 4 & 5 ) 4
+y = ( 4 | 5 ) 5
+y = ( 4 ^ 5 ) 1
+y = ( 4 || 5 ) 1
+y = ( 4 && 5 ) 1
+y = ( 4 << 15 ) 0
+y = ( 4 >> 15 ) 0
+y = ( -4 ) -4
+y = ( !4 ) 0
+y = ( ~4 ) -5
+y = ( 4 == 5 ) 0
+y = ( 4 != 5 ) 1
+y = ( 4 <= 5 ) 1
+y = ( 4 >= 5 ) 0
+y = ( 4 < 5 ) 1
+y = ( 4 > 5 ) 0
+y = ( 4 ? 4 : 5 ) 4
+y = ( x = 4 ) 4 4
+y = ( x += 4 ) 259 259
+y = ( x -= 4 ) 251 251
+y = ( x /= 4 ) 63 63
+y = ( x %= 4 ) 3 3
+y = ( x *= 4 ) 1020 1020
+y = ( x &= 4 ) 4 4
+y = ( x |= 4 ) 255 255
+y = ( x ^= 4 ) 251 251
+y = ( x <<= 15 ) -32768 -32768
+y = ( x >>= 15 ) 0 0
+y = ( x ++ ) 256 255
+y = ( x -- ) 254 255
+y = ( -- x ) 254 254
+y = ( ++ x ) 256 256
+yes if ( 4 + 5 ) yes() ; else no()
+yes if ( 4 - 5 ) yes() ; else no()
+no if ( 4 / 5 ) yes() ; else no()
+yes if ( 4 % 5 ) yes() ; else no()
+yes if ( 4 * 5 ) yes() ; else no()
+yes if ( 4 & 5 ) yes() ; else no()
+yes if ( 4 | 5 ) yes() ; else no()
+yes if ( 4 ^ 5 ) yes() ; else no()
+yes if ( 4 || 5 ) yes() ; else no()
+yes if ( 4 && 5 ) yes() ; else no()
+no if ( 4 << 15 ) yes() ; else no()
+no if ( 4 >> 15 ) yes() ; else no()
+yes if ( -4 ) yes() ; else no()
+no if ( !4 ) yes() ; else no()
+yes if ( ~4 ) yes() ; else no()
+no if ( 4 == 5 ) yes() ; else no()
+yes if ( 4 != 5 ) yes() ; else no()
+yes if ( 4 <= 5 ) yes() ; else no()
+no if ( 4 >= 5 ) yes() ; else no()
+yes if ( 4 < 5 ) yes() ; else no()
+no if ( 4 > 5 ) yes() ; else no()
+yes if ( 4 ? 4 : 5 ) yes() ; else no()
+yes if ( x = 4 ) yes() ; else no() 4
+yes if ( x += 4 ) yes() ; else no() 259
+yes if ( x -= 4 ) yes() ; else no() 251
+yes if ( x /= 4 ) yes() ; else no() 63
+yes if ( x %= 4 ) yes() ; else no() 3
+yes if ( x *= 4 ) yes() ; else no() 1020
+yes if ( x &= 4 ) yes() ; else no() 4
+yes if ( x |= 4 ) yes() ; else no() 255
+yes if ( x ^= 4 ) yes() ; else no() 251
+yes if ( x <<= 15 ) yes() ; else no() -32768
+no if ( x >>= 15 ) yes() ; else no() 0
+yes if ( x ++ ) yes() ; else no() 256
+yes if ( x -- ) yes() ; else no() 254
+yes if ( -- x ) yes() ; else no() 254
+yes if ( ++ x ) yes() ; else no() 256
--- /dev/null
+1i\
+/* A sample sed script to show the use of the 'ops' file.\
+ ops is converted into a test program for local integers \
+*/
+/LSTART/d
+s/FN/main/
+/ISTART/c\
+ int x=255 , y= -256 ;
+/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
+/Z1/s/#/ %d&/
+/Z1/s/@/, Z1&/
+/Z2/s/#/ %d&/
+/Z2/s/@/, Z2&/
+/Z1/s/^/Z1 = 255 ; /
+/Z2/s/^/Z2 = 255 ; /
+/[XYZS]/s/^/ /
+s/X/4/g
+s/Y/5/g
+s/S/15/g
+s/Z1/x/g
+s/Z2/y/g
+s/#/\\n/
+s/@//
--- /dev/null
+x + 16329
+x - 16329
+x / 16329
+x % 16329
+x * 16329
+x & 16329
+x | 16329
+x ^ 16329
+x || 16329
+x && 16329
+x << 9
+x >> 9
+-x
+!x
+~x
+x == 16329
+x != 16329
+x <= 16329
+x >= 16329
+x < 16329
+x > 16329
+x ? x : 16329
+z = x 100234
+z += x 100244
+z -= x -100224
+z /= x 0
+z %= x 10
+z *= x 1002340
+z &= x 10
+z |= x 100234
+z ^= x 100224
+z <<= 9 5120
+z >>= 9 0
+z ++ 11
+z -- 9
+-- z 9
+++ z 11
+y = ( x + 16329 ) 116563
+y = ( x - 16329 ) 83905
+y = ( x / 16329 ) 6
+y = ( x % 16329 ) 2260
+y = ( x * 16329 ) 1636720986
+y = ( x & 16329 ) 1928
+y = ( x | 16329 ) 114635
+y = ( x ^ 16329 ) 112707
+y = ( x || 16329 ) 1
+y = ( x && 16329 ) 1
+y = ( x << 9 ) 51319808
+y = ( x >> 9 ) 195
+y = ( -x ) -100234
+y = ( !x ) 0
+y = ( ~x ) -100235
+y = ( x == 16329 ) 0
+y = ( x != 16329 ) 1
+y = ( x <= 16329 ) 0
+y = ( x >= 16329 ) 1
+y = ( x < 16329 ) 0
+y = ( x > 16329 ) 1
+y = ( x ? x : 16329 ) 100234
+y = ( z = x ) 100234 100234
+y = ( z += x ) 100244 100244
+y = ( z -= x ) -100224 -100224
+y = ( z /= x ) 0 0
+y = ( z %= x ) 10 10
+y = ( z *= x ) 1002340 1002340
+y = ( z &= x ) 10 10
+y = ( z |= x ) 100234 100234
+y = ( z ^= x ) 100224 100224
+y = ( z <<= 9 ) 5120 5120
+y = ( z >>= 9 ) 0 0
+y = ( z ++ ) 11 10
+y = ( z -- ) 9 10
+y = ( -- z ) 9 9
+y = ( ++ z ) 11 11
+yes if ( x + 16329 ) yes() ; else no()
+yes if ( x - 16329 ) yes() ; else no()
+yes if ( x / 16329 ) yes() ; else no()
+yes if ( x % 16329 ) yes() ; else no()
+yes if ( x * 16329 ) yes() ; else no()
+yes if ( x & 16329 ) yes() ; else no()
+yes if ( x | 16329 ) yes() ; else no()
+yes if ( x ^ 16329 ) yes() ; else no()
+yes if ( x || 16329 ) yes() ; else no()
+yes if ( x && 16329 ) yes() ; else no()
+yes if ( x << 9 ) yes() ; else no()
+yes if ( x >> 9 ) yes() ; else no()
+yes if ( -x ) yes() ; else no()
+no if ( !x ) yes() ; else no()
+yes if ( ~x ) yes() ; else no()
+no if ( x == 16329 ) yes() ; else no()
+yes if ( x != 16329 ) yes() ; else no()
+no if ( x <= 16329 ) yes() ; else no()
+yes if ( x >= 16329 ) yes() ; else no()
+no if ( x < 16329 ) yes() ; else no()
+yes if ( x > 16329 ) yes() ; else no()
+yes if ( x ? x : 16329 ) yes() ; else no()
+yes if ( z = x ) yes() ; else no() 100234
+yes if ( z += x ) yes() ; else no() 100244
+yes if ( z -= x ) yes() ; else no() -100224
+no if ( z /= x ) yes() ; else no() 0
+yes if ( z %= x ) yes() ; else no() 10
+yes if ( z *= x ) yes() ; else no() 1002340
+yes if ( z &= x ) yes() ; else no() 10
+yes if ( z |= x ) yes() ; else no() 100234
+yes if ( z ^= x ) yes() ; else no() 100224
+yes if ( z <<= 9 ) yes() ; else no() 5120
+no if ( z >>= 9 ) yes() ; else no() 0
+yes if ( z ++ ) yes() ; else no() 11
+yes if ( z -- ) yes() ; else no() 9
+yes if ( -- z ) yes() ; else no() 9
+yes if ( ++ z ) yes() ; else no() 11
--- /dev/null
+1i\
+ /* ops is converted into a test program for longs \
+*/
+/LSTART/d
+s/FN/main/
+/ISTART/c\
+ long x=100234 , y= -301 , z= 0 ;
+/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
+/Z1/s/#/ %D&/
+/Z1/s/@/, Z1&/
+/Z2/s/#/ %D&/
+/Z2/s/@/, Z2&/
+/Z1/s/^/Z1 = 10 ; /
+/Z2/s/^/Z2 = 0100 ; /
+/[XYZS]/s/^/ /
+s/X/x/g
+s/Y/16329/g
+s/S/9/g
+s/Z1/z/g
+s/Z2/y/g
+s/#/\\n/
+s/@//
--- /dev/null
+40000 + 8012
+40000 - 8012
+40000 / 8012
+40000 % 8012
+40000 * 8012
+40000 & 8012
+40000 | 8012
+40000 ^ 8012
+40000 || 8012
+40000 && 8012
+40000 << 9
+40000 >> 9
+-40000
+!40000
+~40000
+40000 == 8012
+40000 != 8012
+40000 <= 8012
+40000 >= 8012
+40000 < 8012
+40000 > 8012
+40000 ? 40000 : 8012
+x = 40000 -25536
+x += 40000 -25526
+x -= 40000 25546
+x /= 40000 0
+x %= 40000 10
+x *= 40000 6784
+x &= 40000 0
+x |= 40000 -25526
+x ^= 40000 -25526
+x <<= 9 5120
+x >>= 9 0
+x ++ 11
+x -- 9
+-- x 9
+++ x 11
+y = ( 40000 + 8012 ) -17524
+y = ( 40000 - 8012 ) 31988
+y = ( 40000 / 8012 ) 4
+y = ( 40000 % 8012 ) 7952
+y = ( 40000 * 8012 ) 8960
+y = ( 40000 & 8012 ) 7232
+y = ( 40000 | 8012 ) -24756
+y = ( 40000 ^ 8012 ) -31988
+y = ( 40000 || 8012 ) 1
+y = ( 40000 && 8012 ) 1
+y = ( 40000 << 9 ) -32768
+y = ( 40000 >> 9 ) 78
+y = ( -40000 ) 25536
+y = ( !40000 ) 0
+y = ( ~40000 ) 25535
+y = ( 40000 == 8012 ) 0
+y = ( 40000 != 8012 ) 1
+y = ( 40000 <= 8012 ) 0
+y = ( 40000 >= 8012 ) 1
+y = ( 40000 < 8012 ) 0
+y = ( 40000 > 8012 ) 1
+y = ( 40000 ? 40000 : 8012 ) -25536
+y = ( x = 40000 ) -25536 -25536
+y = ( x += 40000 ) -25526 -25526
+y = ( x -= 40000 ) 25546 25546
+y = ( x /= 40000 ) 0 0
+y = ( x %= 40000 ) 10 10
+y = ( x *= 40000 ) 6784 6784
+y = ( x &= 40000 ) 0 0
+y = ( x |= 40000 ) -25526 -25526
+y = ( x ^= 40000 ) -25526 -25526
+y = ( x <<= 9 ) 5120 5120
+y = ( x >>= 9 ) 0 0
+y = ( x ++ ) 11 10
+y = ( x -- ) 9 10
+y = ( -- x ) 9 9
+y = ( ++ x ) 11 11
+yes if ( 40000 + 8012 ) yes() ; else no()
+yes if ( 40000 - 8012 ) yes() ; else no()
+yes if ( 40000 / 8012 ) yes() ; else no()
+yes if ( 40000 % 8012 ) yes() ; else no()
+yes if ( 40000 * 8012 ) yes() ; else no()
+yes if ( 40000 & 8012 ) yes() ; else no()
+yes if ( 40000 | 8012 ) yes() ; else no()
+yes if ( 40000 ^ 8012 ) yes() ; else no()
+yes if ( 40000 || 8012 ) yes() ; else no()
+yes if ( 40000 && 8012 ) yes() ; else no()
+yes if ( 40000 << 9 ) yes() ; else no()
+yes if ( 40000 >> 9 ) yes() ; else no()
+yes if ( -40000 ) yes() ; else no()
+no if ( !40000 ) yes() ; else no()
+yes if ( ~40000 ) yes() ; else no()
+no if ( 40000 == 8012 ) yes() ; else no()
+yes if ( 40000 != 8012 ) yes() ; else no()
+no if ( 40000 <= 8012 ) yes() ; else no()
+yes if ( 40000 >= 8012 ) yes() ; else no()
+no if ( 40000 < 8012 ) yes() ; else no()
+yes if ( 40000 > 8012 ) yes() ; else no()
+yes if ( 40000 ? 40000 : 8012 ) yes() ; else no()
+yes if ( x = 40000 ) yes() ; else no() -25536
+yes if ( x += 40000 ) yes() ; else no() -25526
+yes if ( x -= 40000 ) yes() ; else no() 25546
+no if ( x /= 40000 ) yes() ; else no() 0
+yes if ( x %= 40000 ) yes() ; else no() 10
+yes if ( x *= 40000 ) yes() ; else no() 6784
+no if ( x &= 40000 ) yes() ; else no() 0
+yes if ( x |= 40000 ) yes() ; else no() -25526
+yes if ( x ^= 40000 ) yes() ; else no() -25526
+yes if ( x <<= 9 ) yes() ; else no() 5120
+no if ( x >>= 9 ) yes() ; else no() 0
+yes if ( x ++ ) yes() ; else no() 11
+yes if ( x -- ) yes() ; else no() 9
+yes if ( -- x ) yes() ; else no() 9
+yes if ( ++ x ) yes() ; else no() 11
--- /dev/null
+1i\
+ /* ops is converted into a test program for longs \
+*/
+/LSTART/d
+s/FN/main/
+/ISTART/c\
+ unsigned x=40234 , y= 301 ;
+/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
+/Z1/s/#/ %d&/
+/Z1/s/@/, Z1&/
+/Z2/s/#/ %d&/
+/Z2/s/@/, Z2&/
+/Z1/s/^/Z1 = 10 ; /
+/Z2/s/^/Z2 = 0100 ; /
+/[XYZS]/s/^/ /
+s/X/40000/g
+s/Y/8012/g
+s/S/9/g
+s/Z1/x/g
+s/Z2/y/g
+s/#/\\n/
+s/@//
--- /dev/null
+'0' + '1'
+'0' - '1'
+'0' / '1'
+'0' % '1'
+'0' * '1'
+'0' & '1'
+'0' | '1'
+'0' ^ '1'
+'0' || '1'
+'0' && '1'
+'0' << 4
+'0' >> 4
+-'0'
+!'0'
+~'0'
+'0' == '1'
+'0' != '1'
+'0' <= '1'
+'0' >= '1'
+'0' < '1'
+'0' > '1'
+'0' ? '0' : '1'
+x = '0' 48
+x += '0' 58
+x -= '0' 218
+x /= '0' 0
+x %= '0' 10
+x *= '0' 224
+x &= '0' 0
+x |= '0' 58
+x ^= '0' 58
+x <<= 4 160
+x >>= 4 0
+x ++ 11
+x -- 9
+-- x 9
+++ x 11
+y = ( '0' + '1' ) 97
+y = ( '0' - '1' ) 255
+y = ( '0' / '1' ) 0
+y = ( '0' % '1' ) 48
+y = ( '0' * '1' ) 48
+y = ( '0' & '1' ) 48
+y = ( '0' | '1' ) 49
+y = ( '0' ^ '1' ) 1
+y = ( '0' || '1' ) 1
+y = ( '0' && '1' ) 1
+y = ( '0' << 4 ) 0
+y = ( '0' >> 4 ) 3
+y = ( -'0' ) 208
+y = ( !'0' ) 0
+y = ( ~'0' ) 207
+y = ( '0' == '1' ) 0
+y = ( '0' != '1' ) 1
+y = ( '0' <= '1' ) 1
+y = ( '0' >= '1' ) 0
+y = ( '0' < '1' ) 1
+y = ( '0' > '1' ) 0
+y = ( '0' ? '0' : '1' ) 48
+y = ( x = '0' ) 48 48
+y = ( x += '0' ) 58 58
+y = ( x -= '0' ) 218 218
+y = ( x /= '0' ) 0 0
+y = ( x %= '0' ) 10 10
+y = ( x *= '0' ) 224 224
+y = ( x &= '0' ) 0 0
+y = ( x |= '0' ) 58 58
+y = ( x ^= '0' ) 58 58
+y = ( x <<= 4 ) 160 160
+y = ( x >>= 4 ) 0 0
+y = ( x ++ ) 11 10
+y = ( x -- ) 9 10
+y = ( -- x ) 9 9
+y = ( ++ x ) 11 11
+yes if ( '0' + '1' ) yes() ; else no()
+yes if ( '0' - '1' ) yes() ; else no()
+no if ( '0' / '1' ) yes() ; else no()
+yes if ( '0' % '1' ) yes() ; else no()
+yes if ( '0' * '1' ) yes() ; else no()
+yes if ( '0' & '1' ) yes() ; else no()
+yes if ( '0' | '1' ) yes() ; else no()
+yes if ( '0' ^ '1' ) yes() ; else no()
+yes if ( '0' || '1' ) yes() ; else no()
+yes if ( '0' && '1' ) yes() ; else no()
+yes if ( '0' << 4 ) yes() ; else no()
+yes if ( '0' >> 4 ) yes() ; else no()
+yes if ( -'0' ) yes() ; else no()
+no if ( !'0' ) yes() ; else no()
+yes if ( ~'0' ) yes() ; else no()
+no if ( '0' == '1' ) yes() ; else no()
+yes if ( '0' != '1' ) yes() ; else no()
+yes if ( '0' <= '1' ) yes() ; else no()
+no if ( '0' >= '1' ) yes() ; else no()
+yes if ( '0' < '1' ) yes() ; else no()
+no if ( '0' > '1' ) yes() ; else no()
+yes if ( '0' ? '0' : '1' ) yes() ; else no()
+yes if ( x = '0' ) yes() ; else no() 48
+yes if ( x += '0' ) yes() ; else no() 58
+yes if ( x -= '0' ) yes() ; else no() 218
+no if ( x /= '0' ) yes() ; else no() 0
+yes if ( x %= '0' ) yes() ; else no() 10
+yes if ( x *= '0' ) yes() ; else no() 224
+no if ( x &= '0' ) yes() ; else no() 0
+yes if ( x |= '0' ) yes() ; else no() 58
+yes if ( x ^= '0' ) yes() ; else no() 58
+yes if ( x <<= 4 ) yes() ; else no() 160
+no if ( x >>= 4 ) yes() ; else no() 0
+yes if ( x ++ ) yes() ; else no() 11
+yes if ( x -- ) yes() ; else no() 9
+yes if ( -- x ) yes() ; else no() 9
+yes if ( ++ x ) yes() ; else no() 11
--- /dev/null
+1i\
+ /* ops is converted into a test program for local characters \
+*/
+/ISTART/d
+s/FN/main/
+/LSTART/c\
+ char x=10 , y= 0100 ;
+/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
+/Z1/s/#/ %d&/
+/Z1/s/@/, Z1&/
+/Z2/s/#/ %d&/
+/Z2/s/@/, Z2&/
+/Z1/s/^/Z1 = 10 ; /
+/Z2/s/^/Z2 = 0100 ; /
+/[XYZS]/s/^/ /
+s/X/'0'/g
+s/Y/'1'/g
+s/S/4/g
+s/Z1/x/g
+s/Z2/y/g
+s/#/\\n/
+s/@//
--- /dev/null
+.4e-5 + .3e-5
+.4e-5 - .3e-5
+.4e-5 / .3e-5
+.4e-5 * .3e-5
+.4e-5 || .3e-5
+.4e-5 && .3e-5
+-.4e-5
+!.4e-5
+.4e-5 == .3e-5
+.4e-5 != .3e-5
+.4e-5 <= .3e-5
+.4e-5 >= .3e-5
+.4e-5 < .3e-5
+.4e-5 > .3e-5
+.4e-5 ? .4e-5 : .3e-5
+x = .4e-5 4.000000e-06
+x += .4e-5 3.141504e+00
+x -= .4e-5 3.141496e+00
+x /= .4e-5 7.853750e+05
+x *= .4e-5 1.256600e-05
+x ++ 4.141500e+00
+x -- 2.141500e+00
+-- x 2.141500e+00
+++ x 4.141500e+00
+y = ( .4e-5 + .3e-5 ) 7.000000e-06
+y = ( .4e-5 - .3e-5 ) 1.000000e-06
+y = ( .4e-5 / .3e-5 ) 1.333333e+00
+y = ( .4e-5 * .3e-5 ) 1.200000e-11
+y = ( .4e-5 || .3e-5 ) 1.000000e+00
+y = ( .4e-5 && .3e-5 ) 1.000000e+00
+y = ( -.4e-5 ) -4.000000e-06
+y = ( !.4e-5 ) 0.000000e+00
+y = ( .4e-5 == .3e-5 ) 0.000000e+00
+y = ( .4e-5 != .3e-5 ) 1.000000e+00
+y = ( .4e-5 <= .3e-5 ) 0.000000e+00
+y = ( .4e-5 >= .3e-5 ) 1.000000e+00
+y = ( .4e-5 < .3e-5 ) 0.000000e+00
+y = ( .4e-5 > .3e-5 ) 1.000000e+00
+y = ( .4e-5 ? .4e-5 : .3e-5 ) 4.000000e-06
+y = ( x = .4e-5 ) 4.000000e-06 4.000000e-06
+y = ( x += .4e-5 ) 3.141504e+00 3.141504e+00
+y = ( x -= .4e-5 ) 3.141496e+00 3.141496e+00
+y = ( x /= .4e-5 ) 7.853750e+05 7.853750e+05
+y = ( x *= .4e-5 ) 1.256600e-05 1.256600e-05
+y = ( x ++ ) 4.141500e+00 3.141500e+00
+y = ( x -- ) 2.141500e+00 3.141500e+00
+y = ( -- x ) 2.141500e+00 2.141500e+00
+y = ( ++ x ) 4.141500e+00 4.141500e+00
+yes if ( .4e-5 + .3e-5 ) yes() ; else no()
+yes if ( .4e-5 - .3e-5 ) yes() ; else no()
+yes if ( .4e-5 / .3e-5 ) yes() ; else no()
+yes if ( .4e-5 * .3e-5 ) yes() ; else no()
+yes if ( .4e-5 || .3e-5 ) yes() ; else no()
+yes if ( .4e-5 && .3e-5 ) yes() ; else no()
+yes if ( -.4e-5 ) yes() ; else no()
+no if ( !.4e-5 ) yes() ; else no()
+no if ( .4e-5 == .3e-5 ) yes() ; else no()
+yes if ( .4e-5 != .3e-5 ) yes() ; else no()
+no if ( .4e-5 <= .3e-5 ) yes() ; else no()
+yes if ( .4e-5 >= .3e-5 ) yes() ; else no()
+no if ( .4e-5 < .3e-5 ) yes() ; else no()
+yes if ( .4e-5 > .3e-5 ) yes() ; else no()
+yes if ( .4e-5 ? .4e-5 : .3e-5 ) yes() ; else no()
+yes if ( x = .4e-5 ) yes() ; else no() 4.000000e-06
+yes if ( x += .4e-5 ) yes() ; else no() 3.141504e+00
+yes if ( x -= .4e-5 ) yes() ; else no() 3.141496e+00
+yes if ( x /= .4e-5 ) yes() ; else no() 7.853750e+05
+yes if ( x *= .4e-5 ) yes() ; else no() 1.256600e-05
+yes if ( x ++ ) yes() ; else no() 4.141500e+00
+yes if ( x -- ) yes() ; else no() 2.141500e+00
+yes if ( -- x ) yes() ; else no() 2.141500e+00
+yes if ( ++ x ) yes() ; else no() 4.141500e+00
--- /dev/null
+/LSTART/d
+s/FN/main/
+/ISTART/c\
+ double x=3.1415 , y= 1e-7 ;
+/[^&]& /d
+/[^|]| /d
+/>>/d
+/<</d
+/%/d
+/\^/d
+/~/d
+/&=/d
+/|=/d
+/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
+/Z1/s/#/ %e&/
+/Z1/s/@/, Z1&/
+/Z2/s/#/ %e&/
+/Z2/s/@/, Z2&/
+/Z1/s/^/Z1 = 3.1415 ; /
+/Z2/s/^/Z2 = 1e-7 ; /
+/[XYZS]/s/^/ /
+s/X/.4e-5/g
+s/Y/.3e-5/g
+s/Z1/x/g
+s/Z2/y/g
+s/#/\\n/
+s/@//
--- /dev/null
+.4e-5 + .3e-5
+.4e-5 - .3e-5
+.4e-5 / .3e-5
+.4e-5 * .3e-5
+.4e-5 || .3e-5
+.4e-5 && .3e-5
+-.4e-5
+!.4e-5
+.4e-5 == .3e-5
+.4e-5 != .3e-5
+.4e-5 <= .3e-5
+.4e-5 >= .3e-5
+.4e-5 < .3e-5
+.4e-5 > .3e-5
+.4e-5 ? .4e-5 : .3e-5
+x = .4e-5 4.000000e-06
+x += .4e-5 3.141504e+00
+x -= .4e-5 3.141496e+00
+x /= .4e-5 7.853750e+05
+x *= .4e-5 1.256600e-05
+x ++ 4.141500e+00
+x -- 2.141500e+00
+-- x 2.141500e+00
+++ x 4.141500e+00
+y = ( .4e-5 + .3e-5 ) 7.000000e-06
+y = ( .4e-5 - .3e-5 ) 1.000000e-06
+y = ( .4e-5 / .3e-5 ) 1.333333e+00
+y = ( .4e-5 * .3e-5 ) 1.200000e-11
+y = ( .4e-5 || .3e-5 ) 1.000000e+00
+y = ( .4e-5 && .3e-5 ) 1.000000e+00
+y = ( -.4e-5 ) -4.000000e-06
+y = ( !.4e-5 ) 0.000000e+00
+y = ( .4e-5 == .3e-5 ) 0.000000e+00
+y = ( .4e-5 != .3e-5 ) 1.000000e+00
+y = ( .4e-5 <= .3e-5 ) 0.000000e+00
+y = ( .4e-5 >= .3e-5 ) 1.000000e+00
+y = ( .4e-5 < .3e-5 ) 0.000000e+00
+y = ( .4e-5 > .3e-5 ) 1.000000e+00
+y = ( .4e-5 ? .4e-5 : .3e-5 ) 4.000000e-06
+y = ( x = .4e-5 ) 4.000000e-06 4.000000e-06
+y = ( x += .4e-5 ) 3.141504e+00 3.141504e+00
+y = ( x -= .4e-5 ) 3.141496e+00 3.141496e+00
+y = ( x /= .4e-5 ) 7.853750e+05 7.853750e+05
+y = ( x *= .4e-5 ) 1.256600e-05 1.256600e-05
+y = ( x ++ ) 4.141500e+00 3.141500e+00
+y = ( x -- ) 2.141500e+00 3.141500e+00
+y = ( -- x ) 2.141500e+00 2.141500e+00
+y = ( ++ x ) 4.141500e+00 4.141500e+00
+yes if ( .4e-5 + .3e-5 ) yes() ; else no()
+yes if ( .4e-5 - .3e-5 ) yes() ; else no()
+yes if ( .4e-5 / .3e-5 ) yes() ; else no()
+yes if ( .4e-5 * .3e-5 ) yes() ; else no()
+yes if ( .4e-5 || .3e-5 ) yes() ; else no()
+yes if ( .4e-5 && .3e-5 ) yes() ; else no()
+yes if ( -.4e-5 ) yes() ; else no()
+no if ( !.4e-5 ) yes() ; else no()
+no if ( .4e-5 == .3e-5 ) yes() ; else no()
+yes if ( .4e-5 != .3e-5 ) yes() ; else no()
+no if ( .4e-5 <= .3e-5 ) yes() ; else no()
+yes if ( .4e-5 >= .3e-5 ) yes() ; else no()
+no if ( .4e-5 < .3e-5 ) yes() ; else no()
+yes if ( .4e-5 > .3e-5 ) yes() ; else no()
+yes if ( .4e-5 ? .4e-5 : .3e-5 ) yes() ; else no()
+yes if ( x = .4e-5 ) yes() ; else no() 4.000000e-06
+yes if ( x += .4e-5 ) yes() ; else no() 3.141504e+00
+yes if ( x -= .4e-5 ) yes() ; else no() 3.141496e+00
+yes if ( x /= .4e-5 ) yes() ; else no() 7.853750e+05
+yes if ( x *= .4e-5 ) yes() ; else no() 1.256600e-05
+yes if ( x ++ ) yes() ; else no() 4.141500e+00
+yes if ( x -- ) yes() ; else no() 2.141500e+00
+yes if ( -- x ) yes() ; else no() 2.141500e+00
+yes if ( ++ x ) yes() ; else no() 4.141500e+00
--- /dev/null
+/ISTART/d
+s/FN/main/
+/LSTART/c\
+ float x=3.1415 , y= 1e-7 ;
+/[^&]& /d
+/[^|]| /d
+/>>/d
+/<</d
+/%/d
+/\^/d
+/~/d
+/&=/d
+/|=/d
+/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
+/Z1/s/#/ %e&/
+/Z1/s/@/, Z1&/
+/Z2/s/#/ %e&/
+/Z2/s/@/, Z2&/
+/Z1/s/^/Z1 = 3.1415 ; /
+/Z2/s/^/Z2 = 1e-7 ; /
+/[XYZS]/s/^/ /
+s/X/.4e-5/g
+s/Y/.3e-5/g
+s/Z1/x/g
+s/Z2/y/g
+s/#/\\n/
+s/@//
--- /dev/null
+4 + 5
+4 - 5
+4 / 5
+4 % 5
+4 * 5
+4 & 5
+4 | 5
+4 ^ 5
+4 || 5
+4 && 5
+4 << 15
+4 >> 15
+-4
+!4
+~4
+4 == 5
+4 != 5
+4 <= 5
+4 >= 5
+4 < 5
+4 > 5
+4 ? 4 : 5
+x = 4 4
+x += 4 259
+x -= 4 251
+x /= 4 63
+x %= 4 3
+x *= 4 1020
+x &= 4 4
+x |= 4 255
+x ^= 4 251
+x <<= 15 -32768
+x >>= 15 0
+x ++ 256
+x -- 254
+-- x 254
+++ x 256
+y = ( 4 + 5 ) 9
+y = ( 4 - 5 ) -1
+y = ( 4 / 5 ) 0
+y = ( 4 % 5 ) 4
+y = ( 4 * 5 ) 20
+y = ( 4 & 5 ) 4
+y = ( 4 | 5 ) 5
+y = ( 4 ^ 5 ) 1
+y = ( 4 || 5 ) 1
+y = ( 4 && 5 ) 1
+y = ( 4 << 15 ) 0
+y = ( 4 >> 15 ) 0
+y = ( -4 ) -4
+y = ( !4 ) 0
+y = ( ~4 ) -5
+y = ( 4 == 5 ) 0
+y = ( 4 != 5 ) 1
+y = ( 4 <= 5 ) 1
+y = ( 4 >= 5 ) 0
+y = ( 4 < 5 ) 1
+y = ( 4 > 5 ) 0
+y = ( 4 ? 4 : 5 ) 4
+y = ( x = 4 ) 4 4
+y = ( x += 4 ) 259 259
+y = ( x -= 4 ) 251 251
+y = ( x /= 4 ) 63 63
+y = ( x %= 4 ) 3 3
+y = ( x *= 4 ) 1020 1020
+y = ( x &= 4 ) 4 4
+y = ( x |= 4 ) 255 255
+y = ( x ^= 4 ) 251 251
+y = ( x <<= 15 ) -32768 -32768
+y = ( x >>= 15 ) 0 0
+y = ( x ++ ) 256 255
+y = ( x -- ) 254 255
+y = ( -- x ) 254 254
+y = ( ++ x ) 256 256
+yes if ( 4 + 5 ) yes() ; else no()
+yes if ( 4 - 5 ) yes() ; else no()
+no if ( 4 / 5 ) yes() ; else no()
+yes if ( 4 % 5 ) yes() ; else no()
+yes if ( 4 * 5 ) yes() ; else no()
+yes if ( 4 & 5 ) yes() ; else no()
+yes if ( 4 | 5 ) yes() ; else no()
+yes if ( 4 ^ 5 ) yes() ; else no()
+yes if ( 4 || 5 ) yes() ; else no()
+yes if ( 4 && 5 ) yes() ; else no()
+no if ( 4 << 15 ) yes() ; else no()
+no if ( 4 >> 15 ) yes() ; else no()
+yes if ( -4 ) yes() ; else no()
+no if ( !4 ) yes() ; else no()
+yes if ( ~4 ) yes() ; else no()
+no if ( 4 == 5 ) yes() ; else no()
+yes if ( 4 != 5 ) yes() ; else no()
+yes if ( 4 <= 5 ) yes() ; else no()
+no if ( 4 >= 5 ) yes() ; else no()
+yes if ( 4 < 5 ) yes() ; else no()
+no if ( 4 > 5 ) yes() ; else no()
+yes if ( 4 ? 4 : 5 ) yes() ; else no()
+yes if ( x = 4 ) yes() ; else no() 4
+yes if ( x += 4 ) yes() ; else no() 259
+yes if ( x -= 4 ) yes() ; else no() 251
+yes if ( x /= 4 ) yes() ; else no() 63
+yes if ( x %= 4 ) yes() ; else no() 3
+yes if ( x *= 4 ) yes() ; else no() 1020
+yes if ( x &= 4 ) yes() ; else no() 4
+yes if ( x |= 4 ) yes() ; else no() 255
+yes if ( x ^= 4 ) yes() ; else no() 251
+yes if ( x <<= 15 ) yes() ; else no() -32768
+no if ( x >>= 15 ) yes() ; else no() 0
+yes if ( x ++ ) yes() ; else no() 256
+yes if ( x -- ) yes() ; else no() 254
+yes if ( -- x ) yes() ; else no() 254
+yes if ( ++ x ) yes() ; else no() 256
--- /dev/null
+1i\
+/* A sample sed script to show the use of the 'ops' file.\
+ ops is converted into a test program for local integers \
+*/
+/ISTART/d
+s/FN/main/
+/LSTART/c\
+ int x=255 , y= -256 ;
+/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
+/Z1/s/#/ %d&/
+/Z1/s/@/, Z1&/
+/Z2/s/#/ %d&/
+/Z2/s/@/, Z2&/
+/Z1/s/^/Z1 = 255 ; /
+/Z2/s/^/Z2 = 255 ; /
+/[XYZS]/s/^/ /
+s/X/4/g
+s/Y/5/g
+s/S/15/g
+s/Z1/x/g
+s/Z2/y/g
+s/#/\\n/
+s/@//
--- /dev/null
+40000 + 30000
+40000 - 30000
+40000 / 30000
+40000 % 30000
+40000 * 30000
+40000 & 30000
+40000 | 30000
+40000 ^ 30000
+40000 || 30000
+40000 && 30000
+40000 << 9
+40000 >> 9
+-40000
+!40000
+~40000
+40000 == 30000
+40000 != 30000
+40000 <= 30000
+40000 >= 30000
+40000 < 30000
+40000 > 30000
+40000 ? 40000 : 30000
+x = 40000 40000
+x += 40000 40010
+x -= 40000 -39990
+x /= 40000 0
+x %= 40000 10
+x *= 40000 400000
+x &= 40000 0
+x |= 40000 40010
+x ^= 40000 40010
+x <<= 9 5120
+x >>= 9 0
+x ++ 11
+x -- 9
+-- x 9
+++ x 11
+y = ( 40000 + 30000 ) 70000
+y = ( 40000 - 30000 ) 10000
+y = ( 40000 / 30000 ) 1
+y = ( 40000 % 30000 ) 10000
+y = ( 40000 * 30000 ) 1200000000
+y = ( 40000 & 30000 ) 5120
+y = ( 40000 | 30000 ) 64880
+y = ( 40000 ^ 30000 ) 59760
+y = ( 40000 || 30000 ) 1
+y = ( 40000 && 30000 ) 1
+y = ( 40000 << 9 ) 20480000
+y = ( 40000 >> 9 ) 78
+y = ( -40000 ) -40000
+y = ( !40000 ) 0
+y = ( ~40000 ) -40001
+y = ( 40000 == 30000 ) 0
+y = ( 40000 != 30000 ) 1
+y = ( 40000 <= 30000 ) 0
+y = ( 40000 >= 30000 ) 1
+y = ( 40000 < 30000 ) 0
+y = ( 40000 > 30000 ) 1
+y = ( 40000 ? 40000 : 30000 ) 40000
+y = ( x = 40000 ) 40000 40000
+y = ( x += 40000 ) 40010 40010
+y = ( x -= 40000 ) -39990 -39990
+y = ( x /= 40000 ) 0 0
+y = ( x %= 40000 ) 10 10
+y = ( x *= 40000 ) 400000 400000
+y = ( x &= 40000 ) 0 0
+y = ( x |= 40000 ) 40010 40010
+y = ( x ^= 40000 ) 40010 40010
+y = ( x <<= 9 ) 5120 5120
+y = ( x >>= 9 ) 0 0
+y = ( x ++ ) 11 10
+y = ( x -- ) 9 10
+y = ( -- x ) 9 9
+y = ( ++ x ) 11 11
+yes if ( 40000 + 30000 ) yes() ; else no()
+yes if ( 40000 - 30000 ) yes() ; else no()
+yes if ( 40000 / 30000 ) yes() ; else no()
+yes if ( 40000 % 30000 ) yes() ; else no()
+yes if ( 40000 * 30000 ) yes() ; else no()
+yes if ( 40000 & 30000 ) yes() ; else no()
+yes if ( 40000 | 30000 ) yes() ; else no()
+yes if ( 40000 ^ 30000 ) yes() ; else no()
+yes if ( 40000 || 30000 ) yes() ; else no()
+yes if ( 40000 && 30000 ) yes() ; else no()
+yes if ( 40000 << 9 ) yes() ; else no()
+yes if ( 40000 >> 9 ) yes() ; else no()
+yes if ( -40000 ) yes() ; else no()
+no if ( !40000 ) yes() ; else no()
+yes if ( ~40000 ) yes() ; else no()
+no if ( 40000 == 30000 ) yes() ; else no()
+yes if ( 40000 != 30000 ) yes() ; else no()
+no if ( 40000 <= 30000 ) yes() ; else no()
+yes if ( 40000 >= 30000 ) yes() ; else no()
+no if ( 40000 < 30000 ) yes() ; else no()
+yes if ( 40000 > 30000 ) yes() ; else no()
+yes if ( 40000 ? 40000 : 30000 ) yes() ; else no()
+yes if ( x = 40000 ) yes() ; else no() 40000
+yes if ( x += 40000 ) yes() ; else no() 40010
+yes if ( x -= 40000 ) yes() ; else no() -39990
+no if ( x /= 40000 ) yes() ; else no() 0
+yes if ( x %= 40000 ) yes() ; else no() 10
+yes if ( x *= 40000 ) yes() ; else no() 400000
+no if ( x &= 40000 ) yes() ; else no() 0
+yes if ( x |= 40000 ) yes() ; else no() 40010
+yes if ( x ^= 40000 ) yes() ; else no() 40010
+yes if ( x <<= 9 ) yes() ; else no() 5120
+no if ( x >>= 9 ) yes() ; else no() 0
+yes if ( x ++ ) yes() ; else no() 11
+yes if ( x -- ) yes() ; else no() 9
+yes if ( -- x ) yes() ; else no() 9
+yes if ( ++ x ) yes() ; else no() 11
--- /dev/null
+1i\
+ /* ops is converted into a test program for longs \
+*/
+/ISTART/d
+s/FN/main/
+/LSTART/c\
+ long x=100234 , y= -301 ;
+/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
+/Z1/s/#/ %D&/
+/Z1/s/@/, Z1&/
+/Z2/s/#/ %D&/
+/Z2/s/@/, Z2&/
+/Z1/s/^/Z1 = 10 ; /
+/Z2/s/^/Z2 = 0100 ; /
+/[XYZS]/s/^/ /
+s/X/40000/g
+s/Y/30000/g
+s/S/9/g
+s/Z1/x/g
+s/Z2/y/g
+s/#/\\n/
+s/@//
--- /dev/null
+x + 8012
+x - 8012
+x / 8012
+x % 8012
+x * 8012
+x & 8012
+x | 8012
+x ^ 8012
+x || 8012
+x && 8012
+x << 9
+x >> 9
+-x
+!x
+~x
+x == 8012
+x != 8012
+x <= 8012
+x >= 8012
+x < 8012
+x > 8012
+x ? x : 8012
+z = x -25302
+z += x -25292
+z -= x 25312
+z /= x 0
+z %= x 10
+z *= x 9124
+z &= x 10
+z |= x -25302
+z ^= x -25312
+z <<= 9 5120
+z >>= 9 0
+z ++ 11
+z -- 9
+-- z 9
+++ z 11
+y = ( x + 8012 ) -17290
+y = ( x - 8012 ) 32222
+y = ( x / 8012 ) 5
+y = ( x % 8012 ) 174
+y = ( x * 8012 ) -16776
+y = ( x & 8012 ) 7432
+y = ( x | 8012 ) -24722
+y = ( x ^ 8012 ) -32154
+y = ( x || 8012 ) 1
+y = ( x && 8012 ) 1
+y = ( x << 9 ) 21504
+y = ( x >> 9 ) 78
+y = ( -x ) 25302
+y = ( !x ) 0
+y = ( ~x ) 25301
+y = ( x == 8012 ) 0
+y = ( x != 8012 ) 1
+y = ( x <= 8012 ) 0
+y = ( x >= 8012 ) 1
+y = ( x < 8012 ) 0
+y = ( x > 8012 ) 1
+y = ( x ? x : 8012 ) -25302
+y = ( z = x ) -25302 -25302
+y = ( z += x ) -25292 -25292
+y = ( z -= x ) 25312 25312
+y = ( z /= x ) 0 0
+y = ( z %= x ) 10 10
+y = ( z *= x ) 9124 9124
+y = ( z &= x ) 10 10
+y = ( z |= x ) -25302 -25302
+y = ( z ^= x ) -25312 -25312
+y = ( z <<= 9 ) 5120 5120
+y = ( z >>= 9 ) 0 0
+y = ( z ++ ) 11 10
+y = ( z -- ) 9 10
+y = ( -- z ) 9 9
+y = ( ++ z ) 11 11
+yes if ( x + 8012 ) yes() ; else no()
+yes if ( x - 8012 ) yes() ; else no()
+yes if ( x / 8012 ) yes() ; else no()
+yes if ( x % 8012 ) yes() ; else no()
+yes if ( x * 8012 ) yes() ; else no()
+yes if ( x & 8012 ) yes() ; else no()
+yes if ( x | 8012 ) yes() ; else no()
+yes if ( x ^ 8012 ) yes() ; else no()
+yes if ( x || 8012 ) yes() ; else no()
+yes if ( x && 8012 ) yes() ; else no()
+yes if ( x << 9 ) yes() ; else no()
+yes if ( x >> 9 ) yes() ; else no()
+yes if ( -x ) yes() ; else no()
+no if ( !x ) yes() ; else no()
+yes if ( ~x ) yes() ; else no()
+no if ( x == 8012 ) yes() ; else no()
+yes if ( x != 8012 ) yes() ; else no()
+no if ( x <= 8012 ) yes() ; else no()
+yes if ( x >= 8012 ) yes() ; else no()
+no if ( x < 8012 ) yes() ; else no()
+yes if ( x > 8012 ) yes() ; else no()
+yes if ( x ? x : 8012 ) yes() ; else no()
+yes if ( z = x ) yes() ; else no() -25302
+yes if ( z += x ) yes() ; else no() -25292
+yes if ( z -= x ) yes() ; else no() 25312
+no if ( z /= x ) yes() ; else no() 0
+yes if ( z %= x ) yes() ; else no() 10
+yes if ( z *= x ) yes() ; else no() 9124
+yes if ( z &= x ) yes() ; else no() 10
+yes if ( z |= x ) yes() ; else no() -25302
+yes if ( z ^= x ) yes() ; else no() -25312
+yes if ( z <<= 9 ) yes() ; else no() 5120
+no if ( z >>= 9 ) yes() ; else no() 0
+yes if ( z ++ ) yes() ; else no() 11
+yes if ( z -- ) yes() ; else no() 9
+yes if ( -- z ) yes() ; else no() 9
+yes if ( ++ z ) yes() ; else no() 11
--- /dev/null
+1i\
+ /* ops is converted into a test program for longs \
+*/
+/ISTART/d
+s/FN/main/
+/LSTART/c\
+ unsigned x=40234 , y= 301 , z= 30 ;
+/[XYZS]/s/.*/& ; printf("%s#","&"@) ;/
+/Z1/s/#/ %d&/
+/Z1/s/@/, Z1&/
+/Z2/s/#/ %d&/
+/Z2/s/@/, Z2&/
+/Z1/s/^/Z1 = 10 ; /
+/Z2/s/^/Z2 = 0100 ; /
+/[XYZS]/s/^/ /
+s/X/x/g
+s/Y/8012/g
+s/S/9/g
+s/Z1/z/g
+s/Z2/y/g
+s/#/\\n/
+s/@//
--- /dev/null
+$(TS).c: OPS $(TS).sed
+ sed -f $(TS).sed <OPS >$(TS).c
--- /dev/null
+sed -f $1.sed <OPS >$1.c
--- /dev/null
+for A in *.sed
+do
+ run1 `basename $A .sed` ${1-gen}
+done
--- /dev/null
+make "TS=$1"
+make "P=$1" -fk ../makefile $2
+rm $1.[ckmos]
--- /dev/null
+main() {
+ none() ;
+ printf("Undetected: declaration of argument not present in argument list\n") ;
+ return 1 ;
+}
+
+int name ;
+none() int name ; { }
--- /dev/null
+echo ----- A missing argument error should be reported
+make "P=noarg" -fsk ../makefile ${1-gen}
--- /dev/null
+/*
+ * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ *
+ * This product is part of the Amsterdam Compiler Kit.
+ *
+ * Permission to use, sell, duplicate or disclose this software must be
+ * obtained in writing. Requests for such permissions may be sent to
+ *
+ * Dr. Andrew S. Tanenbaum
+ * Wiskundig Seminarium
+ * Vrije Universiteit
+ * Postbox 7161
+ * 1007 MC Amsterdam
+ * The Netherlands
+ *
+ */
+
+/* Author: E.G. Keizer */
+
+/* Test initialisation of a V7 C-compiler */
+/* 1 sept 1980 */
+#include "../local.h"
+
+/* Integers and constant expressions */
+
+int in1 = 4 ;
+int in2 = MAXINT ;
+int in3 = MININT ;
+int in4 ;
+int inzero ;
+
+int ice1 = (1-2+3*4/2)%3 ;
+int ice2 = ((((1&3)|4)^014) >> 1) <<1 ;
+int ice3 = ( (1==2) & (3<4) ) | (4>3) | (0<=0) | -2>=17 ;
+int ice4 = (~-1) ;
+int ice5 = (1==1 ? 3+4 : 5+6 ) ;
+int ice6 = (1!=1 ? 7+8 : 9+10 ) ;
+int ina[] = { 1, 3, 5 } ;
+
+pint() {
+ static int sint = -1 ;
+ int lint = in1+in3+sint ;
+
+ printf("Integers:\n\n") ;
+ printf("in1\t%d\nin2\t%d\nin3\t%d\nin4\t%d\ninzero\t%d\n\n",
+ in1,in2,in3,in4,inzero ) ;
+ printf("ice1\t%d\nice2\t%d\nice3\t%d\nice4\t%d\nice5\t%d\nice6\t%d\n\n",
+ ice1,ice2,ice3,ice4,ice5,ice6 ) ;
+ printf("ina\t%d,%d,%d\n\n",ina[0],ina[1],ina[2]) ;
+ printf("sint\t%d\nlint\t%d\n\n",sint,lint) ;
+}
+
+/* Characters */
+
+char ch1 = 'a' ;
+char ch2 ;
+char cha1[] = "Mesg" ;
+char cha2[] = "" ;
+char cha3[] = "1" ;
+char cha4[] = "12" ;
+char cha5[] = "0123456789112345678921234567893123456789412345678951234567896123456789712345678981234567899123456789" ;
+
+char cha6[2][3] = {
+ { 1, 2, 3 },
+ { 4, 5, 6 }
+};
+char *pch1 = cha2 ;
+char *pch2 = "pch2" ;
+char *pch3 = "ppch3" ;
+char *pch4 = 0 ;
+
+pch() {
+ static char stc[] = "123" ;
+ static char stc1[] = "1234" ;
+ static char *mult[] = { "ab" , "bc" , "de" } ;
+
+ printf("Characters:\n\n") ;
+
+ printf("ch1\t%c(%d)\n",ch1,ch1) ;
+ printf("ch2\t%d\n",ch2) ;
+ printf("cha1\t%s\ncha2\t%s\ncha3\t%s\ncha4\t%s\n",
+ cha1,cha2,cha3,cha4 ) ;
+ printf("cha5\t%s\n\n",cha5) ;
+ printf("cha6\t%d, %d, %d\n\t%d, %d, %d\n",
+ cha6[0][0],cha6[0][1],cha6[0][2],cha6[1][0],cha6[1][1],cha6[1][2]);
+ printf("pch1==cha2\t%s\n",(pch1 == cha2 ? "yes" : "no" ) ) ;
+ printf("pch2\t%s\npch3\t%s\n",pch2,pch3+1) ;
+ printf("pch4==0\t%s\n\n",(pch4 != 0 ? "no" : "yes" ) ) ;
+ printf("stc\t%s\nstc1\t%s\n",stc,stc1) ;
+ printf("mult[0],mult[1],mult[2] %s, %s, %s\n",mult[0],mult[1],mult[2]);
+}
+
+/* floats */
+
+float fl1 = 0 ;
+float fl2 = 2 ;
+float fl3 = 2e-10 ;
+float fl4 = 4.0 ;
+float fl5 = EPSFLOAT ;
+float fl6 = MAXFLOAT ;
+float fl7 ;
+
+float fla1[4][3] = {
+ { 1, 3, 5 },
+ { 2, 4, 6 },
+ { 3, 5, 7 }
+} ;
+float fla2[4][3] = {
+ -1,-3,-5,-2,-4,-6,-3,-5,-7
+} ;
+float fla3[4][3] = {
+ { 11 } , { 12 } , { 13 } , { 14 }
+} ;
+
+pflt() {
+ register i,j ;
+
+ printf("Floats:\n\n") ;
+
+printf("fl1\t%.20e\nfl2\t%.20e\nfl2\t%.20e\nfl4\t%.20e\nfl5\t%.20e\nfl6\t%.20e\nfl7\t%.20e\n",
+ fl1,fl2,fl2,fl4,fl5,fl6,fl7 ) ;
+
+ printf(" fla1 fla2 fla3\n") ;
+ for ( i=0 ; i<4 ; i++ ) {
+ for ( j=0 ; j<3 ; j++ ) {
+ printf(" %20e %20e %20e\n",
+ fla1[i][j],fla2[i][j],fla3[i][j]) ;
+ }
+ }
+
+ printf("\n") ;
+}
+
+/* doubles */
+
+double dbl1 = 0 ;
+double dbl2 = 2 ;
+double dbl3 = 2e-10 ;
+double dbl4 = 4.0 ;
+double dbl5 = EPSDOUBLE ;
+double dbl6 = MAXDOUBLE ;
+double dbl7 ;
+
+double dbla1[4][3] = {
+ { 1, 3, 5 },
+ { 2, 4, 6 },
+ { 3, 5, 7 }
+} ;
+double dbla2[4][3] = {
+ -1,-3,-5,-2,-4,-6,-3,-5,-7
+} ;
+double dbla3[4][3] = {
+ { 11 } , { 12 } , { 13 } , { 14 }
+} ;
+
+pdbl() {
+ register i,j ;
+
+ printf("Doubles:\n\n") ;
+
+printf("dbl1\t%.20e\ndbl2\t%.20e\ndbl2\t%.20e\ndbl4\t%.20e\ndbl5\t%.20e\ndbl6\t%.20e\ndbl7\t%.20e\n",
+ dbl1,dbl2,dbl2,dbl4,dbl5,dbl6,dbl7 ) ;
+
+ printf(" dbla1 dbla2 dbla3\n") ;
+ for ( i=0 ; i<4 ; i++ ) {
+ for ( j=0 ; j<3 ; j++ ) {
+ printf(" %20e %20e %20e\n",
+ dbla1[i][j],dbla2[i][j],dbla3[i][j]) ;
+ }
+ }
+
+ printf("\n") ;
+}
+
+/* long */
+long lo1 = 14L ;
+long lo2 = -17 ;
+long lo3 = MAXLONG ;
+long lo4 = MINLONG ;
+long lo5 ;
+long lo6 = ( 0==1 ? -1L : 1L ) ;
+
+plong() {
+ printf("long\n\n") ;
+
+ printf("lo1\t%D\nlo2\t%D\nlo3\t%D\nlo4\t%D\nlo5\t%D\nlo6\t%D\n\n",
+ lo1,lo2,lo3,lo4,lo5,lo6 ) ;
+}
+
+/* structures and bit fields */
+
+struct s1 {
+ int s_i ;
+ char s_ca[3] ;
+ long s_l ;
+ double s_f ;
+ struct s1 *s_s1 ;
+} ;
+struct s1 st1 ;
+struct s1 sta[3] = {
+ 1 , { 'a' , 'b' , 'c' } , 10 , -10 , &sta[0] ,
+ { 2 } ,
+ 3
+} ;
+struct s2 {
+ int s2_1 :1 ;
+ int s2_2 :2 ;
+ int s2_3 :4 ;
+ int s2_4 :7 ;
+ int s2_5 :2 ;
+ int s2_6 :11 ;
+ int s2_7 :6 ;
+} stb = {
+ 1,2,3,4,3,6,7
+} ;
+
+pstruct() {
+ printf("structures\n\n") ;
+
+ printf("\t st1 sta[0..2]\n") ;
+
+ printf("s_i\t%15d%15d%15d%15d\n",
+ st1.s_i,sta[0].s_i,sta[1].s_i,sta[2].s_i) ;
+ printf("s_ca[0]\t%15d%15d%15d%15d\n",
+ st1.s_ca[0],sta[0].s_ca[0],sta[1].s_ca[0],sta[2].s_ca[0]) ;
+ printf("s_ca[1]\t%15d%15d%15d%15d\n",
+ st1.s_ca[1],sta[0].s_ca[1],sta[1].s_ca[1],sta[2].s_ca[1]) ;
+ printf("s_ca[2]\t%15d%15d%15d%15d\n",
+ st1.s_ca[2],sta[0].s_ca[2],sta[1].s_ca[2],sta[2].s_ca[2]) ;
+ printf("s_l\t%15D%15D%15D%15D\n",
+ st1.s_l,sta[0].s_l,sta[1].s_l,sta[2].s_l) ;
+ printf("s_f\t %13e %13e %13e %13e\n\n",
+ st1.s_f,sta[0].s_f,sta[1].s_f,sta[2].s_f) ;
+ printf("(sta[0].s_s1)->s_i = %d\n",(sta[0].s_s1)->s_i) ;
+
+ printf("\nbit fields:\n\n") ;
+ printf("sizeof stb %d\n",sizeof stb) ;
+ printf("stb\t%d %d %d %d %d %d %d\n\n",
+ stb.s2_1,stb.s2_2,stb.s2_3,stb.s2_4,stb.s2_5,stb.s2_6,stb.s2_7);
+}
+
+main() {
+ pint() ;
+ pch() ;
+ pflt() ;
+ pdbl() ;
+ plong() ;
+ pstruct() ;
+ return(0) ;
+}
--- /dev/null
+Integers:
+
+in1 4
+in2 32767
+in3 -32768
+in4 0
+inzero 0
+
+ice1 2
+ice2 8
+ice3 1
+ice4 0
+ice5 7
+ice6 19
+
+ina 1,3,5
+
+sint -1
+lint -32765
+
+Characters:
+
+ch1 a(97)
+ch2 0
+cha1 Mesg
+cha2
+cha3 1
+cha4 12
+cha5 0123456789112345678921234567893123456789412345678951234567896123456789712345678981234567899123456789
+
+cha6 1, 2, 3
+ 4, 5, 6
+pch1==cha2 yes
+pch2 pch2
+pch3 pch3
+pch4==0 yes
+
+stc 123
+stc1 1234
+mult[0],mult[1],mult[2] ab, bc, de
+Floats:
+
+fl1 0.00000000000000000000e+00
+fl2 2.00000000000000000000e+00
+fl2 2.00000000000000000000e+00
+fl4 4.00000000000000000000e+00
+fl5 2.93873587705571892581e-39
+fl6 1.70141163178059625000e+38
+fl7 0.00000000000000000000e+00
+ fla1 fla2 fla3
+ 1.000000e+00 -1.000000e+00 1.100000e+01
+ 3.000000e+00 -3.000000e+00 0.000000e+00
+ 5.000000e+00 -5.000000e+00 0.000000e+00
+ 2.000000e+00 -2.000000e+00 1.200000e+01
+ 4.000000e+00 -4.000000e+00 0.000000e+00
+ 6.000000e+00 -6.000000e+00 0.000000e+00
+ 3.000000e+00 -3.000000e+00 1.300000e+01
+ 5.000000e+00 -5.000000e+00 0.000000e+00
+ 7.000000e+00 -7.000000e+00 0.000000e+00
+ 0.000000e+00 0.000000e+00 1.400000e+01
+ 0.000000e+00 0.000000e+00 0.000000e+00
+ 0.000000e+00 0.000000e+00 0.000000e+00
+
+Doubles:
+
+dbl1 0.00000000000000000000e+00
+dbl2 2.00000000000000000000e+00
+dbl2 2.00000000000000000000e+00
+dbl4 4.00000000000000000000e+00
+dbl5 2.93873600000000034793e-39
+dbl6 1.70141170000000000000e+38
+dbl7 0.00000000000000000000e+00
+ dbla1 dbla2 dbla3
+ 1.000000e+00 -1.000000e+00 1.100000e+01
+ 3.000000e+00 -3.000000e+00 0.000000e+00
+ 5.000000e+00 -5.000000e+00 0.000000e+00
+ 2.000000e+00 -2.000000e+00 1.200000e+01
+ 4.000000e+00 -4.000000e+00 0.000000e+00
+ 6.000000e+00 -6.000000e+00 0.000000e+00
+ 3.000000e+00 -3.000000e+00 1.300000e+01
+ 5.000000e+00 -5.000000e+00 0.000000e+00
+ 7.000000e+00 -7.000000e+00 0.000000e+00
+ 0.000000e+00 0.000000e+00 1.400000e+01
+ 0.000000e+00 0.000000e+00 0.000000e+00
+ 0.000000e+00 0.000000e+00 0.000000e+00
+
+long
+
+lo1 14
+lo2 -17
+lo3 2147483647
+lo4 -2147483648
+lo5 0
+lo6 1
+
+structures
+
+ st1 sta[0..2]
+s_i 0 1 2 3
+s_ca[0] 0 97 0 0
+s_ca[1] 0 98 0 0
+s_ca[2] 0 99 0 0
+s_l 0 10 0 0
+s_f 0.000000e+00 -1.000000e+01 0.000000e+00 0.000000e+00
+
+(sta[0].s_s1)->s_i = 1
+
+bit fields:
+
+sizeof stb 6
+stb 1 2 3 4 3 6 7
+
--- /dev/null
+make "P=init" -fsk ../makefile ${1-gen}
--- /dev/null
+main(argc,argv,envp) char **argv,**envp ; {
+ register int rargc ;
+
+ rargc=argc ;
+ printf("main called with argc = %d\n",argc) ;
+ printf("Arguments:\n") ;
+ while ( rargc-- ) {
+ printf(" %s\n",*argv++) ;
+ }
+ printf("Environment:\n") ;
+ while ( *envp ) {
+ printf(" %s\n",*envp++) ;
+ }
+ return(argc-1) ;
+}
--- /dev/null
+main called with argc = 1
+Arguments:
+ margt.cem
+Environment:
+ HOME=/other/keie
+ PATH=:/other/keie/bin:/bin:/usr/bin
+ TERM=MiniBee
--- /dev/null
+make "P=margt" -fsk ../makefile ${1-gen}
--- /dev/null
+.SILENT:
+CEM=pdp
+head: gen
+diffs:
+ echo No diffs in ctprof
+egen: tp.e
+ echo comparing tp.e
+ -if test -f tp.e.g ; then diff tp.cem.r tp.e.g ; else echo creating tp.e.g ; cp tp.cem.r tp.e.g ; fi
+ rm -f tp.e
+tp.e: tp.c $(CEM)
+ $(CEM) -p -c.e tp.c
+tp.cem.r: tp.cem
+ echo running tp
+ -tp.cem >tp.cem.r
+ rm -f tp.cem
+procentry.k: procentry.c
+ $(CEM) -c.k procentry.c
+tp.cem: tp.c procentry.k
+ echo $(CEM) tp.c procentry.k
+ $(CEM) -p -o tp.cem -O tp.c procentry.k
+ rm -f procentry.[kosm] tp.[kmos]
+gen: tp.cem.r
+ echo comparing tp
+ -if test -f tp.cem.g ; then diff tp.cem.r tp.cem.g ; else echo creating tp.cem.g ; cp tp.cem.r tp.cem.g ; fi
+
+pr:
+ @pr `pwd`/*.c tp.cem.g
+
+opr:
+ make pr | opr
+
+cleanup:
+ -rm -f *.[kosme] *.old
+
+transI transM cmpI cmpM:
--- /dev/null
+/*
+ * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ *
+ * This product is part of the Amsterdam Compiler Kit.
+ *
+ * Permission to use, sell, duplicate or disclose this software must be
+ * obtained in writing. Requests for such permissions may be sent to
+ *
+ * Dr. Andrew S. Tanenbaum
+ * Wiskundig Seminarium
+ * Vrije Universiteit
+ * Postbox 7161
+ * 1007 MC Amsterdam
+ * The Netherlands
+ *
+ */
+
+static int level = 0 ;
+int procentry(name) char *name ; {
+ register int count ;
+
+ count=level++ ;
+ while ( count-- ) {
+ printf(" ") ;
+ }
+ printf("Entering %s\n",name) ;
+}
+int procexit(name) char *name ; {
+ register int count ;
+
+ count= --level ;
+ while ( count-- ) {
+ printf(" ") ;
+ }
+ printf("Leaving %s\n",name) ;
+}
--- /dev/null
+echo test profiling
+make -k "`grep CEM= ../makefile`" ${1-gen}
--- /dev/null
+/*
+ * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ *
+ * This product is part of the Amsterdam Compiler Kit.
+ *
+ * Permission to use, sell, duplicate or disclose this software must be
+ * obtained in writing. Requests for such permissions may be sent to
+ *
+ * Dr. Andrew S. Tanenbaum
+ * Wiskundig Seminarium
+ * Vrije Universiteit
+ * Postbox 7161
+ * 1007 MC Amsterdam
+ * The Netherlands
+ *
+ */
+
+/* Author: E.G. Keizer */
+
+int fac(n) { return ( n==0 ? 1 : n*fac(n-1)) ; }
+
+main() {
+ { int dummy ;
+ if ( fac(6) != 720 ) printf("vernielt return waarde\n") ;
+ }
+ return 0 ;
+}
--- /dev/null
+Entering main
+ Entering fac
+ Entering fac
+ Entering fac
+ Entering fac
+ Entering fac
+ Entering fac
+ Entering fac
+ Leaving fac
+ Leaving fac
+ Leaving fac
+ Leaving fac
+ Leaving fac
+ Leaving fac
+ Leaving fac
+Leaving main
--- /dev/null
+make "P=tfork" -fsk ../makefile ${1-gen}
--- /dev/null
+#include <signal.h>
+foo()
+{
+ printf("signal received\n");
+}
+
+main()
+{
+ signal(SIGINT,foo);
+ while(1);
+}
--- /dev/null
+main(argc,argv) char **argv ; {
+ int child, waitchild ;
+ int status ;
+ child=fork() ;
+ if ( child== -1 ) {
+ printf("fork returned -1\n") ;
+ return 1 ;
+ }
+ if ( child ) {
+ /* The parent */
+ printf("childno %d\n",child ) ;
+ do {
+ waitchild= wait(&status ) ;
+ printf("Child %d, status 0x%x\n",waitchild,status) ;
+ if ( waitchild== -1 ) {
+ printf("No children\n") ;
+ return 1 ;
+ }
+ } while ( waitchild!=child ) ;
+ if ( argc<=1 && status != (8<<8) ) {
+ printf("incorrect status return\n") ;
+ return 2 ;
+ }
+ } else {
+ /* The child */
+ if ( argc>1 ) pause() ;
+ return 8 ;
+ }
+ printf("fork/wait ok\n") ;
+ return 0 ;
+}
--- /dev/null
+childno N
+Child N, status 0x800
+fork/wait ok
--- /dev/null
+# define MAXINT 32767
+# define MININT -32768
+# define MAXLONG 2147483647
+# define MINLONG -2147483648
+# define EPSFLOAT 2.938736e-39
+# define MAXFLOAT 1.7014117e38
+# define EPSDOUBLE 2.938736e-39
+/* for 64-bit double 1.701411834604692293e38 */
+# define MAXDOUBLE 1.7014117e38
--- /dev/null
+.SILENT:
+CEM=acc
+head:
+ echo use run
+
+diffs: $P.pcc.r $P.cc.r $P.cem.r
+ echo three compiler diff
+ -diff3 $P.*.r | tee diffs
+egen: $P.e
+ echo comparing $P.e
+ -if test -f $P.e.g ; then diff -h $P.e $P.e.g ; else echo creating $P.e.g ; cp $P.e $P.e.g ; fi
+ rm -f $P.e
+$P.e: $P.c $(CEM)
+ $(CEM) -c.e $P.c
+$P.pcc.r: $P.pcc
+ echo running $P.pcc
+ -$P.pcc >$P.pcc.r
+ rm -f $P.pcc
+$P.cc.r: $P.cc
+ echo running $P.cc
+ -$P.cc >$P.cc.r
+ rm -f $P.cc
+$P.cem.r: $P.cem
+ echo running $P.cem
+ -$P.cem >$P.cem.r
+ rm -f $P.cem
+$P.pcc: /tmp
+ echo pcc $P.c
+ pcc -o $P.pcc $P.c
+$P.cc: /tmp
+ echo cc $P.c
+ cc -o $P.cc $P.c
+$P.cem: /tmp
+ echo $(CEM) $P.c
+ $(CEM) -o $P.cem $P.c
+gen: $P.cem.r
+ echo comparing $P
+ -if test -f $P.cem.g ; then diff -h $P.cem.r $P.cem.g ; else echo creating $P.cem.g ; cp $P.cem.r $P.cem.g ; fi
+
+install cmp:
+
+pr:
+ @pr `pwd`/$P.c `pwd`/$P.cem.g
+
+opr:
+ make pr | opr
+
+clean:
+ -rm -f $P.[kmsoe] core a.out *.old
--- /dev/null
+.SILENT:
+CEM=net86
+head:
+ echo use run
+
+diffs: $P.pcc.r $P.cc.r $P.cem.r
+ echo three compiler diff
+ -diff3 $P.*.r | tee diffs
+egen: $P.e
+ echo comparing $P.e
+ -if test -f $P.e.g ; then diff -h $P.e $P.e.g ; else echo creating $P.e.g ; cp $P.e $P.e.g ; fi
+ rm -f $P.e
+$P.e: $P.c $(CEM)
+ $(CEM) -c.e $P.c
+$P.pcc.r: $P.pcc
+ echo running $P.pcc
+ -$P.pcc >$P.pcc.r
+ rm -f $P.pcc
+$P.cc.r: $P.cc
+ echo running $P.cc
+ -$P.cc >$P.cc.r
+ rm -f $P.cc
+$P.cem.r: $P.cem
+ echo running $P.cem
+ idl I7 $P.cem
+ -talk I7 >$P.cem.r
+ rm -f $P.cem
+$P.pcc: $P.c /usr/lib/ccom
+ echo pcc $P.c
+ pcc -o $P.pcc $P.c
+$P.cc: $P.c /lib/c0 /lib/c1
+ echo cc $P.c
+ cc -o $P.cc $P.c
+$P.cem: $P.c
+ echo $(CEM) $P.c
+ $(CEM) -o $P.cem $P.c
+gen: $P.cem.r
+ echo comparing $P
+ -if test -f $P.cem.g ; then diff -h $P.cem.r $P.cem.g ; else echo creating $P.cem.g ; cp $P.cem.r $P.cem.g ; fi
+
+install cmp:
+
+pr:
+ @pr `pwd`/$P.c `pwd`/$P.cem.g
+
+opr:
+ make pr | opr
+
+clean:
+ -rm -f $P.[kmsoe] core a.out *.old
--- /dev/null
+.SILENT:
+CEM=int -O
+head:
+ echo use run
+
+diffs: $P.pcc.r $P.cc.r $P.cem.r
+ echo three compiler diff
+ -diff3 $P.*.r | tee diffs
+egen: $P.e
+ echo comparing $P.e
+ -if test -f $P.e.g ; then diff -h $P.e $P.e.g ; else echo creating $P.e.g ; cp $P.e $P.e.g ; fi
+ rm -f $P.e
+$P.e: $P.c $(CEM)
+ $(CEM) -c.e $P.c
+$P.pcc.r: $P.pcc
+ echo running $P.pcc
+ -$P.pcc >$P.pcc.r
+ rm -f $P.pcc
+$P.cc.r: $P.cc
+ echo running $P.cc
+ -$P.cc >$P.cc.r
+ rm -f $P.cc
+$P.cem.r: $P.cem
+ echo running $P.cem
+ -/usr/evert/compile/a.out $P.cem >$P.cem.r
+ rm -f $P.cem
+$P.pcc: $P.c /usr/lib/ccom
+ echo pcc $P.c
+ pcc -o $P.pcc $P.c
+$P.cc: $P.c /lib/c0 /lib/c1
+ echo cc $P.c
+ cc -o $P.cc $P.c
+$P.cem: $P.c
+ echo $(CEM) $P.c
+ $(CEM) -o $P.cem $P.c
+gen: $P.cem.r
+ echo comparing $P
+ -if test -f $P.cem.g ; then diff -h $P.cem.r $P.cem.g ; else echo creating $P.cem.g ; cp $P.cem.r $P.cem.g ; fi
+
+install cmp:
+
+pr:
+ @pr `pwd`/$P.c `pwd`/$P.cem.g
+
+opr:
+ make pr | opr
+
+clean:
+ -rm -f $P.[kmsoe] core a.out *.old
--- /dev/null
+.SILENT:
+CEM=acc
+head:
+ echo use run
+
+diffs: $P.pcc.r $P.cc.r $P.cem.r
+ echo three compiler diff
+ -diff3 $P.*.r | tee diffs
+egen: $P.e
+ echo comparing $P.e
+ -if test -f $P.e.g ; then diff -h $P.e $P.e.g ; else echo creating $P.e.g ; cp $P.e $P.e.g ; fi
+ rm -f $P.e
+$P.e: $P.c $(CEM)
+ $(CEM) -c.e $P.c
+$P.pcc.r: $P.pcc
+ echo running $P.pcc
+ -$P.pcc >$P.pcc.r
+ rm -f $P.pcc
+$P.cc.r: $P.cc
+ echo running $P.cc
+ -$P.cc >$P.cc.r
+ rm -f $P.cc
+$P.cem.r: $P.cem
+ echo running $P.cem
+ -$P.cem >$P.cem.r
+ rm -f $P.cem
+$P.pcc: /tmp
+ echo pcc $P.c
+ pcc -o $P.pcc $P.c
+$P.cc: /tmp
+ echo cc $P.c
+ cc -o $P.cc $P.c
+$P.cem: /tmp
+ echo $(CEM) $P.c
+ $(CEM) -o $P.cem $P.c
+gen: $P.cem.r
+ echo comparing $P
+ -if test -f $P.cem.g ; then diff -h $P.cem.r $P.cem.g ; else echo creating $P.cem.g ; cp $P.cem.r $P.cem.g ; fi
+
+install cmp:
+
+pr:
+ @pr `pwd`/$P.c `pwd`/$P.cem.g
+
+opr:
+ make pr | opr
+
+clean:
+ -rm -f $P.[kmsoe] core a.out *.old
--- /dev/null
+Tue May 22 15:12:22 MDT 1984
+***** ctconv
+acc conv.c
+conv.c
+"conv.c", line 41: warning: Overflow in constant expression
+running conv.cem
+comparing conv
+***** ctdecl
+acc decl.c
+decl.c
+running decl.cem
+comparing decl
+***** ctdivers
+acc ops.c
+ops.c
+running ops.cem
+comparing ops
+***** cterr
+acc bugs.c
+bugs.c
+"bugs.c", line 92: warning: Overflow in constant expression
+running bugs.cem
+comparing bugs
+9,$c9,$
+< compl_ind
+< END
+---
+> END
+***** ctest1
+acc test.c
+test.c
+running test.cem
+comparing test
+***** ctest2
+acc t7.c
+t7.c
+"t7.c", line 161: warning: statement not reached
+"t7.c", line 178: warning: statement not reached
+"t7.c", line 182: warning: statement not reached
+"t7.c", line 186: warning: statement not reached
+"t7.c", line 190: warning: statement not reached
+"t7.c", line 194: warning: statement not reached
+"t7.c", line 198: warning: statement not reached
+"t7.c", line 205: warning: statement not reached
+"t7.c", line 207: warning: statement not reached
+"t7.c", line 211: warning: statement not reached
+"t7.c", line 213: warning: statement not reached
+"t7.c", line 287: warning: statement not reached
+"t7.c", line 294: warning: statement not reached
+"t7.c", line 300: warning: statement not reached
+"t7.c", line 307: warning: statement not reached
+"t7.c", line 343: warning: statement not reached
+"t7.c", line 344: warning: statement not reached
+"t7.c", line 345: warning: statement not reached
+"t7.c", line 346: warning: statement not reached
+"t7.c", line 348: warning: statement not reached
+"t7.c", line 452: warning: statement not reached
+"t7.c", line 561: warning: statement not reached
+"t7.c", line 589: warning: statement not reached
+running t7.cem
+comparing t7
+***** ctest3
+acc test2.c
+test2.c
+running test2.cem
+comparing test2
+***** ctest5
+acc test1.c
+test1.c
+"test1.c", line 101: warning: Illegal shift count in constant expression
+"test1.c", line 370: warning: illegal pointer combination
+"test1.c", line 371: warning: illegal pointer combination
+"test1.c", line 372: warning: illegal pointer combination
+"test1.c", line 384: warning: illegal pointer combination
+"test1.c", line 407: warning: illegal pointer combination
+"test1.c", line 408: warning: illegal pointer combination
+"test1.c", line 409: warning: illegal pointer combination
+"test1.c", line 421: warning: illegal pointer combination
+running test1.cem
+comparing test1
+***** ctgen
+`bf.c' is up to date.
+acc bf.c
+bf.c
+running bf.cem
+comparing bf
+`cel.c' is up to date.
+acc cel.c
+cel.c
+running cel.cem
+comparing cel
+`clu.c' is up to date.
+acc clu.c
+clu.c
+"clu.c", line 60: warning: Overflow in constant expression
+"clu.c", line 66: warning: Overflow in constant expression
+running clu.cem
+comparing clu
+28c28
+< x *= 40000 0
+---
+> x *= 40000 6784
+65c65
+< y = ( x *= 40000 ) 0 0
+---
+> y = ( x *= 40000 ) 6784 6784
+102c102
+< no if ( x *= 40000 ) yes() ; else no() 0
+---
+> yes if ( x *= 40000 ) yes() ; else no() 6784
+`ec.c' is up to date.
+acc ec.c
+ec.c
+"ec.c", line 58: warning: Overflow in constant expression
+"ec.c", line 64: warning: Overflow in constant expression
+running ec.cem
+comparing ec
+`ef.c' is up to date.
+acc ef.c
+ef.c
+running ef.cem
+comparing ef
+`ei.c' is up to date.
+acc ei.c
+ei.c
+"ei.c", line 22: warning: Overflow in constant expression
+"ei.c", line 65: warning: Overflow in constant expression
+"ei.c", line 108: warning: Overflow in constant expression
+running ei.cem
+comparing ei
+`el.c' is up to date.
+acc el.c
+el.c
+running el.cem
+comparing el
+`eu.c' is up to date.
+acc eu.c
+eu.c
+"eu.c", line 58: warning: Overflow in constant expression
+"eu.c", line 64: warning: Overflow in constant expression
+running eu.cem
+comparing eu
+28c28
+< x *= 40000 0
+---
+> x *= 40000 6784
+65c65
+< y = ( x *= 40000 ) 0 0
+---
+> y = ( x *= 40000 ) 6784 6784
+102c102
+< no if ( x *= 40000 ) yes() ; else no() 0
+---
+> yes if ( x *= 40000 ) yes() ; else no() 6784
+`id.c' is up to date.
+acc id.c
+id.c
+running id.cem
+comparing id
+`lc.c' is up to date.
+acc lc.c
+lc.c
+"lc.c", line 60: warning: Overflow in constant expression
+"lc.c", line 66: warning: Overflow in constant expression
+running lc.cem
+comparing lc
+`ld.c' is up to date.
+acc ld.c
+ld.c
+running ld.cem
+comparing ld
+`lf.c' is up to date.
+acc lf.c
+lf.c
--- /dev/null
+date
+for A in ct*
+do (
+ echo "***** $A"
+ cd "$A"
+ if test -r run ; then
+ sh run "${1-gen}"
+ else
+ echo "No run file present"
+ fi
+ )
+done
+date