Annotation of researchv10no/cmd/ccom/vax/tests/m.i, revision 1.1.1.1

1.1       root        1: struct defs {
                      2:      int cbits;          
                      3:      int ibits;          
                      4:      int sbits;          
                      5:      int lbits;          
                      6:      int ubits;          
                      7:      int fbits;          
                      8:      int dbits;          
                      9:      float fprec;        
                     10:      float dprec;        
                     11:      int flgs;           
                     12:      int flgm;           
                     13:      int flgd;           
                     14:      int flgl;           
                     15:      int rrc;            
                     16:      int crc;            
                     17:      char rfs[8];        
                     18:    };
                     19: extern struct  _iobuf {
                     20:        int     _cnt;
                     21:        unsigned char   *_ptr;
                     22:        unsigned char   *_base;
                     23:        short   _flag;
                     24:        char    _file;
                     25: } _iob[20];
                     26: struct _iobuf  *fopen();
                     27: struct _iobuf  *fdopen();
                     28: struct _iobuf  *freopen();
                     29: long   ftell();
                     30: char   *fgets();
                     31: struct record{
                     32:        int field1,field2,field3;
                     33:        };
                     34:        struct list { int f1; double f2; float f3; } ;
                     35:        union rec { int recf1; float recf2; double recf3; } ;
                     36: struct list rfun(x)  struct list x;
                     37: {
                     38: x.f1=x.f1+100;
                     39: x.f2=x.f2+200.0;
                     40: x.f3=x.f3+300.0;
                     41: return x;
                     42: }
                     43: union rec ufun(x) union rec x;
                     44: {
                     45: x.recf2=x.recf2+100.0;
                     46: return x;
                     47: }
                     48: 
                     49: s141(pd0)      
                     50:        struct defs *pd0;
                     51: {
                     52: static char s141er[]="s141,er%d\n";
                     53: static char qs141[8]="s141   ";
                     54: struct list r1,r2,r3;
                     55: union rec rec1, rec2;
                     56: char *ps = qs141,
                     57:      *pt = pd0->rfs;
                     58: int rc = 0 ;
                     59: 
                     60:  while ( *(pt)++ = *(ps)++ );
                     61: 
                     62: r1.f1=1000; r1.f2=2000.0; r1.f3=3000.0;
                     63: r3=r2=r1;
                     64: 
                     65: if (1000!=r2.f1 || 2000.0!=r2.f2 || 3000.0!=r2.f3
                     66:    || r1.f1!=r3.f1 || r1.f2!=r3.f2 || r1.f3!=r3.f3)
                     67:        { rc++; if (pd0->flgd) printf(s141er,1); }
                     68: r2.f3=r2.f2=r2.f1=1;
                     69: r3=rfun(r2=r1);
                     70: 
                     71: if (r3.f1!=r1.f1+100 || r1.f1!=r2.f1 || r1.f1!=1000 ||
                     72:     r3.f2!=r1.f2+200.0 || r1.f2!=r2.f2 || r1.f2!=2000.0 ||
                     73:     r3.f3!=r1.f3+300.0 || r1.f3!=r2.f3 || r1.f3!=3000.0 )
                     74:        { rc+=2; if (pd0->flgd) printf(s141er,2); }
                     75: if (r3.f3!=rfun(r1).f3)
                     76:        { rc+=4; if (pd0->flgd) printf(s141er,4); }
                     77: rec1.recf2=33.0;
                     78: rec2=ufun(rec1);
                     79: if (ufun(rec1).recf2!=133.0 || rec1.recf2!=33.0)
                     80:        { rc +=8 ; if (pd0->flgd) printf(s141er,8); }
                     81: return rc;
                     82: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.